# Beta

# Agents

## Create an agent

**post** `/agents`

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

### Body Parameters

- `model: string`

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

- `instructions: optional string or null`

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

- `metadata: optional map[string] or 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: optional MultiAgentConfigParam or null`

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

  - `enabled: boolean`

    Whether subagent tools are enabled.

  - `max_concurrent_subagents: optional number`

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

- `name: optional string or null`

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

- `reasoning: optional AgentReasoningParam or null`

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

  - `effort: optional "none" or "minimal" or "low" or 4 more or null`

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

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary: optional "concise" or "detailed" or "auto" or 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: optional "auto" or "default" or "flex" or 3 more or 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: optional AgentTextParam or null`

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

  - `format: optional TextFormatParam or null`

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

    - `Text object { type }`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `JSONSchema object { schema, type }`

      Constrains generated text to a JSON Schema.

      - `schema: map[unknown]`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

  - `verbosity: optional "low" or "medium" or "high" or 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: optional array of PersistedAgentToolParam or 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.

  - `Function object { description, name, parameters, 2 more }`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `defer_loading: optional boolean`

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

  - `ToolSearch object { type }`

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

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `ProgrammaticToolCalling object { type, enabled }`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled: optional boolean`

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

  - `Mcp object { server_label, transport, type, 5 more }`

    Tools provided by a remote MCP server without stored credentials.

    - `server_label: string`

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

    - `transport: PersistedMcpTransportParam`

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

      - `HTTP object { server_url, type, headers }`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `headers: optional map[string] or null`

          Non-secret HTTP headers sent to the MCP server.

      - `Stdio object { command, cwd, type, 2 more }`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args: optional array of string or null`

          Arguments passed to the MCP server command.

        - `env_vars: optional array of string or null`

          Environment variable names to inherit from the selected execution environment.

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools: optional array of string or null`

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

    - `connection_origin: optional "service" or "environment" or null`

      Selects where outbound MCP HTTP connections originate.

      - `"service"`

        Uses the Managed Agents service network.

      - `"environment"`

        Uses the session's execution environment.

    - `credential_id: optional string or null`

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

    - `request_metadata: optional map[unknown] or null`

      Metadata included with requests to this MCP server.

    - `required: optional boolean`

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

  - `WebSearch object { type, allowed_domains, context_size, 2 more }`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains: optional array of string or null`

      Domains the search may include.

    - `context_size: optional "low" or "medium" or "high" or null`

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: optional object { city, country, region, timezone }  or null`

      Approximate location used to localize search results.

      - `city: optional string or null`

        The city name.

      - `country: optional string or null`

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

      - `region: optional string or null`

        The region or state name.

      - `timezone: optional string or null`

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

    - `mode: optional "disabled" or "cached" or "live" or 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.

  - `ComputerUse object { type, include_screenshots }`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots: optional boolean`

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

### Returns

- `Agent object { id, created_at, instructions, 10 more }`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

  - `created_at: number`

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

  - `instructions: string or null`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

  - `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 or null`

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

  - `name: string or null`

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

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

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

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

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: array of PersistedAgentTool`

    Tools available to the agent.

    - `Function object { defer_loading, description, name, 2 more }`

      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.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { enabled, type }`

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

    - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: array of string or null`

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

      - `connection_origin: "service" or "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string or null`

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

      - `request_metadata: map[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.

      - `transport: PersistedMcpTransport`

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

        - `HTTP object { headers, server_url, type }`

          Connects to an MCP server over HTTP.

          - `headers: map[string]`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `Stdio object { args, command, cwd, 2 more }`

          Starts an MCP server as a local process.

          - `args: array of string`

            Arguments passed to the MCP server command.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `env_vars: array of string`

            Environment variable names inherited from the execution environment.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `WebSearch object { allowed_domains, context_size, location, 2 more }`

      Web search.

      - `allowed_domains: array of string or null`

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

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: object { city, country, region, timezone }  or null`

        Approximate location used to localize search results, if provided.

        - `city: string or null`

          The city name.

        - `country: string or null`

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

        - `region: string or null`

          The region or state name.

        - `timezone: string or null`

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

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

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `ComputerUse object { include_screenshots, type }`

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

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "model": "model"
        }'
```

#### Response

```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"
    }
  ],
  "updated_at": 0
}
```

## Delete an agent

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

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

### Path Parameters

- `agent_id: string`

### Returns

- `AgentDeleted object { id, deleted, object }`

  A deleted reusable agent.

  - `id: string`

    The ID of the deleted agent.

  - `deleted: boolean`

    Whether the agent was deleted. Always `true`.

  - `object: "agent.deleted"`

    The object type. Always `agent.deleted`.

    - `"agent.deleted"`

### Example

```http
curl https://api.openai.com/v1/agents/$AGENT_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

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

## List agents

**get** `/agents`

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

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

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

- `order: optional "asc" or "desc"`

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

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of Agent`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the reusable agent.

  - `created_at: number`

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

  - `instructions: string or null`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

  - `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 or null`

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

  - `name: string or null`

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

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

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

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

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: array of PersistedAgentTool`

    Tools available to the agent.

    - `Function object { defer_loading, description, name, 2 more }`

      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.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { enabled, type }`

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

    - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: array of string or null`

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

      - `connection_origin: "service" or "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string or null`

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

      - `request_metadata: map[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.

      - `transport: PersistedMcpTransport`

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

        - `HTTP object { headers, server_url, type }`

          Connects to an MCP server over HTTP.

          - `headers: map[string]`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `Stdio object { args, command, cwd, 2 more }`

          Starts an MCP server as a local process.

          - `args: array of string`

            Arguments passed to the MCP server command.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `env_vars: array of string`

            Environment variable names inherited from the execution environment.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `WebSearch object { allowed_domains, context_size, location, 2 more }`

      Web search.

      - `allowed_domains: array of string or null`

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

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: object { city, country, region, timezone }  or null`

        Approximate location used to localize search results, if provided.

        - `city: string or null`

          The city name.

        - `country: string or null`

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

        - `region: string or null`

          The region or state name.

        - `timezone: string or null`

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

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

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `ComputerUse object { include_screenshots, type }`

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

  - `updated_at: number`

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

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
        }
      ],
      "updated_at": 0
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent

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

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

### Path Parameters

- `agent_id: string`

### Returns

- `Agent object { id, created_at, instructions, 10 more }`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

  - `created_at: number`

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

  - `instructions: string or null`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

  - `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 or null`

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

  - `name: string or null`

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

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

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

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

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: array of PersistedAgentTool`

    Tools available to the agent.

    - `Function object { defer_loading, description, name, 2 more }`

      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.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { enabled, type }`

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

    - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: array of string or null`

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

      - `connection_origin: "service" or "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string or null`

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

      - `request_metadata: map[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.

      - `transport: PersistedMcpTransport`

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

        - `HTTP object { headers, server_url, type }`

          Connects to an MCP server over HTTP.

          - `headers: map[string]`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `Stdio object { args, command, cwd, 2 more }`

          Starts an MCP server as a local process.

          - `args: array of string`

            Arguments passed to the MCP server command.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `env_vars: array of string`

            Environment variable names inherited from the execution environment.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `WebSearch object { allowed_domains, context_size, location, 2 more }`

      Web search.

      - `allowed_domains: array of string or null`

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

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: object { city, country, region, timezone }  or null`

        Approximate location used to localize search results, if provided.

        - `city: string or null`

          The city name.

        - `country: string or null`

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

        - `region: string or null`

          The region or state name.

        - `timezone: string or null`

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

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

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `ComputerUse object { include_screenshots, type }`

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

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents/$AGENT_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
    }
  ],
  "updated_at": 0
}
```

## Update an agent

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

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

### Path Parameters

- `agent_id: string`

### Body Parameters

- `instructions: optional string or null`

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

- `metadata: optional map[string] or 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: optional string`

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

- `multi_agent: optional MultiAgentConfigParam or null`

  Configuration for creating and coordinating subagents.

  - `enabled: boolean`

    Whether subagent tools are enabled.

  - `max_concurrent_subagents: optional number`

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

- `name: optional string or null`

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

- `reasoning: optional AgentReasoningParam or null`

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

  - `effort: optional "none" or "minimal" or "low" or 4 more or null`

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

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary: optional "concise" or "detailed" or "auto" or 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: optional "auto" or "default" or "flex" or 3 more or 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: optional AgentTextParam or null`

  Configuration for text generated by the agent.

  - `format: optional TextFormatParam or null`

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

    - `Text object { type }`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `JSONSchema object { schema, type }`

      Constrains generated text to a JSON Schema.

      - `schema: map[unknown]`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

  - `verbosity: optional "low" or "medium" or "high" or 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: optional array of PersistedAgentToolParam or 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.

  - `Function object { description, name, parameters, 2 more }`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `defer_loading: optional boolean`

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

  - `ToolSearch object { type }`

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

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `ProgrammaticToolCalling object { type, enabled }`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled: optional boolean`

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

  - `Mcp object { server_label, transport, type, 5 more }`

    Tools provided by a remote MCP server without stored credentials.

    - `server_label: string`

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

    - `transport: PersistedMcpTransportParam`

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

      - `HTTP object { server_url, type, headers }`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `headers: optional map[string] or null`

          Non-secret HTTP headers sent to the MCP server.

      - `Stdio object { command, cwd, type, 2 more }`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args: optional array of string or null`

          Arguments passed to the MCP server command.

        - `env_vars: optional array of string or null`

          Environment variable names to inherit from the selected execution environment.

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools: optional array of string or null`

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

    - `connection_origin: optional "service" or "environment" or null`

      Selects where outbound MCP HTTP connections originate.

      - `"service"`

        Uses the Managed Agents service network.

      - `"environment"`

        Uses the session's execution environment.

    - `credential_id: optional string or null`

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

    - `request_metadata: optional map[unknown] or null`

      Metadata included with requests to this MCP server.

    - `required: optional boolean`

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

  - `WebSearch object { type, allowed_domains, context_size, 2 more }`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains: optional array of string or null`

      Domains the search may include.

    - `context_size: optional "low" or "medium" or "high" or null`

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: optional object { city, country, region, timezone }  or null`

      Approximate location used to localize search results.

      - `city: optional string or null`

        The city name.

      - `country: optional string or null`

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

      - `region: optional string or null`

        The region or state name.

      - `timezone: optional string or null`

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

    - `mode: optional "disabled" or "cached" or "live" or 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.

  - `ComputerUse object { type, include_screenshots }`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots: optional boolean`

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

### Returns

- `Agent object { id, created_at, instructions, 10 more }`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

  - `created_at: number`

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

  - `instructions: string or null`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

  - `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 or null`

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

  - `name: string or null`

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

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

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

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

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: array of PersistedAgentTool`

    Tools available to the agent.

    - `Function object { defer_loading, description, name, 2 more }`

      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.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { enabled, type }`

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

    - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: array of string or null`

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

      - `connection_origin: "service" or "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string or null`

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

      - `request_metadata: map[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.

      - `transport: PersistedMcpTransport`

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

        - `HTTP object { headers, server_url, type }`

          Connects to an MCP server over HTTP.

          - `headers: map[string]`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `Stdio object { args, command, cwd, 2 more }`

          Starts an MCP server as a local process.

          - `args: array of string`

            Arguments passed to the MCP server command.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `env_vars: array of string`

            Environment variable names inherited from the execution environment.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `WebSearch object { allowed_domains, context_size, location, 2 more }`

      Web search.

      - `allowed_domains: array of string or null`

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

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: object { city, country, region, timezone }  or null`

        Approximate location used to localize search results, if provided.

        - `city: string or null`

          The city name.

        - `country: string or null`

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

        - `region: string or null`

          The region or state name.

        - `timezone: string or null`

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

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

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `ComputerUse object { include_screenshots, type }`

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

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents/$AGENT_ID \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
    }
  ],
  "updated_at": 0
}
```

### Example

```http
# 1. Omit reasoning: keep its current settings while renaming the agent.
curl "https://api.openai.com/v1/agents/$AGENT_ID" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: agents=v1" \
  -d '{"name": "Renamed"}'

# 2. Send null: reset reasoning to the model's defaults.
curl "https://api.openai.com/v1/agents/$AGENT_ID" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: agents=v1" \
  -d '{"reasoning": null}'

# 3. Send an object: replace the entire reasoning configuration, without merging.
# The agent's model must support the "low" reasoning effort.
curl "https://api.openai.com/v1/agents/$AGENT_ID" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: agents=v1" \
  -d '{"reasoning": {"effort": "low"}}'
```

## Domain Types

### Agent

- `Agent object { id, created_at, instructions, 10 more }`

  A reusable agent scoped to the caller's project.

  - `id: string`

    The ID of the reusable agent.

  - `created_at: number`

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

  - `instructions: string or null`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the agent.

  - `model: string`

    The requested model name used for inference.

  - `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 or null`

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

  - `name: string or null`

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

  - `object: "agent"`

    The object type. Always `agent`.

    - `"agent"`

  - `reasoning: AgentReasoning`

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

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

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

  - `tools: array of PersistedAgentTool`

    Tools available to the agent.

    - `Function object { defer_loading, description, name, 2 more }`

      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.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { enabled, type }`

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

    - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

      Tools provided by a remote MCP server without stored credentials.

      - `allowed_tools: array of string or null`

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

      - `connection_origin: "service" or "environment"`

        Where outbound MCP HTTP connections originate.

        - `"service"`

        - `"environment"`

      - `credential_id: string or null`

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

      - `request_metadata: map[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.

      - `transport: PersistedMcpTransport`

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

        - `HTTP object { headers, server_url, type }`

          Connects to an MCP server over HTTP.

          - `headers: map[string]`

            Non-secret HTTP headers sent to the MCP server.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

        - `Stdio object { args, command, cwd, 2 more }`

          Starts an MCP server as a local process.

          - `args: array of string`

            Arguments passed to the MCP server command.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `env_vars: array of string`

            Environment variable names inherited from the execution environment.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

    - `WebSearch object { allowed_domains, context_size, location, 2 more }`

      Web search.

      - `allowed_domains: array of string or null`

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

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: object { city, country, region, timezone }  or null`

        Approximate location used to localize search results, if provided.

        - `city: string or null`

          The city name.

        - `country: string or null`

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

        - `region: string or null`

          The region or state name.

        - `timezone: string or null`

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

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

        The source used for web search results.

        - `"disabled"`

        - `"cached"`

        - `"live"`

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

    - `ComputerUse object { include_screenshots, type }`

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

  - `updated_at: number`

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

### Agent Browser Authentication Cancel Param

- `AgentBrowserAuthenticationCancelParam object { action, type }`

  - `action: "cancel"`

    - `"cancel"`

  - `type: "browser_authentication"`

    - `"browser_authentication"`

### Agent Browser Authentication Submit Param

- `AgentBrowserAuthenticationSubmitParam object { action, fields, type, selected_option }`

  - `action: "submit"`

    - `"submit"`

  - `fields: array of object { field_id, value }`

    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.

    - `field_id: string`

      The field ID from the required action.

    - `value: string`

      The value to enter into the registered control.

  - `type: "browser_authentication"`

    - `"browser_authentication"`

  - `selected_option: optional string or null`

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

### Agent Browser Origin Access Param

- `AgentBrowserOriginAccessParam object { decision, type }`

  - `decision: "approve" or "deny" or "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 object { id, recipient_agent_id, sender_agent_id, 3 more }`

  A request to close a subagent.

  - `id: string`

    The ID of the tool call item.

  - `recipient_agent_id: string`

    The ID of the agent to close.

  - `sender_agent_id: string`

    The ID of the agent requesting the close.

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

  - `type: "close_subagent_call"`

    The item type. Always `close_subagent_call`.

    - `"close_subagent_call"`

      The current public item type.

### Agent Command Execution Item

- `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

  A command execution produced by the agent.

  - `id: string`

    The ID of the command execution item.

  - `command: string`

    The command that was executed.

  - `cwd: string or null`

    The working directory used to execute the command.

  - `duration_ms: number or null`

    The command duration in milliseconds.

  - `exit_code: number or null`

    The process exit code, if the command completed.

  - `output: string or null`

    The command output, if available.

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

  - `type: "command_execution"`

    The item type. Always `command_execution`.

    - `"command_execution"`

### Agent Content

- `AgentContent = OutputText or EncryptedContent { encrypted_content, type }`

  A plaintext or encrypted content part exchanged between agents.

  - `OutputText object { text, type }`

    A text content part produced by the agent.

    - `text: string`

      The text produced by the agent.

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `EncryptedContent object { encrypted_content, type }`

    Encrypted content exchanged between agents.

    - `encrypted_content: string`

      The encrypted content payload.

    - `type: "encrypted_content"`

      The content type. Always `encrypted_content`.

      - `"encrypted_content"`

### Agent Create Subagent Call Item

- `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

  A request to spawn a subagent.

  - `id: string`

    The ID of the tool call item.

  - `agent_id: string`

    The ID of the agent that requested the subagent.

  - `content: array of AgentContent`

    The task given to the spawned agent.

    - `OutputText object { text, type }`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContent object { encrypted_content, type }`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `model: string or null`

    The model requested for the spawned agent.

  - `reasoning_effort: string or null`

    The reasoning effort requested for the spawned agent.

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

  - `type: "create_subagent_call"`

    The item type. Always `create_subagent_call`.

    - `"create_subagent_call"`

      The current public item type.

### Agent Deleted

- `AgentDeleted object { id, deleted, object }`

  A deleted reusable agent.

  - `id: string`

    The ID of the deleted agent.

  - `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 object { id, arguments, call_id, 4 more }`

  A function call produced by the agent.

  - `id: string`

    The ID of the function call item.

  - `arguments: unknown`

    The arguments to pass to the function.

  - `call_id: string`

    The ID used to submit the function result.

  - `name: string`

    The name of the function to call.

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

  - `type: "function_call"`

    The item type. Always `function_call`.

    - `"function_call"`

### Agent Function Call Output

- `AgentFunctionCallOutput = string or array of InputContent`

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

  - `string`

  - `array of InputContent`

    - `InputText object { text, type }`

      Text input recorded in a session item.

      - `text: string`

        The text supplied to the agent.

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputImage object { image_url, type }`

      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.

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

### Agent Function Call Output Param

- `AgentFunctionCallOutputParam = string or array of InputContentParam`

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

  - `string`

  - `array of InputContentParam`

    - `InputText object { text, type }`

      Text input to the model.

      - `text: string`

        The text sent to the model.

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputImage object { image_url, type }`

      Image input to the model.

      - `image_url: string`

        The URL of the image sent to the model.

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

### Agent Function Call Status

- `AgentFunctionCallStatus = "in_progress" or "completed" or "failed" or "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.

### Agent Interrupt Subagent Call Item

- `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

  - `id: string`

    The ID of the tool call item.

  - `recipient_agent_id: string`

    The ID of the agent to interrupt.

  - `sender_agent_id: string`

    The ID of the agent requesting the interrupt.

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

  - `type: "interrupt_subagent_call"`

    The item type. Always `interrupt_subagent_call`.

    - `"interrupt_subagent_call"`

      The current public item type.

### Agent Mcp Call Item

- `AgentMcpCallItem object { id, arguments, error, 6 more }`

  A call to a tool on an MCP server.

  - `id: string`

    The ID of the MCP call item.

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

  - `output: unknown`

    The output returned by the MCP tool, if any.

  - `server_label: string`

    The label of the MCP server.

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

  - `type: "mcp_call"`

    The item type. Always `mcp_call`.

    - `"mcp_call"`

### Agent Output Command Execution Output Delta Event

- `AgentOutputCommandExecutionOutputDeltaEvent object { delta, event_id, item_id, 4 more }`

  Emitted when command execution produces an output delta.

  - `delta: string`

    The output text that was appended.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the command execution item.

  - `output_index: number`

    The index of the item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

### Agent Output Item

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

  An output item produced by an agent.

  - `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

    An assistant message produced by the agent.

    - `id: string`

      The ID of the message.

    - `content: array of OutputText`

      The content of the message.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

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

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

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

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

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

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

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

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

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

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

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

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

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

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

### Agent Output Item Status

- `AgentOutputItemStatus = "in_progress" or "completed" or "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.

### Agent Reasoning

- `AgentReasoning object { effort, summary }`

  The reasoning configuration used by an agent.

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

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

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary: "concise" or "detailed" or "auto" or 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 object { id, status, summary, 2 more }`

  A reasoning item produced by the agent.

  - `id: string`

    The ID of the reasoning item.

  - `status: AgentOutputItemStatus or 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 of SummaryText`

    The reasoning summaries produced by the agent.

    - `text: string`

      The reasoning summary text.

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `turn_id: string`

    The ID of the turn that contains this item.

  - `type: "reasoning"`

    The item type. Always `reasoning`.

    - `"reasoning"`

### Agent Reasoning Param

- `AgentReasoningParam object { effort, summary }`

  Reasoning configuration for the agent.

  - `effort: optional "none" or "minimal" or "low" or 4 more or null`

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

    - `"none"`

    - `"minimal"`

    - `"low"`

    - `"medium"`

    - `"high"`

    - `"xhigh"`

    - `"max"`

  - `summary: optional "concise" or "detailed" or "auto" or 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 object { id, recipient_agent_id, sender_agent_id, 3 more }`

  A request to resume a subagent.

  - `id: string`

    The ID of the tool call item.

  - `recipient_agent_id: string`

    The ID of the agent to resume.

  - `sender_agent_id: string`

    The ID of the agent requesting the resume.

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

  - `type: "resume_subagent_call"`

    The item type. Always `resume_subagent_call`.

    - `"resume_subagent_call"`

      The current public item type.

### Agent Send Subagent Input Call Item

- `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

  A request to send input to another agent.

  - `id: string`

    The ID of the tool call item.

  - `content: array of AgentContent`

    The input sent to the receiving agent.

    - `OutputText object { text, type }`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContent object { encrypted_content, type }`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `recipient_agent_id: string`

    The ID of the agent receiving the input.

  - `sender_agent_id: string`

    The ID of the agent sending the input.

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

  - `type: "send_subagent_input_call"`

    The item type. Always `send_subagent_input_call`.

    - `"send_subagent_input_call"`

      The current public item type.

### Agent Session

- `AgentSession object { id, agent, created_at, 9 more }`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

  - `agent: object { id, instructions, model, 6 more }`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

    - `instructions: string or null`

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

    - `model: string`

      The model used by the agent.

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number or null`

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

    - `name: string or 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.

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

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

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

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

        - `Text object { type }`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `JSONSchema object { schema, type }`

          Constrains generated text to a JSON Schema.

          - `schema: map[unknown]`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

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

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

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: array of AgentTool`

      Tools available to the agent.

      - `Function object { defer_loading, description, name, 2 more }`

        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.

        - `name: string`

          The name of the function.

        - `parameters: map[unknown]`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

      - `ProgrammaticToolCalling object { enabled, type }`

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

      - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

        Tools provided by a remote MCP server.

        - `allowed_tools: array of string or null`

          The MCP tools the agent may call.

        - `connection_origin: "service" or "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string or null`

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

        - `request_metadata: map[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.

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `HTTP object { server_url, type }`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `Stdio object { args, command, cwd, 2 more }`

            Starts an MCP server as a local process.

            - `args: array of string`

              Arguments passed to the MCP server command.

            - `command: string`

              The command used to start the MCP server.

            - `cwd: string`

              The working directory used to start the MCP server.

            - `env_vars: array of string`

              Environment variable names inherited from the execution environment.

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `WebSearch object { allowed_domains, context_size, location, 2 more }`

        Web search.

        - `allowed_domains: array of string or null`

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

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: object { city, country, region, timezone }  or null`

          Approximate location used to localize search results, if provided.

          - `city: string or null`

            The city name.

          - `country: string or null`

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

          - `region: string or null`

            The region or state name.

          - `timezone: string or null`

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

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

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `ComputerUse object { include_screenshots, type }`

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

  - `created_at: number`

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

  - `environment: Environment`

    The execution environment for the session.

    - `None object { type }`

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

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `desktop: object { enabled }`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

      - `files: array of HostedEnvironmentFile`

        Files available in the environment, excluding their contents.

        - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

          A file copied from the OpenAI Files API.

          - `id: string`

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

          - `file_id: string`

            The ID of the uploaded file.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `Inline object { id, path, size_bytes, type }`

          A file supplied inline when the session was created.

          - `id: string`

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

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: object { access, allowed_domains }`

        The effective network access policy for the environment.

        - `access: "enabled" or "disabled" or "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 of string`

          Domains the environment may access when network access is restricted.

      - `packages: object { npm, python, system }`

        Packages installed in the environment.

        - `npm: array of string`

          npm packages installed globally in the environment.

        - `python: array of string`

          Python packages installed in the environment.

        - `system: array of string`

          System packages installed in the environment.

      - `plugins: array of HostedPlugin`

        Plugins installed in the environment, excluding their archive contents.

        - `description: string`

          The installed plugin description.

        - `name: string`

          The installed plugin name.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: array of HostedSkill`

        Skills installed in the environment, excluding their archive contents.

        - `HostedSkillReference object { description, name, skill_id, 2 more }`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `skill_id: string`

            The referenced skill ID.

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

        - `Inline object { description, name, type }`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `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: optional "small" or "medium" or "large" or null`

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

        - `"small"`

        - `"medium"`

        - `"large"`

    - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `remote_url: string`

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

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

  - `error: string or null`

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

  - `last_active_at: number`

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

  - `metadata: map[string]`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

    Actions that must be completed before the session can continue.

    - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

      Respond to a computer-use request.

      - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

        The information needed to render the request.

        - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

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

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

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

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

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

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `BrowserOriginAccess object { origin, reason, type }`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

          - `reason: string or null`

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

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

      - `turn_id: string`

        The turn that requested approval.

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `FunctionCall object { arguments, call_id, name, 2 more }`

      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.

      - `name: string`

        The function name.

      - `turn_id: string`

        The ID of the turn that requested the function call.

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `EnvironmentConnection object { environment_id, type }`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

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

  - `vault_ids: array of string`

    The IDs of vaults made available to the session.

### Agent Session Assistant Message

- `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

  An assistant message produced by the agent.

  - `id: string`

    The ID of the message.

  - `content: array of OutputText`

    The content of the message.

    - `text: string`

      The text produced by the agent.

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `phase: "commentary" or "final_answer" or 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.

  - `type: "message"`

    The item type. Always `message`.

    - `"message"`

### Agent Session Created Event

- `AgentSessionCreatedEvent object { event_id, session, type }`

  Emitted when a session is created.

  - `event_id: string`

    The unique ID of the event.

  - `session: AgentSession`

    The session that was created.

    - `id: string`

      The ID of the session.

    - `agent: object { id, instructions, model, 6 more }`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

      - `instructions: string or null`

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

      - `model: string`

        The model used by the agent.

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number or null`

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

      - `name: string or 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.

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

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

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

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

          - `Text object { type }`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `JSONSchema object { schema, type }`

            Constrains generated text to a JSON Schema.

            - `schema: map[unknown]`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: array of AgentTool`

        Tools available to the agent.

        - `Function object { defer_loading, description, name, 2 more }`

          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.

          - `name: string`

            The name of the function.

          - `parameters: map[unknown]`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

        - `ProgrammaticToolCalling object { enabled, type }`

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

        - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

          Tools provided by a remote MCP server.

          - `allowed_tools: array of string or null`

            The MCP tools the agent may call.

          - `connection_origin: "service" or "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string or null`

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

          - `request_metadata: map[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.

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `HTTP object { server_url, type }`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `Stdio object { args, command, cwd, 2 more }`

              Starts an MCP server as a local process.

              - `args: array of string`

                Arguments passed to the MCP server command.

              - `command: string`

                The command used to start the MCP server.

              - `cwd: string`

                The working directory used to start the MCP server.

              - `env_vars: array of string`

                Environment variable names inherited from the execution environment.

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `WebSearch object { allowed_domains, context_size, location, 2 more }`

          Web search.

          - `allowed_domains: array of string or null`

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

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: object { city, country, region, timezone }  or null`

            Approximate location used to localize search results, if provided.

            - `city: string or null`

              The city name.

            - `country: string or null`

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

            - `region: string or null`

              The region or state name.

            - `timezone: string or null`

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

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

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `ComputerUse object { include_screenshots, type }`

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

    - `created_at: number`

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

    - `environment: Environment`

      The execution environment for the session.

      - `None object { type }`

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

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `desktop: object { enabled }`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `files: array of HostedEnvironmentFile`

          Files available in the environment, excluding their contents.

          - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

            A file copied from the OpenAI Files API.

            - `id: string`

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

            - `file_id: string`

              The ID of the uploaded file.

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `Inline object { id, path, size_bytes, type }`

            A file supplied inline when the session was created.

            - `id: string`

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

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: object { access, allowed_domains }`

          The effective network access policy for the environment.

          - `access: "enabled" or "disabled" or "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 of string`

            Domains the environment may access when network access is restricted.

        - `packages: object { npm, python, system }`

          Packages installed in the environment.

          - `npm: array of string`

            npm packages installed globally in the environment.

          - `python: array of string`

            Python packages installed in the environment.

          - `system: array of string`

            System packages installed in the environment.

        - `plugins: array of HostedPlugin`

          Plugins installed in the environment, excluding their archive contents.

          - `description: string`

            The installed plugin description.

          - `name: string`

            The installed plugin name.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: array of HostedSkill`

          Skills installed in the environment, excluding their archive contents.

          - `HostedSkillReference object { description, name, skill_id, 2 more }`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `skill_id: string`

              The referenced skill ID.

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

          - `Inline object { description, name, type }`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `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: optional "small" or "medium" or "large" or null`

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

          - `"small"`

          - `"medium"`

          - `"large"`

      - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `remote_url: string`

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

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

    - `error: string or null`

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

    - `last_active_at: number`

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

    - `metadata: map[string]`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

      Actions that must be completed before the session can continue.

      - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

        Respond to a computer-use request.

        - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

          The information needed to render the request.

          - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

            A registered form awaiting the application's response.

            - `credential_origin: string or null`

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

            - `fields: array of object { id, label, required, type }`

              Controls to render. All submitted values are sensitive.

              - `id: string`

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

              - `label: string`

                The label to display beside the control.

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

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

            - `options: array of object { id, field_ids, label }`

              Sign-in methods. Empty for a plain form.

              - `id: string`

                The option ID to submit as selected_option.

              - `field_ids: array of string`

                IDs from the registered fields that this method accepts.

              - `label: string`

                The method label to display.

            - `reason: string or null`

              Why the agent needs the user to sign in.

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `BrowserOriginAccess object { origin, reason, type }`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

            - `reason: string or null`

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

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

        - `turn_id: string`

          The turn that requested approval.

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `FunctionCall object { arguments, call_id, name, 2 more }`

        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.

        - `name: string`

          The function name.

        - `turn_id: string`

          The ID of the turn that requested the function call.

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `EnvironmentConnection object { environment_id, type }`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

    - `vault_ids: array of string`

      The IDs of vaults made available to the session.

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

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

    - `"agent.session.created"`

### Agent Session Deleted

- `AgentSessionDeleted object { id, deleted, object }`

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

  - `id: string`

    The ID of the deleted session.

  - `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 object { environment, event_id, session_id, 2 more }`

  Emitted when a session environment connects.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Disconnected Event

- `AgentSessionEnvironmentDisconnectedEvent object { environment, event_id, session_id, 2 more }`

  Emitted when a session environment disconnects.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Expired Event

- `AgentSessionEnvironmentExpiredEvent object { environment, event_id, session_id, 2 more }`

  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.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Failed Event

- `AgentSessionEnvironmentFailedEvent object { environment, event_id, session_id, 2 more }`

  Emitted when a session environment fails.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Pending Event

- `AgentSessionEnvironmentPendingEvent object { environment, event_id, session_id, 2 more }`

  Emitted while a session environment is being prepared.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Ready Event

- `AgentSessionEnvironmentReadyEvent object { environment, event_id, session_id, 2 more }`

  Emitted when a hosted session environment is ready to connect.

  - `environment: AgentSessionEnvironmentState`

    The current environment state.

    - `id: string`

      The public ID of the environment.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Environment Reset Event

- `AgentSessionEnvironmentResetEvent object { environment_id, event_id, reset_count, 3 more }`

  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.

  - `event_id: string`

    The unique ID of the event.

  - `reset_count: number`

    Monotonically increasing reset number. Repeated notifications share this number.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

    The associated turn, when applicable.

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

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

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

### Agent Session Environment State

- `AgentSessionEnvironmentState object { id, error, status, type }`

  The current state of a session environment.

  - `id: string`

    The public ID of the environment.

  - `error: object { code, message, type }  or null`

    The error reported while preparing the environment, if any.

    - `code: string`

      A machine-readable error code.

    - `message: string`

      A human-readable error message.

    - `type: string`

      The error type.

  - `status: "pending" or "ready" or "connected" or 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.

### Agent Session Environment Suspended Event

- `AgentSessionEnvironmentSuspendedEvent object { environment, event_id, session_id, 2 more }`

  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.

    - `error: object { code, message, type }  or null`

      The error reported while preparing the environment, if any.

      - `code: string`

        A machine-readable error code.

      - `message: string`

        A human-readable error message.

      - `type: string`

        The error type.

    - `status: "pending" or "ready" or "connected" or 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.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Error Event

- `AgentSessionErrorEvent object { error, event_id, session_id, type }`

  Emitted when a turn or session fails.

  - `error: SessionError`

    The error that occurred.

    - `code: string or null`

      The machine-readable error code, if any.

    - `message: string`

      A customer-safe explanation of the error.

    - `param: string or null`

      The request parameter associated with the error, if any.

    - `type: string`

      The error type.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `type: "error"`

    The type of the object. Always `error`.

    - `"error"`

### Agent Session Event

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

  An event emitted by a Managed Agents session.

  - `AgentSessionErrorEvent object { error, event_id, session_id, type }`

    Emitted when a turn or session fails.

    - `error: SessionError`

      The error that occurred.

      - `code: string or null`

        The machine-readable error code, if any.

      - `message: string`

        A customer-safe explanation of the error.

      - `param: string or null`

        The request parameter associated with the error, if any.

      - `type: string`

        The error type.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `type: "error"`

      The type of the object. Always `error`.

      - `"error"`

  - `AgentSessionEnvironmentReadyEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a hosted session environment is ready to connect.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

      - `id: string`

        The public ID of the environment.

      - `error: object { code, message, type }  or null`

        The error reported while preparing the environment, if any.

        - `code: string`

          A machine-readable error code.

        - `message: string`

          A human-readable error message.

        - `type: string`

          The error type.

      - `status: "pending" or "ready" or "connected" or 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.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentSuspendedEvent object { environment, event_id, session_id, 2 more }`

    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.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentExpiredEvent object { environment, event_id, session_id, 2 more }`

    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.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentResetEvent object { environment_id, event_id, reset_count, 3 more }`

    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.

    - `event_id: string`

      The unique ID of the event.

    - `reset_count: number`

      Monotonically increasing reset number. Repeated notifications share this number.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The associated turn, when applicable.

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

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

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

  - `AgentOutputCommandExecutionOutputDeltaEvent object { delta, event_id, item_id, 4 more }`

    Emitted when command execution produces an output delta.

    - `delta: string`

      The output text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the command execution item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

  - `AgentSessionCreatedEvent object { event_id, session, type }`

    Emitted when a session is created.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The session that was created.

      - `id: string`

        The ID of the session.

      - `agent: object { id, instructions, model, 6 more }`

        The agent running in the session.

        - `id: string`

          The ID of the agent.

        - `instructions: string or null`

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

        - `model: string`

          The model used by the agent.

        - `multi_agent: MultiAgentConfig`

          Configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number or null`

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

        - `name: string or 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.

        - `reasoning: AgentReasoning`

          The agent's reasoning configuration.

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

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

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

            - `Text object { type }`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `JSONSchema object { schema, type }`

              Constrains generated text to a JSON Schema.

              - `schema: map[unknown]`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: array of AgentTool`

          Tools available to the agent.

          - `Function object { defer_loading, description, name, 2 more }`

            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.

            - `name: string`

              The name of the function.

            - `parameters: map[unknown]`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

          - `ProgrammaticToolCalling object { enabled, type }`

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

          - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

            Tools provided by a remote MCP server.

            - `allowed_tools: array of string or null`

              The MCP tools the agent may call.

            - `connection_origin: "service" or "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string or null`

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

            - `request_metadata: map[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.

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `HTTP object { server_url, type }`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `Stdio object { args, command, cwd, 2 more }`

                Starts an MCP server as a local process.

                - `args: array of string`

                  Arguments passed to the MCP server command.

                - `command: string`

                  The command used to start the MCP server.

                - `cwd: string`

                  The working directory used to start the MCP server.

                - `env_vars: array of string`

                  Environment variable names inherited from the execution environment.

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `WebSearch object { allowed_domains, context_size, location, 2 more }`

            Web search.

            - `allowed_domains: array of string or null`

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

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

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

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: object { city, country, region, timezone }  or null`

              Approximate location used to localize search results, if provided.

              - `city: string or null`

                The city name.

              - `country: string or null`

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

              - `region: string or null`

                The region or state name.

              - `timezone: string or null`

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

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

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `ComputerUse object { include_screenshots, type }`

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

      - `created_at: number`

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

      - `environment: Environment`

        The execution environment for the session.

        - `None object { type }`

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

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

          An environment hosted by OpenAI.

          - `id: string`

            The public ID of the environment.

          - `capability_directories: array of string`

            Directories that contain capabilities exposed to the agent.

          - `desktop: object { enabled }`

            The effective desktop configuration.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

          - `files: array of HostedEnvironmentFile`

            Files available in the environment, excluding their contents.

            - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

              A file copied from the OpenAI Files API.

              - `id: string`

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

              - `file_id: string`

                The ID of the uploaded file.

              - `path: string`

                The file's absolute path inside the environment.

              - `size_bytes: number`

                The decoded file size in bytes.

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `Inline object { id, path, size_bytes, type }`

              A file supplied inline when the session was created.

              - `id: string`

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

              - `path: string`

                The file's absolute path inside the environment.

              - `size_bytes: number`

                The decoded file size in bytes.

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: object { access, allowed_domains }`

            The effective network access policy for the environment.

            - `access: "enabled" or "disabled" or "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 of string`

              Domains the environment may access when network access is restricted.

          - `packages: object { npm, python, system }`

            Packages installed in the environment.

            - `npm: array of string`

              npm packages installed globally in the environment.

            - `python: array of string`

              Python packages installed in the environment.

            - `system: array of string`

              System packages installed in the environment.

          - `plugins: array of HostedPlugin`

            Plugins installed in the environment, excluding their archive contents.

            - `description: string`

              The installed plugin description.

            - `name: string`

              The installed plugin name.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: array of HostedSkill`

            Skills installed in the environment, excluding their archive contents.

            - `HostedSkillReference object { description, name, skill_id, 2 more }`

              A skill installed from the Skills API.

              - `description: string`

                The installed skill description.

              - `name: string`

                The installed skill name.

              - `skill_id: string`

                The referenced skill ID.

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string`

                The concrete skill version installed for this session.

            - `Inline object { description, name, type }`

              A skill installed from an inline ZIP archive.

              - `description: string`

                The installed skill description.

              - `name: string`

                The installed skill name.

              - `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: optional "small" or "medium" or "large" or null`

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

            - `"small"`

            - `"medium"`

            - `"large"`

        - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

          An environment hosted by the application.

          - `id: string`

            The public ID of the environment.

          - `capability_directories: array of string`

            Directories that contain capabilities exposed to the agent.

          - `remote_url: string`

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

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

      - `error: string or null`

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

      - `last_active_at: number`

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

      - `metadata: map[string]`

        Custom string key-value pairs attached to the session.

      - `object: "agent.session"`

        The object type. Always `agent.session`.

        - `"agent.session"`

      - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

        Actions that must be completed before the session can continue.

        - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

          Respond to a computer-use request.

          - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

            The information needed to render the request.

            - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

              A registered form awaiting the application's response.

              - `credential_origin: string or null`

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

              - `fields: array of object { id, label, required, type }`

                Controls to render. All submitted values are sensitive.

                - `id: string`

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

                - `label: string`

                  The label to display beside the control.

                - `required: boolean`

                  Whether this control requires a nonempty value.

                - `type: string`

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

              - `options: array of object { id, field_ids, label }`

                Sign-in methods. Empty for a plain form.

                - `id: string`

                  The option ID to submit as selected_option.

                - `field_ids: array of string`

                  IDs from the registered fields that this method accepts.

                - `label: string`

                  The method label to display.

              - `reason: string or null`

                Why the agent needs the user to sign in.

              - `type: "browser_authentication"`

                The type of the object. Always `browser_authentication`.

                - `"browser_authentication"`

            - `BrowserOriginAccess object { origin, reason, type }`

              A browser origin awaiting the application's approval decision.

              - `origin: string`

                The origin the browser needs permission to access.

              - `reason: string or null`

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

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

          - `turn_id: string`

            The turn that requested approval.

          - `type: "computer_use_approval_request"`

            The type of the object. Always `computer_use_approval_request`.

            - `"computer_use_approval_request"`

        - `FunctionCall object { arguments, call_id, name, 2 more }`

          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.

          - `name: string`

            The function name.

          - `turn_id: string`

            The ID of the turn that requested the function call.

          - `type: "function_call"`

            The type of the object. Always `function_call`.

            - `"function_call"`

        - `EnvironmentConnection object { environment_id, type }`

          Reconnect a session environment.

          - `environment_id: string`

            The ID of the environment to reconnect.

          - `type: "environment_connection"`

            The type of the object. Always `environment_connection`.

            - `"environment_connection"`

      - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

        - `input_tokens_details: object { cached_tokens }`

          A breakdown of the agent's input token usage.

          - `cached_tokens: number`

            The number of input tokens retrieved from the prompt cache.

        - `output_tokens: number`

          The number of output tokens generated by the agent.

        - `output_tokens_details: object { reasoning_tokens }`

          A breakdown of the agent's output token usage.

          - `reasoning_tokens: number`

            The number of output tokens used for reasoning.

        - `total_tokens: number`

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

      - `vault_ids: array of string`

        The IDs of vaults made available to the session.

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

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

      - `"agent.session.created"`

  - `AgentSessionTurnCreatedEvent object { event_id, session_id, turn, 2 more }`

    Emitted when a turn is created.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The turn at the time it was created.

      - `id: string`

        The ID of the turn.

      - `agent_id: string`

        The ID of the agent that ran the turn.

      - `completed_at: number or null`

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

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

      - `error: SessionTurnError or null`

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

        - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

          A stable, machine-readable failure category.

          - `"context_length_exceeded"`

            The request exceeds the model's context window.

          - `"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.

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

      - `started_at: number or null`

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

      - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

      - `usage: TokenUsage or null`

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

    - `turn_id: string`

      The ID of the turn associated with the event.

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

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

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

  - `AgentSessionTurnInProgressEvent object { event_id, session_id, turn, 2 more }`

    Emitted when a turn starts running.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The turn at the time it started running.

    - `turn_id: string`

      The ID of the turn associated with the event.

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

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

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

  - `AgentSessionTurnCompletedEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn completes.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The completed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

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

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

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

    - `usage: TokenUsage or null`

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

  - `AgentSessionTurnFailedEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn fails.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The failed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

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

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

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

    - `usage: TokenUsage or null`

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

  - `AgentSessionTurnCancelledEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn is cancelled.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The cancelled turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

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

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

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

    - `usage: TokenUsage or null`

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

  - `AgentSessionTurnItemAddedEvent object { event_id, item, output_index, 3 more }`

    Emitted when an item is added to a turn.

    - `event_id: string`

      The unique ID of the event.

    - `item: AgentSessionItem`

      The item that was added.

      - `AgentSessionMessage object { id, content, phase, 4 more }`

        A user or assistant message recorded in a session.

        - `id: string or null`

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

        - `content: array of AgentSessionMessageContent`

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

          - `InputText object { text, type }`

            Text supplied by the user.

            - `text: string`

              The text supplied by the user.

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputImage object { image_url, type }`

            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.

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

          - `OutputText object { text, type }`

            Text produced by the assistant.

            - `text: string`

              The text produced by the assistant.

            - `type: "output_text"`

              The type of the object. Always `output_text`.

              - `"output_text"`

        - `phase: "commentary" or "final_answer" or 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" or "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.

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem object { id, status, summary, 2 more }`

        A reasoning item produced by the agent.

        - `id: string`

          The ID of the reasoning item.

        - `status: AgentOutputItemStatus or null`

          The status of the reasoning item.

        - `summary: array of SummaryText`

          The reasoning summaries produced by the agent.

          - `text: string`

            The reasoning summary text.

          - `type: "summary_text"`

            The content type. Always `summary_text`.

            - `"summary_text"`

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "reasoning"`

          The item type. Always `reasoning`.

          - `"reasoning"`

      - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

        A function call produced by the agent.

        - `id: string`

          The ID of the function call item.

        - `arguments: unknown`

          The arguments to pass to the function.

        - `call_id: string`

          The ID used to submit the function result.

        - `name: string`

          The name of the function to call.

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

        - `type: "function_call"`

          The item type. Always `function_call`.

          - `"function_call"`

      - `FunctionCallOutput object { id, call_id, error, 4 more }`

        The result supplied for a function call.

        - `id: string`

          The ID of the function call output item.

        - `call_id: string`

          The ID of the function call that produced this output.

        - `error: string or null`

          The error message, if the call failed.

        - `output: AgentFunctionCallOutput or null`

          The function result, if the call succeeded.

          - `string`

          - `array of InputContent`

            - `InputText object { text, type }`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputImage object { image_url, type }`

              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.

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

        - `type: "function_call_output"`

          The item type. Always `function_call_output`.

          - `"function_call_output"`

      - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

        A message exchanged between agent threads.

        - `id: string`

          The ID of the message.

        - `content: array of AgentContent`

          The content exchanged between the agents.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

            - `text: string`

              The text produced by the agent.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

            - `encrypted_content: string`

              The encrypted content payload.

            - `type: "encrypted_content"`

              The content type. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient_agent_id: string`

          The ID or name of the receiving agent.

        - `sender_agent_id: string`

          The ID or name of the sending agent.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

      - `AgentMcpCallItem object { id, arguments, error, 6 more }`

        A call to a tool on an MCP server.

        - `id: string`

          The ID of the MCP call item.

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

        - `output: unknown`

          The output returned by the MCP tool, if any.

        - `server_label: string`

          The label of the MCP server.

        - `status: AgentFunctionCallStatus`

          The status of the MCP tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "mcp_call"`

          The item type. Always `mcp_call`.

          - `"mcp_call"`

      - `ComputerUseCall object { id, output, status, 3 more }`

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

        - `id: string`

          The ID of the activity item.

        - `output: object { image_url, type }  or 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.

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string or null`

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

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

        - `id: string`

          The stable history item ID.

        - `request: object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

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

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

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

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

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

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

        - `turn_id: string`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

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

        - `id: string`

          The stable history item ID.

        - `request_id: string`

          The registered request answered by this item.

        - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

          The admitted response, without submitted credential values.

          - `Submit object { action, selected_option, type }`

            - `action: "submit"`

              - `"submit"`

            - `selected_option: string or null`

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

            - `type: "browser_authentication"`

              - `"browser_authentication"`

          - `Cancel object { action, type }`

            - `action: "cancel"`

              - `"cancel"`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_approval_request_result"`

          - `"computer_use_approval_request_result"`

      - `AgentWebSearchCallItem object { id, action, status, 2 more }`

        A web search call produced by the agent.

        - `id: string`

          The ID of the web search call.

        - `action: WebSearchAction or null`

          The action performed by the web search tool.

          - `Search object { queries, query, type }`

            A search query or group of search queries.

            - `queries: array of string or null`

              The search queries, when multiple queries were used.

            - `query: string or null`

              The search query, when a single query was used.

            - `type: "search"`

              The type of the object. Always `search`.

              - `"search"`

          - `OpenPage object { type, url }`

            Opens a web page.

            - `type: "open_page"`

              The type of the object. Always `open_page`.

              - `"open_page"`

            - `url: string or null`

              The URL of the page that was opened.

          - `FindInPage object { pattern, type, url }`

            Finds text within a web page.

            - `pattern: string or null`

              The text pattern that was searched for.

            - `type: "find_in_page"`

              The type of the object. Always `find_in_page`.

              - `"find_in_page"`

            - `url: string or null`

              The URL of the page that was searched.

          - `Other object { type }`

            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.

        - `type: "web_search_call"`

          The item type. Always `web_search_call`.

          - `"web_search_call"`

      - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

        A command execution produced by the agent.

        - `id: string`

          The ID of the command execution item.

        - `command: string`

          The command that was executed.

        - `cwd: string or null`

          The working directory used to execute the command.

        - `duration_ms: number or null`

          The command duration in milliseconds.

        - `exit_code: number or null`

          The process exit code, if the command completed.

        - `output: string or null`

          The command output, if available.

        - `status: AgentFunctionCallStatus`

          The status of the command execution.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "command_execution"`

          The item type. Always `command_execution`.

          - `"command_execution"`

      - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

        A request to spawn a subagent.

        - `id: string`

          The ID of the tool call item.

        - `agent_id: string`

          The ID of the agent that requested the subagent.

        - `content: array of AgentContent`

          The task given to the spawned agent.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

        - `model: string or null`

          The model requested for the spawned agent.

        - `reasoning_effort: string or null`

          The reasoning effort requested for the spawned agent.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "create_subagent_call"`

          The item type. Always `create_subagent_call`.

          - `"create_subagent_call"`

            The current public item type.

      - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

        A request to send input to another agent.

        - `id: string`

          The ID of the tool call item.

        - `content: array of AgentContent`

          The input sent to the receiving agent.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

        - `recipient_agent_id: string`

          The ID of the agent receiving the input.

        - `sender_agent_id: string`

          The ID of the agent sending the input.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "send_subagent_input_call"`

          The item type. Always `send_subagent_input_call`.

          - `"send_subagent_input_call"`

            The current public item type.

      - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to resume a subagent.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to resume.

        - `sender_agent_id: string`

          The ID of the agent requesting the resume.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "resume_subagent_call"`

          The item type. Always `resume_subagent_call`.

          - `"resume_subagent_call"`

            The current public item type.

      - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

        A request to wait for one or more subagents.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_ids: array of string`

          The IDs of the agents to wait for.

        - `sender_agent_id: string`

          The ID of the agent waiting for results.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "wait_for_subagents_call"`

          The item type. Always `wait_for_subagents_call`.

          - `"wait_for_subagents_call"`

            The current public item type.

      - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to interrupt.

        - `sender_agent_id: string`

          The ID of the agent requesting the interrupt.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "interrupt_subagent_call"`

          The item type. Always `interrupt_subagent_call`.

          - `"interrupt_subagent_call"`

            The current public item type.

      - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to close a subagent.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to close.

        - `sender_agent_id: string`

          The ID of the agent requesting the close.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "close_subagent_call"`

          The item type. Always `close_subagent_call`.

          - `"close_subagent_call"`

            The current public item type.

    - `output_index: number or null`

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

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionIdleEvent object { event_id, session, type }`

    Emitted when a session becomes idle.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The session that became idle.

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

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

      - `"agent.session.idle"`

  - `AgentSessionInProgressEvent object { event_id, session, type }`

    Emitted when a session starts processing a turn.

    - `event_id: string`

      The unique ID of the event.

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

  - `AgentSessionRequiresActionEvent object { event_id, session, type }`

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

    - `event_id: string`

      The unique ID of the event.

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

  - `AgentSessionFailedEvent object { event_id, session, type }`

    Emitted when a session fails.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The failed session.

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

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

      - `"agent.session.failed"`

  - `AgentSessionEnvironmentPendingEvent object { environment, event_id, session_id, 2 more }`

    Emitted while a session environment is being prepared.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentConnectedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment connects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentDisconnectedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment disconnects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionEnvironmentFailedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment fails.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionSubagentCreatedEvent object { event_id, subagent, type }`

    Emitted when a subagent is created.

    - `event_id: string`

      The unique ID of the event.

    - `subagent: Subagent`

      The subagent that was created.

      - `id: string`

        The ID of the subagent.

      - `closed_at: number or null`

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

      - `instructions: array of AgentContent or null`

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

        - `OutputText object { text, type }`

          A text content part produced by the agent.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

      - `name: string or null`

        The runner-assigned nickname, or null when unavailable.

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

      - `parent_agent_id: string`

        The ID of the agent that created this subagent.

      - `session_id: string`

        The ID of the session that owns the subagent.

      - `status: "active" or "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"`

  - `AgentSessionSubagentActiveEvent object { event_id, subagent, type }`

    Emitted when a closed subagent successfully resumes.

    - `event_id: string`

      The unique ID of the event.

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

  - `AgentSessionSubagentClosedEvent object { event_id, subagent, type }`

    Emitted when a subagent is closed.

    - `event_id: string`

      The unique ID of the event.

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

  - `AgentSessionTurnItemDoneEvent object { event_id, item, output_index, 3 more }`

    Emitted when an output item is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item: AgentOutputItem`

      The completed output item.

      - `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

        An assistant message produced by the agent.

        - `id: string`

          The ID of the message.

        - `content: array of OutputText`

          The content of the message.

          - `text: string`

            The text produced by the agent.

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `phase: "commentary" or "final_answer" or 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.

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem object { id, status, summary, 2 more }`

        A reasoning item produced by the agent.

      - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

        A function call produced by the agent.

      - `AgentMcpCallItem object { id, arguments, error, 6 more }`

        A call to a tool on an MCP server.

      - `ComputerUseCall object { id, output, status, 3 more }`

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

        - `id: string`

          The ID of the activity item.

        - `output: object { image_url, type }  or 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.

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string or null`

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

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

        - `id: string`

          The stable history item ID.

        - `request: object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

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

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

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

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

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

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

        - `turn_id: string`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `AgentWebSearchCallItem object { id, action, status, 2 more }`

        A web search call produced by the agent.

      - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

        A command execution produced by the agent.

      - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

        A request to spawn a subagent.

      - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

        A request to send input to another agent.

      - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to resume a subagent.

      - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

        A request to wait for one or more subagents.

      - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

      - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to close a subagent.

    - `output_index: number`

      The index of the output item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

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

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

  - `AgentSessionTurnContentPartAddedEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output text content part is added.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: OutputText`

      The initial content part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnContentPartDoneEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output content part is complete.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: OutputText`

      The completed content part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnOutputTextDeltaEvent object { content_index, delta, event_id, 5 more }`

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

    - `content_index: number`

      The index of the content part in the message.

    - `delta: string`

      The text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnOutputTextDoneEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output text content part is complete.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `text: string`

      The complete output text.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnReasoningSummaryPartAddedEvent object { event_id, item_id, output_index, 5 more }`

    Emitted when a reasoning summary content part is added.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: SummaryText`

      The initial summary part.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnReasoningSummaryPartDoneEvent object { event_id, item_id, output_index, 6 more }`

    Emitted when a reasoning summary part is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: SummaryText`

      The completed summary part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `status: "incomplete" or null`

      Present as `incomplete` when summary generation was interrupted.

      - `"incomplete"`

    - `summary_index: number`

      The index of the summary part.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnReasoningSummaryTextDeltaEvent object { delta, event_id, item_id, 5 more }`

    Emitted when text is appended to a reasoning summary.

    - `delta: string`

      The summary text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `turn_id: string or null`

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

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

  - `AgentSessionTurnReasoningSummaryTextDoneEvent object { event_id, item_id, output_index, 5 more }`

    Emitted when a reasoning summary content part is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `text: string`

      The complete reasoning summary text.

    - `turn_id: string or null`

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

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

### Agent Session Failed Event

- `AgentSessionFailedEvent object { event_id, session, type }`

  Emitted when a session fails.

  - `event_id: string`

    The unique ID of the event.

  - `session: AgentSession`

    The failed session.

    - `id: string`

      The ID of the session.

    - `agent: object { id, instructions, model, 6 more }`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

      - `instructions: string or null`

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

      - `model: string`

        The model used by the agent.

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number or null`

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

      - `name: string or 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.

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

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

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

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

          - `Text object { type }`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `JSONSchema object { schema, type }`

            Constrains generated text to a JSON Schema.

            - `schema: map[unknown]`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: array of AgentTool`

        Tools available to the agent.

        - `Function object { defer_loading, description, name, 2 more }`

          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.

          - `name: string`

            The name of the function.

          - `parameters: map[unknown]`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

        - `ProgrammaticToolCalling object { enabled, type }`

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

        - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

          Tools provided by a remote MCP server.

          - `allowed_tools: array of string or null`

            The MCP tools the agent may call.

          - `connection_origin: "service" or "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string or null`

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

          - `request_metadata: map[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.

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `HTTP object { server_url, type }`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `Stdio object { args, command, cwd, 2 more }`

              Starts an MCP server as a local process.

              - `args: array of string`

                Arguments passed to the MCP server command.

              - `command: string`

                The command used to start the MCP server.

              - `cwd: string`

                The working directory used to start the MCP server.

              - `env_vars: array of string`

                Environment variable names inherited from the execution environment.

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `WebSearch object { allowed_domains, context_size, location, 2 more }`

          Web search.

          - `allowed_domains: array of string or null`

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

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: object { city, country, region, timezone }  or null`

            Approximate location used to localize search results, if provided.

            - `city: string or null`

              The city name.

            - `country: string or null`

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

            - `region: string or null`

              The region or state name.

            - `timezone: string or null`

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

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

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `ComputerUse object { include_screenshots, type }`

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

    - `created_at: number`

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

    - `environment: Environment`

      The execution environment for the session.

      - `None object { type }`

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

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `desktop: object { enabled }`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `files: array of HostedEnvironmentFile`

          Files available in the environment, excluding their contents.

          - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

            A file copied from the OpenAI Files API.

            - `id: string`

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

            - `file_id: string`

              The ID of the uploaded file.

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `Inline object { id, path, size_bytes, type }`

            A file supplied inline when the session was created.

            - `id: string`

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

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: object { access, allowed_domains }`

          The effective network access policy for the environment.

          - `access: "enabled" or "disabled" or "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 of string`

            Domains the environment may access when network access is restricted.

        - `packages: object { npm, python, system }`

          Packages installed in the environment.

          - `npm: array of string`

            npm packages installed globally in the environment.

          - `python: array of string`

            Python packages installed in the environment.

          - `system: array of string`

            System packages installed in the environment.

        - `plugins: array of HostedPlugin`

          Plugins installed in the environment, excluding their archive contents.

          - `description: string`

            The installed plugin description.

          - `name: string`

            The installed plugin name.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: array of HostedSkill`

          Skills installed in the environment, excluding their archive contents.

          - `HostedSkillReference object { description, name, skill_id, 2 more }`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `skill_id: string`

              The referenced skill ID.

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

          - `Inline object { description, name, type }`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `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: optional "small" or "medium" or "large" or null`

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

          - `"small"`

          - `"medium"`

          - `"large"`

      - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `remote_url: string`

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

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

    - `error: string or null`

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

    - `last_active_at: number`

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

    - `metadata: map[string]`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

      Actions that must be completed before the session can continue.

      - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

        Respond to a computer-use request.

        - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

          The information needed to render the request.

          - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

            A registered form awaiting the application's response.

            - `credential_origin: string or null`

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

            - `fields: array of object { id, label, required, type }`

              Controls to render. All submitted values are sensitive.

              - `id: string`

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

              - `label: string`

                The label to display beside the control.

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

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

            - `options: array of object { id, field_ids, label }`

              Sign-in methods. Empty for a plain form.

              - `id: string`

                The option ID to submit as selected_option.

              - `field_ids: array of string`

                IDs from the registered fields that this method accepts.

              - `label: string`

                The method label to display.

            - `reason: string or null`

              Why the agent needs the user to sign in.

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `BrowserOriginAccess object { origin, reason, type }`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

            - `reason: string or null`

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

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

        - `turn_id: string`

          The turn that requested approval.

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `FunctionCall object { arguments, call_id, name, 2 more }`

        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.

        - `name: string`

          The function name.

        - `turn_id: string`

          The ID of the turn that requested the function call.

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `EnvironmentConnection object { environment_id, type }`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

    - `vault_ids: array of string`

      The IDs of vaults made available to the session.

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

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

    - `"agent.session.failed"`

### Agent Session Idle Event

- `AgentSessionIdleEvent object { event_id, session, type }`

  Emitted when a session becomes idle.

  - `event_id: string`

    The unique ID of the event.

  - `session: AgentSession`

    The session that became idle.

    - `id: string`

      The ID of the session.

    - `agent: object { id, instructions, model, 6 more }`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

      - `instructions: string or null`

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

      - `model: string`

        The model used by the agent.

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number or null`

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

      - `name: string or 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.

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

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

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

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

          - `Text object { type }`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `JSONSchema object { schema, type }`

            Constrains generated text to a JSON Schema.

            - `schema: map[unknown]`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: array of AgentTool`

        Tools available to the agent.

        - `Function object { defer_loading, description, name, 2 more }`

          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.

          - `name: string`

            The name of the function.

          - `parameters: map[unknown]`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

        - `ProgrammaticToolCalling object { enabled, type }`

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

        - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

          Tools provided by a remote MCP server.

          - `allowed_tools: array of string or null`

            The MCP tools the agent may call.

          - `connection_origin: "service" or "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string or null`

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

          - `request_metadata: map[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.

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `HTTP object { server_url, type }`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `Stdio object { args, command, cwd, 2 more }`

              Starts an MCP server as a local process.

              - `args: array of string`

                Arguments passed to the MCP server command.

              - `command: string`

                The command used to start the MCP server.

              - `cwd: string`

                The working directory used to start the MCP server.

              - `env_vars: array of string`

                Environment variable names inherited from the execution environment.

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `WebSearch object { allowed_domains, context_size, location, 2 more }`

          Web search.

          - `allowed_domains: array of string or null`

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

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: object { city, country, region, timezone }  or null`

            Approximate location used to localize search results, if provided.

            - `city: string or null`

              The city name.

            - `country: string or null`

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

            - `region: string or null`

              The region or state name.

            - `timezone: string or null`

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

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

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `ComputerUse object { include_screenshots, type }`

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

    - `created_at: number`

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

    - `environment: Environment`

      The execution environment for the session.

      - `None object { type }`

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

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `desktop: object { enabled }`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `files: array of HostedEnvironmentFile`

          Files available in the environment, excluding their contents.

          - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

            A file copied from the OpenAI Files API.

            - `id: string`

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

            - `file_id: string`

              The ID of the uploaded file.

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `Inline object { id, path, size_bytes, type }`

            A file supplied inline when the session was created.

            - `id: string`

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

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: object { access, allowed_domains }`

          The effective network access policy for the environment.

          - `access: "enabled" or "disabled" or "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 of string`

            Domains the environment may access when network access is restricted.

        - `packages: object { npm, python, system }`

          Packages installed in the environment.

          - `npm: array of string`

            npm packages installed globally in the environment.

          - `python: array of string`

            Python packages installed in the environment.

          - `system: array of string`

            System packages installed in the environment.

        - `plugins: array of HostedPlugin`

          Plugins installed in the environment, excluding their archive contents.

          - `description: string`

            The installed plugin description.

          - `name: string`

            The installed plugin name.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: array of HostedSkill`

          Skills installed in the environment, excluding their archive contents.

          - `HostedSkillReference object { description, name, skill_id, 2 more }`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `skill_id: string`

              The referenced skill ID.

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

          - `Inline object { description, name, type }`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `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: optional "small" or "medium" or "large" or null`

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

          - `"small"`

          - `"medium"`

          - `"large"`

      - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `remote_url: string`

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

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

    - `error: string or null`

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

    - `last_active_at: number`

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

    - `metadata: map[string]`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

      Actions that must be completed before the session can continue.

      - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

        Respond to a computer-use request.

        - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

          The information needed to render the request.

          - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

            A registered form awaiting the application's response.

            - `credential_origin: string or null`

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

            - `fields: array of object { id, label, required, type }`

              Controls to render. All submitted values are sensitive.

              - `id: string`

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

              - `label: string`

                The label to display beside the control.

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

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

            - `options: array of object { id, field_ids, label }`

              Sign-in methods. Empty for a plain form.

              - `id: string`

                The option ID to submit as selected_option.

              - `field_ids: array of string`

                IDs from the registered fields that this method accepts.

              - `label: string`

                The method label to display.

            - `reason: string or null`

              Why the agent needs the user to sign in.

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `BrowserOriginAccess object { origin, reason, type }`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

            - `reason: string or null`

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

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

        - `turn_id: string`

          The turn that requested approval.

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `FunctionCall object { arguments, call_id, name, 2 more }`

        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.

        - `name: string`

          The function name.

        - `turn_id: string`

          The ID of the turn that requested the function call.

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `EnvironmentConnection object { environment_id, type }`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

    - `vault_ids: array of string`

      The IDs of vaults made available to the session.

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

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

    - `"agent.session.idle"`

### Agent Session In Progress Event

- `AgentSessionInProgressEvent object { event_id, session, type }`

  Emitted when a session starts processing a turn.

  - `event_id: string`

    The unique ID of the event.

  - `session: AgentSession`

    The session that started processing.

    - `id: string`

      The ID of the session.

    - `agent: object { id, instructions, model, 6 more }`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

      - `instructions: string or null`

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

      - `model: string`

        The model used by the agent.

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number or null`

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

      - `name: string or 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.

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

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

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

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

          - `Text object { type }`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `JSONSchema object { schema, type }`

            Constrains generated text to a JSON Schema.

            - `schema: map[unknown]`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: array of AgentTool`

        Tools available to the agent.

        - `Function object { defer_loading, description, name, 2 more }`

          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.

          - `name: string`

            The name of the function.

          - `parameters: map[unknown]`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

        - `ProgrammaticToolCalling object { enabled, type }`

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

        - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

          Tools provided by a remote MCP server.

          - `allowed_tools: array of string or null`

            The MCP tools the agent may call.

          - `connection_origin: "service" or "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string or null`

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

          - `request_metadata: map[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.

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `HTTP object { server_url, type }`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `Stdio object { args, command, cwd, 2 more }`

              Starts an MCP server as a local process.

              - `args: array of string`

                Arguments passed to the MCP server command.

              - `command: string`

                The command used to start the MCP server.

              - `cwd: string`

                The working directory used to start the MCP server.

              - `env_vars: array of string`

                Environment variable names inherited from the execution environment.

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `WebSearch object { allowed_domains, context_size, location, 2 more }`

          Web search.

          - `allowed_domains: array of string or null`

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

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: object { city, country, region, timezone }  or null`

            Approximate location used to localize search results, if provided.

            - `city: string or null`

              The city name.

            - `country: string or null`

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

            - `region: string or null`

              The region or state name.

            - `timezone: string or null`

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

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

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `ComputerUse object { include_screenshots, type }`

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

    - `created_at: number`

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

    - `environment: Environment`

      The execution environment for the session.

      - `None object { type }`

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

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `desktop: object { enabled }`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `files: array of HostedEnvironmentFile`

          Files available in the environment, excluding their contents.

          - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

            A file copied from the OpenAI Files API.

            - `id: string`

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

            - `file_id: string`

              The ID of the uploaded file.

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `Inline object { id, path, size_bytes, type }`

            A file supplied inline when the session was created.

            - `id: string`

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

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: object { access, allowed_domains }`

          The effective network access policy for the environment.

          - `access: "enabled" or "disabled" or "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 of string`

            Domains the environment may access when network access is restricted.

        - `packages: object { npm, python, system }`

          Packages installed in the environment.

          - `npm: array of string`

            npm packages installed globally in the environment.

          - `python: array of string`

            Python packages installed in the environment.

          - `system: array of string`

            System packages installed in the environment.

        - `plugins: array of HostedPlugin`

          Plugins installed in the environment, excluding their archive contents.

          - `description: string`

            The installed plugin description.

          - `name: string`

            The installed plugin name.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: array of HostedSkill`

          Skills installed in the environment, excluding their archive contents.

          - `HostedSkillReference object { description, name, skill_id, 2 more }`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `skill_id: string`

              The referenced skill ID.

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

          - `Inline object { description, name, type }`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `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: optional "small" or "medium" or "large" or null`

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

          - `"small"`

          - `"medium"`

          - `"large"`

      - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `remote_url: string`

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

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

    - `error: string or null`

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

    - `last_active_at: number`

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

    - `metadata: map[string]`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

      Actions that must be completed before the session can continue.

      - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

        Respond to a computer-use request.

        - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

          The information needed to render the request.

          - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

            A registered form awaiting the application's response.

            - `credential_origin: string or null`

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

            - `fields: array of object { id, label, required, type }`

              Controls to render. All submitted values are sensitive.

              - `id: string`

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

              - `label: string`

                The label to display beside the control.

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

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

            - `options: array of object { id, field_ids, label }`

              Sign-in methods. Empty for a plain form.

              - `id: string`

                The option ID to submit as selected_option.

              - `field_ids: array of string`

                IDs from the registered fields that this method accepts.

              - `label: string`

                The method label to display.

            - `reason: string or null`

              Why the agent needs the user to sign in.

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `BrowserOriginAccess object { origin, reason, type }`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

            - `reason: string or null`

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

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

        - `turn_id: string`

          The turn that requested approval.

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `FunctionCall object { arguments, call_id, name, 2 more }`

        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.

        - `name: string`

          The function name.

        - `turn_id: string`

          The ID of the turn that requested the function call.

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `EnvironmentConnection object { environment_id, type }`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

    - `vault_ids: array of string`

      The IDs of vaults made available to the session.

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

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

    - `"agent.session.in_progress"`

### Agent Session Input Message Param

- `AgentSessionInputMessageParam object { content, role, type }`

  A user message submitted to a session.

  - `content: array of InputContentParam`

    The content of the message.

    - `InputText object { text, type }`

      Text input to the model.

      - `text: string`

        The text sent to the model.

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputImage object { image_url, type }`

      Image input to the model.

      - `image_url: string`

        The URL of the image sent to the model.

      - `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: optional "message"`

    The type of the input item. Always `message`.

    - `"message"`

### Agent Session Input Param

- `AgentSessionInputParam = AgentSessionInputComputerUseApprovalRequestResult { request_id, response, type }  or AgentSessionInputMessage { input, type }  or AgentSessionInputCancel { type }  or AgentSessionInputToolResult { call_id, success, turn_id, 3 more }`

  Input submitted to an existing session.

  - `AgentSessionInputComputerUseApprovalRequestResult object { request_id, response, type }`

    Responds to a pending Computer Use approval request.

    - `request_id: string`

      The registered request ID from the required action.

    - `response: AgentBrowserAuthenticationSubmitParam or AgentBrowserAuthenticationCancelParam or AgentBrowserOriginAccessParam`

      The response for this request type.

      - `AgentBrowserAuthenticationSubmitParam object { action, fields, type, selected_option }`

        - `action: "submit"`

          - `"submit"`

        - `fields: array of object { field_id, value }`

          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.

          - `field_id: string`

            The field ID from the required action.

          - `value: string`

            The value to enter into the registered control.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

        - `selected_option: optional string or null`

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

      - `AgentBrowserAuthenticationCancelParam object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `AgentBrowserOriginAccessParam object { decision, type }`

        - `decision: "approve" or "deny" or "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"`

  - `AgentSessionInputMessage object { input, type }`

    Adds one or more user messages and starts a turn.

    - `input: array of AgentSessionInputMessageParam`

      The user messages to add to the session.

      - `content: array of InputContentParam`

        The content of the message.

        - `InputText object { text, type }`

          Text input to the model.

          - `text: string`

            The text sent to the model.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          Image input to the model.

          - `image_url: string`

            The URL of the image sent to the model.

          - `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: optional "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"`

  - `AgentSessionInputCancel object { type }`

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

  - `AgentSessionInputToolResult object { call_id, success, turn_id, 3 more }`

    Submits the result of a function call.

    - `call_id: string`

      The ID of the function call.

    - `success: boolean`

      Whether the function call succeeded.

    - `turn_id: string`

      The ID of the turn that requested the function call.

    - `type: "agent.session.input.tool_result"`

      The type of the object. Always `agent.session.input.tool_result`.

      - `"agent.session.input.tool_result"`

    - `error: optional string or null`

      The error message when the call failed.

    - `output: optional AgentFunctionCallOutputParam or null`

      The function result when the call succeeded.

      - `string`

      - `array of InputContentParam`

        - `InputText object { text, type }`

          Text input to the model.

        - `InputImage object { image_url, type }`

          Image input to the model.

### Agent Session Item

- `AgentSessionItem = AgentSessionMessage or AgentReasoningItem or AgentFunctionCallItem or 14 more`

  An item associated with a session turn.

  - `AgentSessionMessage object { id, content, phase, 4 more }`

    A user or assistant message recorded in a session.

    - `id: string or null`

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

    - `content: array of AgentSessionMessageContent`

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

      - `InputText object { text, type }`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        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.

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `OutputText object { text, type }`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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" or "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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

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

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutput object { id, call_id, error, 4 more }`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

    - `call_id: string`

      The ID of the function call that produced this output.

    - `error: string or null`

      The error message, if the call failed.

    - `output: AgentFunctionCallOutput or null`

      The function result, if the call succeeded.

      - `string`

      - `array of InputContent`

        - `InputText object { text, type }`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

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

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

    - `content: array of AgentContent`

      The content exchanged between the agents.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

    - `sender_agent_id: string`

      The ID or name of the sending agent.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

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

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

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

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

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

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

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

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

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

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

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

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

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

    - `id: string`

      The stable history item ID.

    - `request_id: string`

      The registered request answered by this item.

    - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

      The admitted response, without submitted credential values.

      - `Submit object { action, selected_option, type }`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string or null`

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

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `Cancel object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

### Agent Session Message

- `AgentSessionMessage object { id, content, phase, 4 more }`

  A user or assistant message recorded in a session.

  - `id: string or null`

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

  - `content: array of AgentSessionMessageContent`

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

    - `InputText object { text, type }`

      Text supplied by the user.

      - `text: string`

        The text supplied by the user.

      - `type: "input_text"`

        The type of the object. Always `input_text`.

        - `"input_text"`

    - `InputImage object { image_url, type }`

      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.

      - `type: "input_image"`

        The type of the object. Always `input_image`.

        - `"input_image"`

    - `OutputText object { text, type }`

      Text produced by the assistant.

      - `text: string`

        The text produced by the assistant.

      - `type: "output_text"`

        The type of the object. Always `output_text`.

        - `"output_text"`

  - `phase: "commentary" or "final_answer" or 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" or "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.

  - `type: "message"`

    The item type. Always `message`.

    - `"message"`

### Agent Session Message Content

- `AgentSessionMessageContent = InputText { text, type }  or InputImage { image_url, type }  or OutputText { text, type }`

  A content part in a session message.

  - `InputText object { text, type }`

    Text supplied by the user.

    - `text: string`

      The text supplied by the user.

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `InputImage object { image_url, type }`

    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.

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

  - `OutputText object { text, type }`

    Text produced by the assistant.

    - `text: string`

      The text produced by the assistant.

    - `type: "output_text"`

      The type of the object. Always `output_text`.

      - `"output_text"`

### Agent Session Requires Action Event

- `AgentSessionRequiresActionEvent object { event_id, session, type }`

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

  - `event_id: string`

    The unique ID of the event.

  - `session: AgentSession`

    The session and its current required actions.

    - `id: string`

      The ID of the session.

    - `agent: object { id, instructions, model, 6 more }`

      The agent running in the session.

      - `id: string`

        The ID of the agent.

      - `instructions: string or null`

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

      - `model: string`

        The model used by the agent.

      - `multi_agent: MultiAgentConfig`

        Configuration for creating and coordinating subagents.

        - `enabled: boolean`

          Whether subagent tools are enabled. Defaults to false.

        - `max_concurrent_subagents: number or null`

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

      - `name: string or 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.

      - `reasoning: AgentReasoning`

        The agent's reasoning configuration.

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

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

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

        - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

          - `Text object { type }`

            Generates ordinary text without a structured-output constraint.

            - `type: "text"`

              The type of the object. Always `text`.

              - `"text"`

          - `JSONSchema object { schema, type }`

            Constrains generated text to a JSON Schema.

            - `schema: map[unknown]`

              The JSON Schema that generated text must match.

            - `type: "json_schema"`

              The type of the object. Always `json_schema`.

              - `"json_schema"`

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

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

          - `"low"`

          - `"medium"`

          - `"high"`

      - `tools: array of AgentTool`

        Tools available to the agent.

        - `Function object { defer_loading, description, name, 2 more }`

          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.

          - `name: string`

            The name of the function.

          - `parameters: map[unknown]`

            A JSON Schema object describing the function's arguments.

          - `type: "function"`

            The type of the object. Always `function`.

            - `"function"`

        - `ProgrammaticToolCalling object { enabled, type }`

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

        - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

          Tools provided by a remote MCP server.

          - `allowed_tools: array of string or null`

            The MCP tools the agent may call.

          - `connection_origin: "service" or "environment"`

            Where outbound MCP HTTP connections originate.

            - `"service"`

            - `"environment"`

          - `credential_id: string or null`

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

          - `request_metadata: map[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.

          - `transport: McpTransport`

            The transport used to connect to the MCP server.

            - `HTTP object { server_url, type }`

              Connects to an MCP server over HTTP.

              - `server_url: string`

                The URL of the MCP server.

              - `type: "http"`

                The type of the object. Always `http`.

                - `"http"`

            - `Stdio object { args, command, cwd, 2 more }`

              Starts an MCP server as a local process.

              - `args: array of string`

                Arguments passed to the MCP server command.

              - `command: string`

                The command used to start the MCP server.

              - `cwd: string`

                The working directory used to start the MCP server.

              - `env_vars: array of string`

                Environment variable names inherited from the execution environment.

              - `type: "stdio"`

                The type of the object. Always `stdio`.

                - `"stdio"`

          - `type: "mcp"`

            The type of the object. Always `mcp`.

            - `"mcp"`

        - `WebSearch object { allowed_domains, context_size, location, 2 more }`

          Web search.

          - `allowed_domains: array of string or null`

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

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

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

            - `"low"`

            - `"medium"`

            - `"high"`

          - `location: object { city, country, region, timezone }  or null`

            Approximate location used to localize search results, if provided.

            - `city: string or null`

              The city name.

            - `country: string or null`

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

            - `region: string or null`

              The region or state name.

            - `timezone: string or null`

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

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

            The source used for web search results.

            - `"disabled"`

            - `"cached"`

            - `"live"`

          - `type: "web_search"`

            The type of the object. Always `web_search`.

            - `"web_search"`

        - `ComputerUse object { include_screenshots, type }`

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

    - `created_at: number`

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

    - `environment: Environment`

      The execution environment for the session.

      - `None object { type }`

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

        - `type: "none"`

          The type of the object. Always `none`.

          - `"none"`

      - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

        An environment hosted by OpenAI.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `desktop: object { enabled }`

          The effective desktop configuration.

          - `enabled: boolean`

            Whether the environment provisions a desktop and browser proxy.

        - `files: array of HostedEnvironmentFile`

          Files available in the environment, excluding their contents.

          - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

            A file copied from the OpenAI Files API.

            - `id: string`

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

            - `file_id: string`

              The ID of the uploaded file.

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "file_id"`

              The type of the object. Always `file_id`.

              - `"file_id"`

          - `Inline object { id, path, size_bytes, type }`

            A file supplied inline when the session was created.

            - `id: string`

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

            - `path: string`

              The file's absolute path inside the environment.

            - `size_bytes: number`

              The decoded file size in bytes.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

        - `network: object { access, allowed_domains }`

          The effective network access policy for the environment.

          - `access: "enabled" or "disabled" or "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 of string`

            Domains the environment may access when network access is restricted.

        - `packages: object { npm, python, system }`

          Packages installed in the environment.

          - `npm: array of string`

            npm packages installed globally in the environment.

          - `python: array of string`

            Python packages installed in the environment.

          - `system: array of string`

            System packages installed in the environment.

        - `plugins: array of HostedPlugin`

          Plugins installed in the environment, excluding their archive contents.

          - `description: string`

            The installed plugin description.

          - `name: string`

            The installed plugin name.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

        - `skills: array of HostedSkill`

          Skills installed in the environment, excluding their archive contents.

          - `HostedSkillReference object { description, name, skill_id, 2 more }`

            A skill installed from the Skills API.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `skill_id: string`

              The referenced skill ID.

            - `type: "skill_reference"`

              The type of the object. Always `skill_reference`.

              - `"skill_reference"`

            - `version: string`

              The concrete skill version installed for this session.

          - `Inline object { description, name, type }`

            A skill installed from an inline ZIP archive.

            - `description: string`

              The installed skill description.

            - `name: string`

              The installed skill name.

            - `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: optional "small" or "medium" or "large" or null`

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

          - `"small"`

          - `"medium"`

          - `"large"`

      - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

        An environment hosted by the application.

        - `id: string`

          The public ID of the environment.

        - `capability_directories: array of string`

          Directories that contain capabilities exposed to the agent.

        - `remote_url: string`

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

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

    - `error: string or null`

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

    - `last_active_at: number`

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

    - `metadata: map[string]`

      Custom string key-value pairs attached to the session.

    - `object: "agent.session"`

      The object type. Always `agent.session`.

      - `"agent.session"`

    - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

      Actions that must be completed before the session can continue.

      - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

        Respond to a computer-use request.

        - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

          The information needed to render the request.

          - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

            A registered form awaiting the application's response.

            - `credential_origin: string or null`

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

            - `fields: array of object { id, label, required, type }`

              Controls to render. All submitted values are sensitive.

              - `id: string`

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

              - `label: string`

                The label to display beside the control.

              - `required: boolean`

                Whether this control requires a nonempty value.

              - `type: string`

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

            - `options: array of object { id, field_ids, label }`

              Sign-in methods. Empty for a plain form.

              - `id: string`

                The option ID to submit as selected_option.

              - `field_ids: array of string`

                IDs from the registered fields that this method accepts.

              - `label: string`

                The method label to display.

            - `reason: string or null`

              Why the agent needs the user to sign in.

            - `type: "browser_authentication"`

              The type of the object. Always `browser_authentication`.

              - `"browser_authentication"`

          - `BrowserOriginAccess object { origin, reason, type }`

            A browser origin awaiting the application's approval decision.

            - `origin: string`

              The origin the browser needs permission to access.

            - `reason: string or null`

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

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

        - `turn_id: string`

          The turn that requested approval.

        - `type: "computer_use_approval_request"`

          The type of the object. Always `computer_use_approval_request`.

          - `"computer_use_approval_request"`

      - `FunctionCall object { arguments, call_id, name, 2 more }`

        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.

        - `name: string`

          The function name.

        - `turn_id: string`

          The ID of the turn that requested the function call.

        - `type: "function_call"`

          The type of the object. Always `function_call`.

          - `"function_call"`

      - `EnvironmentConnection object { environment_id, type }`

        Reconnect a session environment.

        - `environment_id: string`

          The ID of the environment to reconnect.

        - `type: "environment_connection"`

          The type of the object. Always `environment_connection`.

          - `"environment_connection"`

    - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

    - `vault_ids: array of string`

      The IDs of vaults made available to the session.

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

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

    - `"agent.session.requires_action"`

### Agent Session Subagent Active Event

- `AgentSessionSubagentActiveEvent object { event_id, subagent, type }`

  Emitted when a closed subagent successfully resumes.

  - `event_id: string`

    The unique ID of the event.

  - `subagent: Subagent`

    The subagent that resumed.

    - `id: string`

      The ID of the subagent.

    - `closed_at: number or null`

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

    - `instructions: array of AgentContent or null`

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

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string or null`

      The runner-assigned nickname, or null when unavailable.

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

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

    - `session_id: string`

      The ID of the session that owns the subagent.

    - `status: "active" or "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"`

### Agent Session Subagent Closed Event

- `AgentSessionSubagentClosedEvent object { event_id, subagent, type }`

  Emitted when a subagent is closed.

  - `event_id: string`

    The unique ID of the event.

  - `subagent: Subagent`

    The subagent that was closed.

    - `id: string`

      The ID of the subagent.

    - `closed_at: number or null`

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

    - `instructions: array of AgentContent or null`

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

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string or null`

      The runner-assigned nickname, or null when unavailable.

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

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

    - `session_id: string`

      The ID of the session that owns the subagent.

    - `status: "active" or "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"`

### Agent Session Subagent Created Event

- `AgentSessionSubagentCreatedEvent object { event_id, subagent, type }`

  Emitted when a subagent is created.

  - `event_id: string`

    The unique ID of the event.

  - `subagent: Subagent`

    The subagent that was created.

    - `id: string`

      The ID of the subagent.

    - `closed_at: number or null`

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

    - `instructions: array of AgentContent or null`

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

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `name: string or null`

      The runner-assigned nickname, or null when unavailable.

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

    - `parent_agent_id: string`

      The ID of the agent that created this subagent.

    - `session_id: string`

      The ID of the session that owns the subagent.

    - `status: "active" or "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"`

### Agent Session Turn Cancelled Event

- `AgentSessionTurnCancelledEvent object { event_id, session_id, turn, 3 more }`

  Emitted when a turn is cancelled.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn: Turn`

    The cancelled turn.

    - `id: string`

      The ID of the turn.

    - `agent_id: string`

      The ID of the agent that ran the turn.

    - `completed_at: number or null`

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

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

    - `error: SessionTurnError or null`

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

      - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"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.

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

    - `started_at: number or null`

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

    - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

    - `usage: TokenUsage or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

  - `turn_id: string`

    The ID of the turn associated with the event.

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

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

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

  - `usage: TokenUsage or null`

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

### Agent Session Turn Completed Event

- `AgentSessionTurnCompletedEvent object { event_id, session_id, turn, 3 more }`

  Emitted when a turn completes.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn: Turn`

    The completed turn.

    - `id: string`

      The ID of the turn.

    - `agent_id: string`

      The ID of the agent that ran the turn.

    - `completed_at: number or null`

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

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

    - `error: SessionTurnError or null`

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

      - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"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.

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

    - `started_at: number or null`

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

    - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

    - `usage: TokenUsage or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

  - `turn_id: string`

    The ID of the turn associated with the event.

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

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

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

  - `usage: TokenUsage or null`

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

### Agent Session Turn Content Part Added Event

- `AgentSessionTurnContentPartAddedEvent object { content_index, event_id, item_id, 5 more }`

  Emitted when an output text content part is added.

  - `content_index: number`

    The index of the content part in the message.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the message item.

  - `output_index: number`

    The index of the item in the turn output.

  - `part: OutputText`

    The initial content part.

    - `text: string`

      The text produced by the agent.

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

### Agent Session Turn Content Part Done Event

- `AgentSessionTurnContentPartDoneEvent object { content_index, event_id, item_id, 5 more }`

  Emitted when an output content part is complete.

  - `content_index: number`

    The index of the content part in the message.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the message item.

  - `output_index: number`

    The index of the item in the turn output.

  - `part: OutputText`

    The completed content part.

    - `text: string`

      The text produced by the agent.

    - `type: "output_text"`

      The content type. Always `output_text`.

      - `"output_text"`

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

### Agent Session Turn Created Event

- `AgentSessionTurnCreatedEvent object { event_id, session_id, turn, 2 more }`

  Emitted when a turn is created.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn: Turn`

    The turn at the time it was created.

    - `id: string`

      The ID of the turn.

    - `agent_id: string`

      The ID of the agent that ran the turn.

    - `completed_at: number or null`

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

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

    - `error: SessionTurnError or null`

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

      - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"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.

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

    - `started_at: number or null`

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

    - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

    - `usage: TokenUsage or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

  - `turn_id: string`

    The ID of the turn associated with the event.

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

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

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

### Agent Session Turn Failed Event

- `AgentSessionTurnFailedEvent object { event_id, session_id, turn, 3 more }`

  Emitted when a turn fails.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn: Turn`

    The failed turn.

    - `id: string`

      The ID of the turn.

    - `agent_id: string`

      The ID of the agent that ran the turn.

    - `completed_at: number or null`

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

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

    - `error: SessionTurnError or null`

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

      - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"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.

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

    - `started_at: number or null`

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

    - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

    - `usage: TokenUsage or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

  - `turn_id: string`

    The ID of the turn associated with the event.

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

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

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

  - `usage: TokenUsage or null`

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

### Agent Session Turn In Progress Event

- `AgentSessionTurnInProgressEvent object { event_id, session_id, turn, 2 more }`

  Emitted when a turn starts running.

  - `event_id: string`

    The unique ID of the event.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn: Turn`

    The turn at the time it started running.

    - `id: string`

      The ID of the turn.

    - `agent_id: string`

      The ID of the agent that ran the turn.

    - `completed_at: number or null`

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

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

    - `error: SessionTurnError or null`

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

      - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

        A stable, machine-readable failure category.

        - `"context_length_exceeded"`

          The request exceeds the model's context window.

        - `"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.

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

    - `started_at: number or null`

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

    - `status: "queued" or "in_progress" or "waiting" or 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 or null`

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

    - `usage: TokenUsage or 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.

      - `input_tokens_details: object { cached_tokens }`

        A breakdown of the agent's input token usage.

        - `cached_tokens: number`

          The number of input tokens retrieved from the prompt cache.

      - `output_tokens: number`

        The number of output tokens generated by the agent.

      - `output_tokens_details: object { reasoning_tokens }`

        A breakdown of the agent's output token usage.

        - `reasoning_tokens: number`

          The number of output tokens used for reasoning.

      - `total_tokens: number`

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

  - `turn_id: string`

    The ID of the turn associated with the event.

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

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

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

### Agent Session Turn Item Added Event

- `AgentSessionTurnItemAddedEvent object { event_id, item, output_index, 3 more }`

  Emitted when an item is added to a turn.

  - `event_id: string`

    The unique ID of the event.

  - `item: AgentSessionItem`

    The item that was added.

    - `AgentSessionMessage object { id, content, phase, 4 more }`

      A user or assistant message recorded in a session.

      - `id: string or null`

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

      - `content: array of AgentSessionMessageContent`

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

        - `InputText object { text, type }`

          Text supplied by the user.

          - `text: string`

            The text supplied by the user.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

          - `type: "input_image"`

            The type of the object. Always `input_image`.

            - `"input_image"`

        - `OutputText object { text, type }`

          Text produced by the assistant.

          - `text: string`

            The text produced by the assistant.

          - `type: "output_text"`

            The type of the object. Always `output_text`.

            - `"output_text"`

      - `phase: "commentary" or "final_answer" or 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" or "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.

      - `type: "message"`

        The item type. Always `message`.

        - `"message"`

    - `AgentReasoningItem object { id, status, summary, 2 more }`

      A reasoning item produced by the agent.

      - `id: string`

        The ID of the reasoning item.

      - `status: AgentOutputItemStatus or null`

        The status of the reasoning item.

      - `summary: array of SummaryText`

        The reasoning summaries produced by the agent.

        - `text: string`

          The reasoning summary text.

        - `type: "summary_text"`

          The content type. Always `summary_text`.

          - `"summary_text"`

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "reasoning"`

        The item type. Always `reasoning`.

        - `"reasoning"`

    - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

      A function call produced by the agent.

      - `id: string`

        The ID of the function call item.

      - `arguments: unknown`

        The arguments to pass to the function.

      - `call_id: string`

        The ID used to submit the function result.

      - `name: string`

        The name of the function to call.

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

      - `type: "function_call"`

        The item type. Always `function_call`.

        - `"function_call"`

    - `FunctionCallOutput object { id, call_id, error, 4 more }`

      The result supplied for a function call.

      - `id: string`

        The ID of the function call output item.

      - `call_id: string`

        The ID of the function call that produced this output.

      - `error: string or null`

        The error message, if the call failed.

      - `output: AgentFunctionCallOutput or null`

        The function result, if the call succeeded.

        - `string`

        - `array of InputContent`

          - `InputText object { text, type }`

            Text input recorded in a session item.

            - `text: string`

              The text supplied to the agent.

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputImage object { image_url, type }`

            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.

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

      - `type: "function_call_output"`

        The item type. Always `function_call_output`.

        - `"function_call_output"`

    - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

      A message exchanged between agent threads.

      - `id: string`

        The ID of the message.

      - `content: array of AgentContent`

        The content exchanged between the agents.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

          - `text: string`

            The text produced by the agent.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

          - `encrypted_content: string`

            The encrypted content payload.

          - `type: "encrypted_content"`

            The content type. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient_agent_id: string`

        The ID or name of the receiving agent.

      - `sender_agent_id: string`

        The ID or name of the sending agent.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

    - `AgentMcpCallItem object { id, arguments, error, 6 more }`

      A call to a tool on an MCP server.

      - `id: string`

        The ID of the MCP call item.

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

      - `output: unknown`

        The output returned by the MCP tool, if any.

      - `server_label: string`

        The label of the MCP server.

      - `status: AgentFunctionCallStatus`

        The status of the MCP tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "mcp_call"`

        The item type. Always `mcp_call`.

        - `"mcp_call"`

    - `ComputerUseCall object { id, output, status, 3 more }`

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

      - `id: string`

        The ID of the activity item.

      - `output: object { image_url, type }  or 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.

        - `type: "computer_screenshot"`

          The content type. Always `computer_screenshot`.

          - `"computer_screenshot"`

      - `status: AgentFunctionCallStatus`

        The execution status of the activity.

      - `title: string or null`

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

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "computer_use_call"`

        The item type. Always `computer_use_call`.

        - `"computer_use_call"`

    - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

      - `id: string`

        The stable history item ID.

      - `request: object { credential_origin, fields, options, 2 more }`

        A registered form awaiting the application's response.

        - `credential_origin: string or null`

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

        - `fields: array of object { id, label, required, type }`

          Controls to render. All submitted values are sensitive.

          - `id: string`

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

          - `label: string`

            The label to display beside the control.

          - `required: boolean`

            Whether this control requires a nonempty value.

          - `type: string`

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

        - `options: array of object { id, field_ids, label }`

          Sign-in methods. Empty for a plain form.

          - `id: string`

            The option ID to submit as selected_option.

          - `field_ids: array of string`

            IDs from the registered fields that this method accepts.

          - `label: string`

            The method label to display.

        - `reason: string or null`

          Why the agent needs the user to sign in.

        - `type: "browser_authentication"`

          The type of the object. Always `browser_authentication`.

          - `"browser_authentication"`

      - `request_id: string`

      - `turn_id: string`

      - `type: "computer_use_approval_request"`

        The item type. Always computer_use_approval_request.

        - `"computer_use_approval_request"`

    - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

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

      - `id: string`

        The stable history item ID.

      - `request_id: string`

        The registered request answered by this item.

      - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

        The admitted response, without submitted credential values.

        - `Submit object { action, selected_option, type }`

          - `action: "submit"`

            - `"submit"`

          - `selected_option: string or null`

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

          - `type: "browser_authentication"`

            - `"browser_authentication"`

        - `Cancel object { action, type }`

          - `action: "cancel"`

            - `"cancel"`

          - `type: "browser_authentication"`

            - `"browser_authentication"`

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "computer_use_approval_request_result"`

        - `"computer_use_approval_request_result"`

    - `AgentWebSearchCallItem object { id, action, status, 2 more }`

      A web search call produced by the agent.

      - `id: string`

        The ID of the web search call.

      - `action: WebSearchAction or null`

        The action performed by the web search tool.

        - `Search object { queries, query, type }`

          A search query or group of search queries.

          - `queries: array of string or null`

            The search queries, when multiple queries were used.

          - `query: string or null`

            The search query, when a single query was used.

          - `type: "search"`

            The type of the object. Always `search`.

            - `"search"`

        - `OpenPage object { type, url }`

          Opens a web page.

          - `type: "open_page"`

            The type of the object. Always `open_page`.

            - `"open_page"`

          - `url: string or null`

            The URL of the page that was opened.

        - `FindInPage object { pattern, type, url }`

          Finds text within a web page.

          - `pattern: string or null`

            The text pattern that was searched for.

          - `type: "find_in_page"`

            The type of the object. Always `find_in_page`.

            - `"find_in_page"`

          - `url: string or null`

            The URL of the page that was searched.

        - `Other object { type }`

          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.

      - `type: "web_search_call"`

        The item type. Always `web_search_call`.

        - `"web_search_call"`

    - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

      A command execution produced by the agent.

      - `id: string`

        The ID of the command execution item.

      - `command: string`

        The command that was executed.

      - `cwd: string or null`

        The working directory used to execute the command.

      - `duration_ms: number or null`

        The command duration in milliseconds.

      - `exit_code: number or null`

        The process exit code, if the command completed.

      - `output: string or null`

        The command output, if available.

      - `status: AgentFunctionCallStatus`

        The status of the command execution.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "command_execution"`

        The item type. Always `command_execution`.

        - `"command_execution"`

    - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

      A request to spawn a subagent.

      - `id: string`

        The ID of the tool call item.

      - `agent_id: string`

        The ID of the agent that requested the subagent.

      - `content: array of AgentContent`

        The task given to the spawned agent.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

      - `model: string or null`

        The model requested for the spawned agent.

      - `reasoning_effort: string or null`

        The reasoning effort requested for the spawned agent.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "create_subagent_call"`

        The item type. Always `create_subagent_call`.

        - `"create_subagent_call"`

          The current public item type.

    - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

      A request to send input to another agent.

      - `id: string`

        The ID of the tool call item.

      - `content: array of AgentContent`

        The input sent to the receiving agent.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

      - `recipient_agent_id: string`

        The ID of the agent receiving the input.

      - `sender_agent_id: string`

        The ID of the agent sending the input.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "send_subagent_input_call"`

        The item type. Always `send_subagent_input_call`.

        - `"send_subagent_input_call"`

          The current public item type.

    - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

      A request to resume a subagent.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to resume.

      - `sender_agent_id: string`

        The ID of the agent requesting the resume.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "resume_subagent_call"`

        The item type. Always `resume_subagent_call`.

        - `"resume_subagent_call"`

          The current public item type.

    - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

      A request to wait for one or more subagents.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_ids: array of string`

        The IDs of the agents to wait for.

      - `sender_agent_id: string`

        The ID of the agent waiting for results.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "wait_for_subagents_call"`

        The item type. Always `wait_for_subagents_call`.

        - `"wait_for_subagents_call"`

          The current public item type.

    - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to interrupt.

      - `sender_agent_id: string`

        The ID of the agent requesting the interrupt.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "interrupt_subagent_call"`

        The item type. Always `interrupt_subagent_call`.

        - `"interrupt_subagent_call"`

          The current public item type.

    - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

      A request to close a subagent.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to close.

      - `sender_agent_id: string`

        The ID of the agent requesting the close.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "close_subagent_call"`

        The item type. Always `close_subagent_call`.

        - `"close_subagent_call"`

          The current public item type.

  - `output_index: number or null`

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

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Turn Item Done Event

- `AgentSessionTurnItemDoneEvent object { event_id, item, output_index, 3 more }`

  Emitted when an output item is complete.

  - `event_id: string`

    The unique ID of the event.

  - `item: AgentOutputItem`

    The completed output item.

    - `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

      An assistant message produced by the agent.

      - `id: string`

        The ID of the message.

      - `content: array of OutputText`

        The content of the message.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `phase: "commentary" or "final_answer" or 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.

      - `type: "message"`

        The item type. Always `message`.

        - `"message"`

    - `AgentReasoningItem object { id, status, summary, 2 more }`

      A reasoning item produced by the agent.

      - `id: string`

        The ID of the reasoning item.

      - `status: AgentOutputItemStatus or null`

        The status of the reasoning item.

      - `summary: array of SummaryText`

        The reasoning summaries produced by the agent.

        - `text: string`

          The reasoning summary text.

        - `type: "summary_text"`

          The content type. Always `summary_text`.

          - `"summary_text"`

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "reasoning"`

        The item type. Always `reasoning`.

        - `"reasoning"`

    - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

      A function call produced by the agent.

      - `id: string`

        The ID of the function call item.

      - `arguments: unknown`

        The arguments to pass to the function.

      - `call_id: string`

        The ID used to submit the function result.

      - `name: string`

        The name of the function to call.

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

      - `type: "function_call"`

        The item type. Always `function_call`.

        - `"function_call"`

    - `AgentMcpCallItem object { id, arguments, error, 6 more }`

      A call to a tool on an MCP server.

      - `id: string`

        The ID of the MCP call item.

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

      - `output: unknown`

        The output returned by the MCP tool, if any.

      - `server_label: string`

        The label of the MCP server.

      - `status: AgentFunctionCallStatus`

        The status of the MCP tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "mcp_call"`

        The item type. Always `mcp_call`.

        - `"mcp_call"`

    - `ComputerUseCall object { id, output, status, 3 more }`

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

      - `id: string`

        The ID of the activity item.

      - `output: object { image_url, type }  or 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.

        - `type: "computer_screenshot"`

          The content type. Always `computer_screenshot`.

          - `"computer_screenshot"`

      - `status: AgentFunctionCallStatus`

        The execution status of the activity.

      - `title: string or null`

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

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "computer_use_call"`

        The item type. Always `computer_use_call`.

        - `"computer_use_call"`

    - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

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

      - `id: string`

        The stable history item ID.

      - `request: object { credential_origin, fields, options, 2 more }`

        A registered form awaiting the application's response.

        - `credential_origin: string or null`

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

        - `fields: array of object { id, label, required, type }`

          Controls to render. All submitted values are sensitive.

          - `id: string`

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

          - `label: string`

            The label to display beside the control.

          - `required: boolean`

            Whether this control requires a nonempty value.

          - `type: string`

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

        - `options: array of object { id, field_ids, label }`

          Sign-in methods. Empty for a plain form.

          - `id: string`

            The option ID to submit as selected_option.

          - `field_ids: array of string`

            IDs from the registered fields that this method accepts.

          - `label: string`

            The method label to display.

        - `reason: string or null`

          Why the agent needs the user to sign in.

        - `type: "browser_authentication"`

          The type of the object. Always `browser_authentication`.

          - `"browser_authentication"`

      - `request_id: string`

      - `turn_id: string`

      - `type: "computer_use_approval_request"`

        The item type. Always computer_use_approval_request.

        - `"computer_use_approval_request"`

    - `AgentWebSearchCallItem object { id, action, status, 2 more }`

      A web search call produced by the agent.

      - `id: string`

        The ID of the web search call.

      - `action: WebSearchAction or null`

        The action performed by the web search tool.

        - `Search object { queries, query, type }`

          A search query or group of search queries.

          - `queries: array of string or null`

            The search queries, when multiple queries were used.

          - `query: string or null`

            The search query, when a single query was used.

          - `type: "search"`

            The type of the object. Always `search`.

            - `"search"`

        - `OpenPage object { type, url }`

          Opens a web page.

          - `type: "open_page"`

            The type of the object. Always `open_page`.

            - `"open_page"`

          - `url: string or null`

            The URL of the page that was opened.

        - `FindInPage object { pattern, type, url }`

          Finds text within a web page.

          - `pattern: string or null`

            The text pattern that was searched for.

          - `type: "find_in_page"`

            The type of the object. Always `find_in_page`.

            - `"find_in_page"`

          - `url: string or null`

            The URL of the page that was searched.

        - `Other object { type }`

          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.

      - `type: "web_search_call"`

        The item type. Always `web_search_call`.

        - `"web_search_call"`

    - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

      A command execution produced by the agent.

      - `id: string`

        The ID of the command execution item.

      - `command: string`

        The command that was executed.

      - `cwd: string or null`

        The working directory used to execute the command.

      - `duration_ms: number or null`

        The command duration in milliseconds.

      - `exit_code: number or null`

        The process exit code, if the command completed.

      - `output: string or null`

        The command output, if available.

      - `status: AgentFunctionCallStatus`

        The status of the command execution.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "command_execution"`

        The item type. Always `command_execution`.

        - `"command_execution"`

    - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

      A request to spawn a subagent.

      - `id: string`

        The ID of the tool call item.

      - `agent_id: string`

        The ID of the agent that requested the subagent.

      - `content: array of AgentContent`

        The task given to the spawned agent.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

          - `text: string`

            The text produced by the agent.

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

          - `encrypted_content: string`

            The encrypted content payload.

          - `type: "encrypted_content"`

            The content type. Always `encrypted_content`.

            - `"encrypted_content"`

      - `model: string or null`

        The model requested for the spawned agent.

      - `reasoning_effort: string or null`

        The reasoning effort requested for the spawned agent.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "create_subagent_call"`

        The item type. Always `create_subagent_call`.

        - `"create_subagent_call"`

          The current public item type.

    - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

      A request to send input to another agent.

      - `id: string`

        The ID of the tool call item.

      - `content: array of AgentContent`

        The input sent to the receiving agent.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

      - `recipient_agent_id: string`

        The ID of the agent receiving the input.

      - `sender_agent_id: string`

        The ID of the agent sending the input.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "send_subagent_input_call"`

        The item type. Always `send_subagent_input_call`.

        - `"send_subagent_input_call"`

          The current public item type.

    - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

      A request to resume a subagent.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to resume.

      - `sender_agent_id: string`

        The ID of the agent requesting the resume.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "resume_subagent_call"`

        The item type. Always `resume_subagent_call`.

        - `"resume_subagent_call"`

          The current public item type.

    - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

      A request to wait for one or more subagents.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_ids: array of string`

        The IDs of the agents to wait for.

      - `sender_agent_id: string`

        The ID of the agent waiting for results.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "wait_for_subagents_call"`

        The item type. Always `wait_for_subagents_call`.

        - `"wait_for_subagents_call"`

          The current public item type.

    - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

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

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to interrupt.

      - `sender_agent_id: string`

        The ID of the agent requesting the interrupt.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "interrupt_subagent_call"`

        The item type. Always `interrupt_subagent_call`.

        - `"interrupt_subagent_call"`

          The current public item type.

    - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

      A request to close a subagent.

      - `id: string`

        The ID of the tool call item.

      - `recipient_agent_id: string`

        The ID of the agent to close.

      - `sender_agent_id: string`

        The ID of the agent requesting the close.

      - `status: AgentFunctionCallStatus`

        The status of the tool call.

      - `turn_id: string`

        The ID of the turn that contains this item.

      - `type: "close_subagent_call"`

        The item type. Always `close_subagent_call`.

        - `"close_subagent_call"`

          The current public item type.

  - `output_index: number`

    The index of the output item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

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

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

### Agent Session Turn Output Text Delta Event

- `AgentSessionTurnOutputTextDeltaEvent object { content_index, delta, event_id, 5 more }`

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

  - `content_index: number`

    The index of the content part in the message.

  - `delta: string`

    The text that was appended.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the message item.

  - `output_index: number`

    The index of the item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `turn_id: string or null`

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

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

### Agent Session Turn Output Text Done Event

- `AgentSessionTurnOutputTextDoneEvent object { content_index, event_id, item_id, 5 more }`

  Emitted when an output text content part is complete.

  - `content_index: number`

    The index of the content part in the message.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the message item.

  - `output_index: number`

    The index of the item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `text: string`

    The complete output text.

  - `turn_id: string or null`

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

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

### Agent Session Turn Reasoning Summary Part Added Event

- `AgentSessionTurnReasoningSummaryPartAddedEvent object { event_id, item_id, output_index, 5 more }`

  Emitted when a reasoning summary content part is added.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the reasoning item.

  - `output_index: number`

    The index of the item in the turn output.

  - `part: SummaryText`

    The initial summary part.

    - `text: string`

      The reasoning summary text.

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `session_id: string`

    The ID of the session associated with the event.

  - `summary_index: number`

    The index of the summary content part.

  - `turn_id: string or null`

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

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

### Agent Session Turn Reasoning Summary Part Done Event

- `AgentSessionTurnReasoningSummaryPartDoneEvent object { event_id, item_id, output_index, 6 more }`

  Emitted when a reasoning summary part is complete.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the reasoning item.

  - `output_index: number`

    The index of the item in the turn output.

  - `part: SummaryText`

    The completed summary part.

    - `text: string`

      The reasoning summary text.

    - `type: "summary_text"`

      The content type. Always `summary_text`.

      - `"summary_text"`

  - `session_id: string`

    The ID of the session associated with the event.

  - `status: "incomplete" or null`

    Present as `incomplete` when summary generation was interrupted.

    - `"incomplete"`

  - `summary_index: number`

    The index of the summary part.

  - `turn_id: string or null`

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

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

### Agent Session Turn Reasoning Summary Text Delta Event

- `AgentSessionTurnReasoningSummaryTextDeltaEvent object { delta, event_id, item_id, 5 more }`

  Emitted when text is appended to a reasoning summary.

  - `delta: string`

    The summary text that was appended.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the reasoning item.

  - `output_index: number`

    The index of the item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `summary_index: number`

    The index of the summary content part.

  - `turn_id: string or null`

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

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

### Agent Session Turn Reasoning Summary Text Done Event

- `AgentSessionTurnReasoningSummaryTextDoneEvent object { event_id, item_id, output_index, 5 more }`

  Emitted when a reasoning summary content part is complete.

  - `event_id: string`

    The unique ID of the event.

  - `item_id: string`

    The ID of the reasoning item.

  - `output_index: number`

    The index of the item in the turn output.

  - `session_id: string`

    The ID of the session associated with the event.

  - `summary_index: number`

    The index of the summary content part.

  - `text: string`

    The complete reasoning summary text.

  - `turn_id: string or null`

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

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

### Agent Text

- `AgentText object { format, verbosity }`

  The text configuration used by an agent.

  - `format: TextFormat`

    The effective output format. Defaults to ordinary text.

    - `Text object { type }`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `JSONSchema object { schema, type }`

      Constrains generated text to a JSON Schema.

      - `schema: map[unknown]`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

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

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

    - `"low"`

    - `"medium"`

    - `"high"`

### Agent Text Param

- `AgentTextParam object { format, verbosity }`

  Configuration for text generated by the agent.

  - `format: optional TextFormatParam or null`

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

    - `Text object { type }`

      Generates ordinary text without a structured-output constraint.

      - `type: "text"`

        The type of the object. Always `text`.

        - `"text"`

    - `JSONSchema object { schema, type }`

      Constrains generated text to a JSON Schema.

      - `schema: map[unknown]`

        The JSON Schema that generated text must match.

      - `type: "json_schema"`

        The type of the object. Always `json_schema`.

        - `"json_schema"`

  - `verbosity: optional "low" or "medium" or "high" or 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 = Function { defer_loading, description, name, 2 more }  or ProgrammaticToolCalling { enabled, type }  or Mcp { allowed_tools, connection_origin, credential_id, 5 more }  or 2 more`

  A tool available to the agent.

  - `Function object { defer_loading, description, name, 2 more }`

    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.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

  - `ProgrammaticToolCalling object { enabled, type }`

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

  - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

    Tools provided by a remote MCP server.

    - `allowed_tools: array of string or null`

      The MCP tools the agent may call.

    - `connection_origin: "service" or "environment"`

      Where outbound MCP HTTP connections originate.

      - `"service"`

      - `"environment"`

    - `credential_id: string or null`

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

    - `request_metadata: map[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.

    - `transport: McpTransport`

      The transport used to connect to the MCP server.

      - `HTTP object { server_url, type }`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

      - `Stdio object { args, command, cwd, 2 more }`

        Starts an MCP server as a local process.

        - `args: array of string`

          Arguments passed to the MCP server command.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `env_vars: array of string`

          Environment variable names inherited from the execution environment.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

  - `WebSearch object { allowed_domains, context_size, location, 2 more }`

    Web search.

    - `allowed_domains: array of string or null`

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

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: object { city, country, region, timezone }  or null`

      Approximate location used to localize search results, if provided.

      - `city: string or null`

        The city name.

      - `country: string or null`

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

      - `region: string or null`

        The region or state name.

      - `timezone: string or null`

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

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

      The source used for web search results.

      - `"disabled"`

      - `"cached"`

      - `"live"`

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

  - `ComputerUse object { include_screenshots, type }`

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

### Agent Tool Param

- `AgentToolParam = Function { description, name, parameters, 2 more }  or ToolSearch { type }  or ProgrammaticToolCalling { type, enabled }  or 3 more`

  A tool available to the agent.

  - `Function object { description, name, parameters, 2 more }`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `defer_loading: optional boolean`

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

  - `ToolSearch object { type }`

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

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `ProgrammaticToolCalling object { type, enabled }`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled: optional boolean`

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

  - `Mcp object { server_label, transport, type, 5 more }`

    Tools provided by a remote MCP server.

    - `server_label: string`

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

    - `transport: McpTransportParam`

      The transport used to connect to the MCP server.

      - `HTTP object { server_url, type, authorization, headers }`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `authorization: optional string or null`

          The authorization value sent to the MCP server, if any.

        - `headers: optional map[string] or null`

          Additional HTTP headers sent to the MCP server.

      - `Stdio object { command, cwd, type, 3 more }`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args: optional array of string or null`

          Arguments passed to the MCP server command.

        - `env: optional map[string] or null`

          Environment variables set for the MCP server process.

        - `env_vars: optional array of string or null`

          Environment variable names to inherit from the selected execution environment.

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools: optional array of string or null`

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

    - `connection_origin: optional "service" or "environment" or 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: optional string or null`

      The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

    - `request_metadata: optional map[unknown] or null`

      Metadata included with requests to this MCP server.

    - `required: optional boolean`

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

  - `WebSearch object { type, allowed_domains, context_size, 2 more }`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains: optional array of string or null`

      Domains the search may include.

    - `context_size: optional "low" or "medium" or "high" or null`

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: optional object { city, country, region, timezone }  or null`

      Approximate location used to localize search results.

      - `city: optional string or null`

        The city name.

      - `country: optional string or null`

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

      - `region: optional string or null`

        The region or state name.

      - `timezone: optional string or null`

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

    - `mode: optional "disabled" or "cached" or "live" or 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.

  - `ComputerUse object { type, include_screenshots }`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots: optional boolean`

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

### Agent Wait For Subagents Call Item

- `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

  A request to wait for one or more subagents.

  - `id: string`

    The ID of the tool call item.

  - `recipient_agent_ids: array of string`

    The IDs of the agents to wait for.

  - `sender_agent_id: string`

    The ID of the agent waiting for results.

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

  - `type: "wait_for_subagents_call"`

    The item type. Always `wait_for_subagents_call`.

    - `"wait_for_subagents_call"`

      The current public item type.

### Agent Web Search Call Item

- `AgentWebSearchCallItem object { id, action, status, 2 more }`

  A web search call produced by the agent.

  - `id: string`

    The ID of the web search call.

  - `action: WebSearchAction or null`

    The action performed by the web search tool.

    - `Search object { queries, query, type }`

      A search query or group of search queries.

      - `queries: array of string or null`

        The search queries, when multiple queries were used.

      - `query: string or null`

        The search query, when a single query was used.

      - `type: "search"`

        The type of the object. Always `search`.

        - `"search"`

    - `OpenPage object { type, url }`

      Opens a web page.

      - `type: "open_page"`

        The type of the object. Always `open_page`.

        - `"open_page"`

      - `url: string or null`

        The URL of the page that was opened.

    - `FindInPage object { pattern, type, url }`

      Finds text within a web page.

      - `pattern: string or null`

        The text pattern that was searched for.

      - `type: "find_in_page"`

        The type of the object. Always `find_in_page`.

        - `"find_in_page"`

      - `url: string or null`

        The URL of the page that was searched.

    - `Other object { type }`

      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.

  - `type: "web_search_call"`

    The item type. Always `web_search_call`.

    - `"web_search_call"`

### Environment

- `Environment = None { type }  or OpenAIHosted { id, capability_directories, desktop, 7 more }  or SelfHosted { id, capability_directories, remote_url, 2 more }`

  The execution environment for a session.

  - `None object { type }`

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

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

    An environment hosted by OpenAI.

    - `id: string`

      The public ID of the environment.

    - `capability_directories: array of string`

      Directories that contain capabilities exposed to the agent.

    - `desktop: object { enabled }`

      The effective desktop configuration.

      - `enabled: boolean`

        Whether the environment provisions a desktop and browser proxy.

    - `files: array of HostedEnvironmentFile`

      Files available in the environment, excluding their contents.

      - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

        A file copied from the OpenAI Files API.

        - `id: string`

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

        - `file_id: string`

          The ID of the uploaded file.

        - `path: string`

          The file's absolute path inside the environment.

        - `size_bytes: number`

          The decoded file size in bytes.

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `Inline object { id, path, size_bytes, type }`

        A file supplied inline when the session was created.

        - `id: string`

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

        - `path: string`

          The file's absolute path inside the environment.

        - `size_bytes: number`

          The decoded file size in bytes.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network: object { access, allowed_domains }`

      The effective network access policy for the environment.

      - `access: "enabled" or "disabled" or "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 of string`

        Domains the environment may access when network access is restricted.

    - `packages: object { npm, python, system }`

      Packages installed in the environment.

      - `npm: array of string`

        npm packages installed globally in the environment.

      - `python: array of string`

        Python packages installed in the environment.

      - `system: array of string`

        System packages installed in the environment.

    - `plugins: array of HostedPlugin`

      Plugins installed in the environment, excluding their archive contents.

      - `description: string`

        The installed plugin description.

      - `name: string`

        The installed plugin name.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `skills: array of HostedSkill`

      Skills installed in the environment, excluding their archive contents.

      - `HostedSkillReference object { description, name, skill_id, 2 more }`

        A skill installed from the Skills API.

        - `description: string`

          The installed skill description.

        - `name: string`

          The installed skill name.

        - `skill_id: string`

          The referenced skill ID.

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version: string`

          The concrete skill version installed for this session.

      - `Inline object { description, name, type }`

        A skill installed from an inline ZIP archive.

        - `description: string`

          The installed skill description.

        - `name: string`

          The installed skill name.

        - `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: optional "small" or "medium" or "large" or null`

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

      - `"small"`

      - `"medium"`

      - `"large"`

  - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

    An environment hosted by the application.

    - `id: string`

      The public ID of the environment.

    - `capability_directories: array of string`

      Directories that contain capabilities exposed to the agent.

    - `remote_url: string`

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

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

### Environment Param

- `EnvironmentParam = None { type }  or OpenAIHosted { type, capability_directories, container_size, 10 more }  or SelfHosted { type, workspace_directory, capability_directories }`

  The execution environment and optional reusable template for a session.

  - `None object { type }`

    Runs the agent without an execution environment.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `OpenAIHosted object { type, capability_directories, container_size, 10 more }`

    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: optional array of string or null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

    - `container_size: optional "small" or "medium" or "large"`

      The hosted container size. Omission selects the medium tier.

      - `"small"`

      - `"medium"`

      - `"large"`

    - `desktop: optional object { enabled }  or 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: optional map[string] or null`

      Environment variables made available to the agent.

    - `environment_id: optional string`

      An existing prewarmed environment. Cannot be combined with a template or inline configuration.

    - `environment_template_id: optional string`

      A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

    - `files: optional array of HostedEnvironmentFileParam or null`

      Files available before the agent starts. Defaults to an empty list.

      - `FileID object { file_id, path, type }`

        A file previously uploaded through the OpenAI Files API.

        - `file_id: string`

          The ID of the uploaded file.

        - `path: string`

          The absolute destination path inside `/workspace`.

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `Inline object { data, path, type }`

        A file supplied directly as standard-base64 data.

        - `data: string`

          The standard-base64-encoded file contents.

        - `path: string`

          The absolute destination path inside `/workspace`.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network: optional object { access, allowed_domains, blocked_domains }  or null`

      Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

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

        The environment's network access mode.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains: optional array of string or null`

        Domains the environment may access when network access is restricted.

      - `blocked_domains: optional array of string or 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.

    - `packages: optional object { npm, python, system }  or null`

      Packages to install in the environment. Defaults to empty package lists.

      - `npm: optional array of string or null`

        npm packages to install globally. Defaults to an empty list.

      - `python: optional array of string or null`

        Python packages to install. Defaults to an empty list.

      - `system: optional array of string or null`

        System packages to install. Defaults to an empty list.

    - `plugins: optional array of HostedPluginParam or null`

      Plugins provided as inline ZIP archives. Defaults to an empty list.

      - `description: string`

        The plugin description declared in `.codex-plugin/plugin.json`.

      - `name: string`

        The plugin name declared in `.codex-plugin/plugin.json`.

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

        - `data: string`

          Standard-base64 encoded ZIP archive bytes.

        - `media_type: "application/zip"`

          The archive media type, always `application/zip`.

          - `"application/zip"`

            A ZIP archive.

        - `type: "base64"`

          The type of the object. Always `base64`.

          - `"base64"`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `setup_commands: optional array of SetupCommandParam or null`

      Ordered, confidential setup commands. Command bodies are never returned.

      - `command: string`

        The shell command to execute.

      - `cwd: optional string or null`

        The absolute working directory. Defaults to `/workspace`.

    - `skills: optional array of HostedSkillParam or null`

      Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

      - `SkillReference object { skill_id, type, version }`

        References a skill uploaded through the Skills API.

        - `skill_id: string`

          The ID of the skill created through `/v1/skills`.

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version: optional string or null`

          The skill version, a positive integer or `latest`; omission selects the default.

      - `Inline object { description, name, source, type }`

        Supplies a skill ZIP directly in the session request.

        - `description: string`

          The skill description declared in `SKILL.md`.

        - `name: string`

          The skill name declared in `SKILL.md`.

        - `source: InlineCapabilitySourceParam`

          Provides ZIP bytes encoded with standard base64.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

  - `SelfHosted object { type, workspace_directory, capability_directories }`

    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.

    - `capability_directories: optional array of string or null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

### Hosted Environment File

- `HostedEnvironmentFile = HostedEnvironmentFileID or Inline { id, path, size_bytes, type }`

  Metadata for a file materialized in an OpenAI-hosted execution environment.

  - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

    A file copied from the OpenAI Files API.

    - `id: string`

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

    - `file_id: string`

      The ID of the uploaded file.

    - `path: string`

      The file's absolute path inside the environment.

    - `size_bytes: number`

      The decoded file size in bytes.

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `Inline object { id, path, size_bytes, type }`

    A file supplied inline when the session was created.

    - `id: string`

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

    - `path: string`

      The file's absolute path inside the environment.

    - `size_bytes: number`

      The decoded file size in bytes.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Environment File ID

- `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

  A file copied from the OpenAI Files API.

  - `id: string`

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

  - `file_id: string`

    The ID of the uploaded file.

  - `path: string`

    The file's absolute path inside the environment.

  - `size_bytes: number`

    The decoded file size in bytes.

  - `type: "file_id"`

    The type of the object. Always `file_id`.

    - `"file_id"`

### Hosted Environment File Param

- `HostedEnvironmentFileParam = FileID { file_id, path, type }  or Inline { data, path, type }`

  A file materialized in an OpenAI-hosted execution environment.

  - `FileID object { file_id, path, type }`

    A file previously uploaded through the OpenAI Files API.

    - `file_id: string`

      The ID of the uploaded file.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `Inline object { data, path, type }`

    A file supplied directly as standard-base64 data.

    - `data: string`

      The standard-base64-encoded file contents.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Plugin

- `HostedPlugin object { description, name, type }`

  A plugin installed from an inline ZIP archive.

  - `description: string`

    The installed plugin description.

  - `name: string`

    The installed plugin name.

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

### Hosted Plugin Param

- `HostedPluginParam object { description, name, source, type }`

  Supplies a plugin ZIP directly in the session request.

  - `description: string`

    The plugin description declared in `.codex-plugin/plugin.json`.

  - `name: string`

    The plugin name declared in `.codex-plugin/plugin.json`.

  - `source: InlineCapabilitySourceParam`

    Provides ZIP bytes encoded with standard base64.

    - `data: string`

      Standard-base64 encoded ZIP archive bytes.

    - `media_type: "application/zip"`

      The archive media type, always `application/zip`.

      - `"application/zip"`

        A ZIP archive.

    - `type: "base64"`

      The type of the object. Always `base64`.

      - `"base64"`

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

### Hosted Skill

- `HostedSkill = HostedSkillReference or Inline { description, name, type }`

  A skill installed in an OpenAI-hosted environment.

  - `HostedSkillReference object { description, name, skill_id, 2 more }`

    A skill installed from the Skills API.

    - `description: string`

      The installed skill description.

    - `name: string`

      The installed skill name.

    - `skill_id: string`

      The referenced skill ID.

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version: string`

      The concrete skill version installed for this session.

  - `Inline object { description, name, type }`

    A skill installed from an inline ZIP archive.

    - `description: string`

      The installed skill description.

    - `name: string`

      The installed skill name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Skill Param

- `HostedSkillParam = SkillReference { skill_id, type, version }  or Inline { description, name, source, type }`

  A skill installed in an OpenAI-hosted environment.

  - `SkillReference object { skill_id, type, version }`

    References a skill uploaded through the Skills API.

    - `skill_id: string`

      The ID of the skill created through `/v1/skills`.

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version: optional string or null`

      The skill version, a positive integer or `latest`; omission selects the default.

  - `Inline object { description, name, source, type }`

    Supplies a skill ZIP directly in the session request.

    - `description: string`

      The skill description declared in `SKILL.md`.

    - `name: string`

      The skill name declared in `SKILL.md`.

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

      - `data: string`

        Standard-base64 encoded ZIP archive bytes.

      - `media_type: "application/zip"`

        The archive media type, always `application/zip`.

        - `"application/zip"`

          A ZIP archive.

      - `type: "base64"`

        The type of the object. Always `base64`.

        - `"base64"`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Hosted Skill Reference

- `HostedSkillReference object { description, name, skill_id, 2 more }`

  A skill installed from the Skills API.

  - `description: string`

    The installed skill description.

  - `name: string`

    The installed skill name.

  - `skill_id: string`

    The referenced skill ID.

  - `type: "skill_reference"`

    The type of the object. Always `skill_reference`.

    - `"skill_reference"`

  - `version: string`

    The concrete skill version installed for this session.

### Inline Capability Source Param

- `InlineCapabilitySourceParam object { data, media_type, type }`

  Provides ZIP bytes encoded with standard base64.

  - `data: string`

    Standard-base64 encoded ZIP archive bytes.

  - `media_type: "application/zip"`

    The archive media type, always `application/zip`.

    - `"application/zip"`

      A ZIP archive.

  - `type: "base64"`

    The type of the object. Always `base64`.

    - `"base64"`

### Input Content

- `InputContent = InputText { text, type }  or InputImage { image_url, type }`

  User-provided content recorded in a session item.

  - `InputText object { text, type }`

    Text input recorded in a session item.

    - `text: string`

      The text supplied to the agent.

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `InputImage object { image_url, type }`

    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.

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

### Input Content Param

- `InputContentParam = InputText { text, type }  or InputImage { image_url, type }`

  Content included in an input message.

  - `InputText object { text, type }`

    Text input to the model.

    - `text: string`

      The text sent to the model.

    - `type: "input_text"`

      The type of the object. Always `input_text`.

      - `"input_text"`

  - `InputImage object { image_url, type }`

    Image input to the model.

    - `image_url: string`

      The URL of the image sent to the model.

    - `type: "input_image"`

      The type of the object. Always `input_image`.

      - `"input_image"`

### Mcp Transport

- `McpTransport = HTTP { server_url, type }  or Stdio { args, command, cwd, 2 more }`

  The transport used to connect to an MCP server.

  - `HTTP object { server_url, type }`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

  - `Stdio object { args, command, cwd, 2 more }`

    Starts an MCP server as a local process.

    - `args: array of string`

      Arguments passed to the MCP server command.

    - `command: string`

      The command used to start the MCP server.

    - `cwd: string`

      The working directory used to start the MCP server.

    - `env_vars: array of string`

      Environment variable names inherited from the execution environment.

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

### Mcp Transport Param

- `McpTransportParam = HTTP { server_url, type, authorization, headers }  or Stdio { command, cwd, type, 3 more }`

  The transport used to connect to an MCP server.

  - `HTTP object { server_url, type, authorization, headers }`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

    - `authorization: optional string or null`

      The authorization value sent to the MCP server, if any.

    - `headers: optional map[string] or null`

      Additional HTTP headers sent to the MCP server.

  - `Stdio object { command, cwd, type, 3 more }`

    Starts an MCP server as a local process.

    - `command: string`

      The command used to start the MCP server.

    - `cwd: string`

      The working directory used to start the MCP server.

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

    - `args: optional array of string or null`

      Arguments passed to the MCP server command.

    - `env: optional map[string] or null`

      Environment variables set for the MCP server process.

    - `env_vars: optional array of string or null`

      Environment variable names to inherit from the selected execution environment.

### Multi Agent Config

- `MultiAgentConfig object { enabled, max_concurrent_subagents }`

  The resolved configuration for creating and coordinating subagents.

  - `enabled: boolean`

    Whether subagent tools are enabled. Defaults to false.

  - `max_concurrent_subagents: number or null`

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

### Multi Agent Config Param

- `MultiAgentConfigParam object { enabled, max_concurrent_subagents }`

  Explicit configuration for creating and coordinating subagents.

  - `enabled: boolean`

    Whether subagent tools are enabled.

  - `max_concurrent_subagents: optional number`

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

### Output Text

- `OutputText object { text, type }`

  A text content part produced by the agent.

  - `text: string`

    The text produced by the agent.

  - `type: "output_text"`

    The content type. Always `output_text`.

    - `"output_text"`

### Persisted Agent Tool

- `PersistedAgentTool = Function { defer_loading, description, name, 2 more }  or ToolSearch { type }  or ProgrammaticToolCalling { enabled, type }  or 3 more`

  A credential-free tool available to a reusable agent.

  - `Function object { defer_loading, description, name, 2 more }`

    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.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

  - `ToolSearch object { type }`

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

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `ProgrammaticToolCalling object { enabled, type }`

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

  - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

    Tools provided by a remote MCP server without stored credentials.

    - `allowed_tools: array of string or null`

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

    - `connection_origin: "service" or "environment"`

      Where outbound MCP HTTP connections originate.

      - `"service"`

      - `"environment"`

    - `credential_id: string or null`

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

    - `request_metadata: map[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.

    - `transport: PersistedMcpTransport`

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

      - `HTTP object { headers, server_url, type }`

        Connects to an MCP server over HTTP.

        - `headers: map[string]`

          Non-secret HTTP headers sent to the MCP server.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

      - `Stdio object { args, command, cwd, 2 more }`

        Starts an MCP server as a local process.

        - `args: array of string`

          Arguments passed to the MCP server command.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `env_vars: array of string`

          Environment variable names inherited from the execution environment.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

  - `WebSearch object { allowed_domains, context_size, location, 2 more }`

    Web search.

    - `allowed_domains: array of string or null`

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

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

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: object { city, country, region, timezone }  or null`

      Approximate location used to localize search results, if provided.

      - `city: string or null`

        The city name.

      - `country: string or null`

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

      - `region: string or null`

        The region or state name.

      - `timezone: string or null`

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

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

      The source used for web search results.

      - `"disabled"`

      - `"cached"`

      - `"live"`

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

  - `ComputerUse object { include_screenshots, type }`

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

### Persisted Agent Tool Param

- `PersistedAgentToolParam = Function { description, name, parameters, 2 more }  or ToolSearch { type }  or ProgrammaticToolCalling { type, enabled }  or 3 more`

  A tool that can be stored on a reusable agent without session credentials.

  - `Function object { description, name, parameters, 2 more }`

    A function defined by the application.

    - `description: string`

      A description of what the function does.

    - `name: string`

      The name of the function.

    - `parameters: map[unknown]`

      A JSON Schema object describing the function's arguments.

    - `type: "function"`

      The type of the object. Always `function`.

      - `"function"`

    - `defer_loading: optional boolean`

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

  - `ToolSearch object { type }`

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

    - `type: "tool_search"`

      The type of the object. Always `tool_search`.

      - `"tool_search"`

  - `ProgrammaticToolCalling object { type, enabled }`

    Enables calling tools from model-generated code.

    - `type: "programmatic_tool_calling"`

      The type of the object. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

    - `enabled: optional boolean`

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

  - `Mcp object { server_label, transport, type, 5 more }`

    Tools provided by a remote MCP server without stored credentials.

    - `server_label: string`

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

    - `transport: PersistedMcpTransportParam`

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

      - `HTTP object { server_url, type, headers }`

        Connects to an MCP server over HTTP.

        - `server_url: string`

          The URL of the MCP server.

        - `type: "http"`

          The type of the object. Always `http`.

          - `"http"`

        - `headers: optional map[string] or null`

          Non-secret HTTP headers sent to the MCP server.

      - `Stdio object { command, cwd, type, 2 more }`

        Starts an MCP server as a local process.

        - `command: string`

          The command used to start the MCP server.

        - `cwd: string`

          The working directory used to start the MCP server.

        - `type: "stdio"`

          The type of the object. Always `stdio`.

          - `"stdio"`

        - `args: optional array of string or null`

          Arguments passed to the MCP server command.

        - `env_vars: optional array of string or null`

          Environment variable names to inherit from the selected execution environment.

    - `type: "mcp"`

      The type of the object. Always `mcp`.

      - `"mcp"`

    - `allowed_tools: optional array of string or null`

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

    - `connection_origin: optional "service" or "environment" or null`

      Selects where outbound MCP HTTP connections originate.

      - `"service"`

        Uses the Managed Agents service network.

      - `"environment"`

        Uses the session's execution environment.

    - `credential_id: optional string or null`

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

    - `request_metadata: optional map[unknown] or null`

      Metadata included with requests to this MCP server.

    - `required: optional boolean`

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

  - `WebSearch object { type, allowed_domains, context_size, 2 more }`

    Web search.

    - `type: "web_search"`

      The type of the object. Always `web_search`.

      - `"web_search"`

    - `allowed_domains: optional array of string or null`

      Domains the search may include.

    - `context_size: optional "low" or "medium" or "high" or null`

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

      - `"low"`

      - `"medium"`

      - `"high"`

    - `location: optional object { city, country, region, timezone }  or null`

      Approximate location used to localize search results.

      - `city: optional string or null`

        The city name.

      - `country: optional string or null`

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

      - `region: optional string or null`

        The region or state name.

      - `timezone: optional string or null`

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

    - `mode: optional "disabled" or "cached" or "live" or 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.

  - `ComputerUse object { type, include_screenshots }`

    Browser use in an OpenAI-hosted session.

    - `type: "computer_use"`

      The type of the object. Always `computer_use`.

      - `"computer_use"`

    - `include_screenshots: optional boolean`

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

### Persisted Mcp Transport

- `PersistedMcpTransport = HTTP { headers, server_url, type }  or Stdio { args, command, cwd, 2 more }`

  A credential-free transport used to connect to an MCP server.

  - `HTTP object { headers, server_url, type }`

    Connects to an MCP server over HTTP.

    - `headers: map[string]`

      Non-secret HTTP headers sent to the MCP server.

    - `server_url: string`

      The URL of the MCP server.

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

  - `Stdio object { args, command, cwd, 2 more }`

    Starts an MCP server as a local process.

    - `args: array of string`

      Arguments passed to the MCP server command.

    - `command: string`

      The command used to start the MCP server.

    - `cwd: string`

      The working directory used to start the MCP server.

    - `env_vars: array of string`

      Environment variable names inherited from the execution environment.

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

### Persisted Mcp Transport Param

- `PersistedMcpTransportParam = HTTP { server_url, type, headers }  or Stdio { command, cwd, type, 2 more }`

  A credential-free transport used to connect to an MCP server.

  - `HTTP object { server_url, type, headers }`

    Connects to an MCP server over HTTP.

    - `server_url: string`

      The URL of the MCP server.

    - `type: "http"`

      The type of the object. Always `http`.

      - `"http"`

    - `headers: optional map[string] or null`

      Non-secret HTTP headers sent to the MCP server.

  - `Stdio object { command, cwd, type, 2 more }`

    Starts an MCP server as a local process.

    - `command: string`

      The command used to start the MCP server.

    - `cwd: string`

      The working directory used to start the MCP server.

    - `type: "stdio"`

      The type of the object. Always `stdio`.

      - `"stdio"`

    - `args: optional array of string or null`

      Arguments passed to the MCP server command.

    - `env_vars: optional array of string or null`

      Environment variable names to inherit from the selected execution environment.

### Session Error

- `SessionError object { code, message, param, type }`

  An error payload with the same public fields as Responses API streaming errors.

  - `code: string or null`

    The machine-readable error code, if any.

  - `message: string`

    A customer-safe explanation of the error.

  - `param: string or null`

    The request parameter associated with the error, if any.

  - `type: string`

    The error type.

### Session Turn Error

- `SessionTurnError object { code, message }`

  A customer-safe error describing why a session request failed.

  - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

    A stable, machine-readable failure category.

    - `"context_length_exceeded"`

      The request exceeds the model's context window.

    - `"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.

### Setup Command Param

- `SetupCommandParam object { command, cwd }`

  A confidential setup command executed before the hosted agent starts.

  - `command: string`

    The shell command to execute.

  - `cwd: optional string or null`

    The absolute working directory. Defaults to `/workspace`.

### Subagent

- `Subagent object { id, closed_at, instructions, 6 more }`

  A subagent created within a session.

  - `id: string`

    The ID of the subagent.

  - `closed_at: number or null`

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

  - `instructions: array of AgentContent or null`

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

    - `OutputText object { text, type }`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContent object { encrypted_content, type }`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string or null`

    The runner-assigned nickname, or null when unavailable.

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

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

  - `session_id: string`

    The ID of the session that owns the subagent.

  - `status: "active" or "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 object { text, type }`

  A reasoning summary content part.

  - `text: string`

    The reasoning summary text.

  - `type: "summary_text"`

    The content type. Always `summary_text`.

    - `"summary_text"`

### Text Format

- `TextFormat = Text { type }  or JSONSchema { schema, type }`

  The effective output format for generated text.

  - `Text object { type }`

    Generates ordinary text without a structured-output constraint.

    - `type: "text"`

      The type of the object. Always `text`.

      - `"text"`

  - `JSONSchema object { schema, type }`

    Constrains generated text to a JSON Schema.

    - `schema: map[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 = Text { type }  or JSONSchema { schema, type }`

  The output format for generated text.

  - `Text object { type }`

    Generates ordinary text without a structured-output constraint.

    - `type: "text"`

      The type of the object. Always `text`.

      - `"text"`

  - `JSONSchema object { schema, type }`

    Constrains generated text to a JSON Schema.

    - `schema: map[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 object { input_tokens, input_tokens_details, output_tokens, 2 more }`

  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.

  - `input_tokens_details: object { cached_tokens }`

    A breakdown of the agent's input token usage.

    - `cached_tokens: number`

      The number of input tokens retrieved from the prompt cache.

  - `output_tokens: number`

    The number of output tokens generated by the agent.

  - `output_tokens_details: object { reasoning_tokens }`

    A breakdown of the agent's output token usage.

    - `reasoning_tokens: number`

      The number of output tokens used for reasoning.

  - `total_tokens: number`

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

### Web Search Action

- `WebSearchAction = Search { queries, query, type }  or OpenPage { type, url }  or FindInPage { pattern, type, url }  or Other { type }`

  An action performed by the web search tool.

  - `Search object { queries, query, type }`

    A search query or group of search queries.

    - `queries: array of string or null`

      The search queries, when multiple queries were used.

    - `query: string or null`

      The search query, when a single query was used.

    - `type: "search"`

      The type of the object. Always `search`.

      - `"search"`

  - `OpenPage object { type, url }`

    Opens a web page.

    - `type: "open_page"`

      The type of the object. Always `open_page`.

      - `"open_page"`

    - `url: string or null`

      The URL of the page that was opened.

  - `FindInPage object { pattern, type, url }`

    Finds text within a web page.

    - `pattern: string or null`

      The text pattern that was searched for.

    - `type: "find_in_page"`

      The type of the object. Always `find_in_page`.

      - `"find_in_page"`

    - `url: string or null`

      The URL of the page that was searched.

  - `Other object { type }`

    Another web search action.

    - `type: "other"`

      The type of the object. Always `other`.

      - `"other"`

# Environments

## Create an agent environment

**post** `/agents/environments`

Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.

### Header Parameters

- `"Idempotency-Key": optional string`

### Body Parameters

- `environment: object { type, capability_directories, desktop, 8 more }`

  The required hosting type and its configuration.

  - `type: "openai_hosted"`

    The type of the object. Always `openai_hosted`.

    - `"openai_hosted"`

  - `capability_directories: optional array of string or null`

    Directories that contain capabilities exposed to the agent. Defaults to an empty list.

  - `desktop: optional object { enabled }  or 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: optional map[string] or null`

    Environment variables made available to the agent.

  - `environment_template_id: optional string`

    A reusable hosted template applied before inline configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

  - `files: optional array of HostedEnvironmentFileParam or null`

    Files available before the agent starts. Defaults to an empty list.

    - `FileID object { file_id, path, type }`

      A file previously uploaded through the OpenAI Files API.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The absolute destination path inside `/workspace`.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { data, path, type }`

      A file supplied directly as standard-base64 data.

      - `data: string`

        The standard-base64-encoded file contents.

      - `path: string`

        The absolute destination path inside `/workspace`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `network: optional object { access, allowed_domains, blocked_domains }  or null`

    Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

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

      The environment's network access mode.

      - `"enabled"`

        Allows unrestricted network access.

      - `"disabled"`

        Disables network access.

      - `"restricted"`

        Applies the configured domain restrictions.

    - `allowed_domains: optional array of string or null`

      Domains the environment may access when network access is restricted.

    - `blocked_domains: optional array of string or 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.

  - `packages: optional object { npm, python, system }  or null`

    Packages to install in the environment. Defaults to empty package lists.

    - `npm: optional array of string or null`

      npm packages to install globally. Defaults to an empty list.

    - `python: optional array of string or null`

      Python packages to install. Defaults to an empty list.

    - `system: optional array of string or null`

      System packages to install. Defaults to an empty list.

  - `plugins: optional array of HostedPluginParam or null`

    Plugins provided as inline ZIP archives. Defaults to an empty list.

    - `description: string`

      The plugin description declared in `.codex-plugin/plugin.json`.

    - `name: string`

      The plugin name declared in `.codex-plugin/plugin.json`.

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

      - `data: string`

        Standard-base64 encoded ZIP archive bytes.

      - `media_type: "application/zip"`

        The archive media type, always `application/zip`.

        - `"application/zip"`

          A ZIP archive.

      - `type: "base64"`

        The type of the object. Always `base64`.

        - `"base64"`

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `setup_commands: optional array of SetupCommandParam or null`

    Ordered, confidential setup commands. Command bodies are never returned.

    - `command: string`

      The shell command to execute.

    - `cwd: optional string or null`

      The absolute working directory. Defaults to `/workspace`.

  - `skills: optional array of HostedSkillParam or null`

    Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

    - `SkillReference object { skill_id, type, version }`

      References a skill uploaded through the Skills API.

      - `skill_id: string`

        The ID of the skill created through `/v1/skills`.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: optional string or null`

        The skill version, a positive integer or `latest`; omission selects the default.

    - `Inline object { description, name, source, type }`

      Supplies a skill ZIP directly in the session request.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

- `vault_ids: optional array of string or null`

  The IDs of up to 10 vaults made available to an OpenAI-hosted environment.

### Returns

- `EnvironmentInfo object { id, files, object, 4 more }`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

  - `files: array of HostedEnvironmentFile`

    Files installed in the environment, without their contents.

    - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

      A file copied from the OpenAI Files API.

      - `id: string`

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

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { id, path, size_bytes, type }`

      A file supplied inline when the session was created.

      - `id: string`

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

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: array of HostedPlugin`

    Plugins installed in the environment, without their archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of HostedSkill`

    Skills installed in the environment, without their archive contents.

    - `HostedSkillReference object { description, name, skill_id, 2 more }`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

    - `Inline object { description, name, type }`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" or "ready" or "connected" or 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" or "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

### Example

```http
curl https://api.openai.com/v1/agents/environments \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "environment": {
            "type": "openai_hosted"
          }
        }'
```

#### Response

```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

**get** `/agents/environments`

Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta.

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

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

- `order: optional "asc" or "desc"`

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

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

- `type: optional "openai_hosted"`

  The hosting type to list. Defaults to `openai_hosted`.

  - `"openai_hosted"`

### Returns

- `data: array of EnvironmentInfo`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the environment.

  - `files: array of HostedEnvironmentFile`

    Files installed in the environment, without their contents.

    - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

      A file copied from the OpenAI Files API.

      - `id: string`

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

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { id, path, size_bytes, type }`

      A file supplied inline when the session was created.

      - `id: string`

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

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: array of HostedPlugin`

    Plugins installed in the environment, without their archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of HostedSkill`

    Skills installed in the environment, without their archive contents.

    - `HostedSkillReference object { description, name, skill_id, 2 more }`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

    - `Inline object { description, name, type }`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" or "ready" or "connected" or 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" or "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/environments \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `environment_id: string`

### Returns

- `EnvironmentInfo object { id, files, object, 4 more }`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

  - `files: array of HostedEnvironmentFile`

    Files installed in the environment, without their contents.

    - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

      A file copied from the OpenAI Files API.

      - `id: string`

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

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { id, path, size_bytes, type }`

      A file supplied inline when the session was created.

      - `id: string`

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

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: array of HostedPlugin`

    Plugins installed in the environment, without their archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of HostedSkill`

    Skills installed in the environment, without their archive contents.

    - `HostedSkillReference object { description, name, skill_id, 2 more }`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

    - `Inline object { description, name, type }`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" or "ready" or "connected" or 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" or "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

### Example

```http
curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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 object { id, files, object, 4 more }`

  Safe metadata for a first-class execution environment.

  - `id: string`

    The ID of the environment.

  - `files: array of HostedEnvironmentFile`

    Files installed in the environment, without their contents.

    - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

      A file copied from the OpenAI Files API.

      - `id: string`

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

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { id, path, size_bytes, type }`

      A file supplied inline when the session was created.

      - `id: string`

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

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded file size in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `object: "agent.environment"`

    The object type. Always `agent.environment`.

    - `"agent.environment"`

  - `plugins: array of HostedPlugin`

    Plugins installed in the environment, without their archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of HostedSkill`

    Skills installed in the environment, without their archive contents.

    - `HostedSkillReference object { description, name, skill_id, 2 more }`

      A skill installed from the Skills API.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string`

        The concrete skill version installed for this session.

    - `Inline object { description, name, type }`

      A skill installed from an inline ZIP archive.

      - `description: string`

        The installed skill description.

      - `name: string`

        The installed skill name.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `status: "pending" or "ready" or "connected" or 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" or "self_hosted"`

    Whether the environment is hosted by OpenAI or by the application.

    - `"openai_hosted"`

    - `"self_hosted"`

# Files

## Write an agent environment file

**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).

### Path Parameters

- `environment_id: string`

### Body Parameters

- `hosted_environment_file_param: HostedEnvironmentFileParam`

  A file materialized in an OpenAI-hosted execution environment.

  - `FileID object { file_id, path, type }`

    A file previously uploaded through the OpenAI Files API.

    - `file_id: string`

      The ID of the uploaded file.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `Inline object { data, path, type }`

    A file supplied directly as standard-base64 data.

    - `data: string`

      The standard-base64-encoded file contents.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Returns

- `EnvironmentFile object { environment_id, object, path, size_bytes }`

  A live file in an execution environment.

  - `environment_id: string`

    The ID of the environment containing this file.

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

  - `size_bytes: number`

    The file size in bytes.

### Example

```http
curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID/files \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "environment_id": "environment_id",
  "object": "agent.environment.file",
  "path": "path",
  "size_bytes": 0
}
```

## List agent environment files

**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).

### Path Parameters

- `environment_id: string`

### Query Parameters

- `limit: optional number or null`

  The maximum number of files to return, between 1 and 100.

- `order: optional "asc" or "desc"`

  Sort by case-sensitive path components. Defaults to descending.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

- `page: optional string`

  The opaque token from the previous page. Keep the same path, order, and limit.

- `path: optional string or null`

  Restrict the listing to this absolute workspace directory.

### Returns

- `data: array of EnvironmentFile`

  Files available on the current page.

  - `environment_id: string`

    The ID of the environment containing this file.

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

  - `size_bytes: number`

    The file size in bytes.

- `has_more: boolean`

  Whether more files follow this page.

- `next: string or null`

  The opaque cursor to use when requesting the next page, if any.

- `object: "page"`

  The object type. Always `page`.

  - `"page"`

### Example

```http
curl https://api.openai.com/v1/agents/environments/$ENVIRONMENT_ID/files \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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 object { environment_id, object, path, size_bytes }`

  A live file in an execution environment.

  - `environment_id: string`

    The ID of the environment containing this file.

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

  - `size_bytes: number`

    The file size in bytes.

# Templates

## Create an agent environment template

**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).

### Body Parameters

- `capability_directories: optional array of string or null`

  Directories that contain capabilities exposed to the agent. Defaults to an empty list.

- `desktop: optional object { enabled }  or 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: optional map[string] or null`

  Environment variables made available to the agent.

- `files: optional array of HostedEnvironmentFileParam or null`

  Files available before the agent starts. Defaults to an empty list.

  - `FileID object { file_id, path, type }`

    A file previously uploaded through the OpenAI Files API.

    - `file_id: string`

      The ID of the uploaded file.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `Inline object { data, path, type }`

    A file supplied directly as standard-base64 data.

    - `data: string`

      The standard-base64-encoded file contents.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

- `name: optional string or null`

  An optional human-readable display name for the template.

- `network: optional object { access, allowed_domains, blocked_domains }  or null`

  Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

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

    The environment's network access mode.

    - `"enabled"`

      Allows unrestricted network access.

    - `"disabled"`

      Disables network access.

    - `"restricted"`

      Applies the configured domain restrictions.

  - `allowed_domains: optional array of string or null`

    Domains the environment may access when network access is restricted.

  - `blocked_domains: optional array of string or 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.

- `packages: optional object { npm, python, system }  or null`

  Packages to install in the environment. Defaults to empty package lists.

  - `npm: optional array of string or null`

    npm packages to install globally. Defaults to an empty list.

  - `python: optional array of string or null`

    Python packages to install. Defaults to an empty list.

  - `system: optional array of string or null`

    System packages to install. Defaults to an empty list.

- `plugins: optional array of HostedPluginParam or null`

  Plugins provided as inline ZIP archives. Defaults to an empty list.

  - `description: string`

    The plugin description declared in `.codex-plugin/plugin.json`.

  - `name: string`

    The plugin name declared in `.codex-plugin/plugin.json`.

  - `source: InlineCapabilitySourceParam`

    Provides ZIP bytes encoded with standard base64.

    - `data: string`

      Standard-base64 encoded ZIP archive bytes.

    - `media_type: "application/zip"`

      The archive media type, always `application/zip`.

      - `"application/zip"`

        A ZIP archive.

    - `type: "base64"`

      The type of the object. Always `base64`.

      - `"base64"`

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

- `setup_commands: optional array of SetupCommandParam or null`

  Ordered, confidential setup commands. Command bodies are never returned.

  - `command: string`

    The shell command to execute.

  - `cwd: optional string or null`

    The absolute working directory. Defaults to `/workspace`.

- `skills: optional array of HostedSkillParam or null`

  Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

  - `SkillReference object { skill_id, type, version }`

    References a skill uploaded through the Skills API.

    - `skill_id: string`

      The ID of the skill created through `/v1/skills`.

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version: optional string or null`

      The skill version, a positive integer or `latest`; omission selects the default.

  - `Inline object { description, name, source, type }`

    Supplies a skill ZIP directly in the session request.

    - `description: string`

      The skill description declared in `SKILL.md`.

    - `name: string`

      The skill name declared in `SKILL.md`.

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Returns

- `EnvironmentTemplate object { id, capability_directories, created_at, 9 more }`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

  - `capability_directories: array of string`

    Directories that expose capabilities to the agent.

  - `created_at: number`

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

  - `desktop: object { enabled }`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

  - `files: array of FileID { file_id, path, type }  or Inline { path, size_bytes, type }`

    Safe file metadata, excluding contents and session-scoped file IDs.

    - `FileID object { file_id, path, type }`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { path, size_bytes, type }`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string or null`

    An optional human-readable display name for the template.

  - `network: object { access, allowed_domains }`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" or "disabled" or "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 of string`

      Domains the environment may access when network access is restricted.

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: object { npm, python, system }`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: array of string`

      npm packages installed globally in the environment.

    - `python: array of string`

      Python packages installed in the environment.

    - `system: array of string`

      System packages installed in the environment.

  - `plugins: array of HostedPlugin`

    Safe plugin metadata, excluding inline archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of SkillReference { skill_id, type, version }  or Inline { description, name, type }`

    Safe skill metadata, preserving unresolved version selectors.

    - `SkillReference object { skill_id, type, version }`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string or null`

        The requested version selector, including `latest`.

    - `Inline object { description, name, type }`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents/environments/templates \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "desktop": {
    "enabled": true
  },
  "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
}
```

## Delete an agent environment template

**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).

### Path Parameters

- `environment_template_id: string`

### Returns

- `EnvironmentTemplateDeleted object { id, deleted, object }`

  A deleted reusable environment template.

  - `id: string`

    The ID of the deleted environment template.

  - `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

```http
curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

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

## List agent environment templates

**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).

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

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

- `order: optional "asc" or "desc"`

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

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of EnvironmentTemplate`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the reusable environment template.

  - `capability_directories: array of string`

    Directories that expose capabilities to the agent.

  - `created_at: number`

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

  - `desktop: object { enabled }`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

  - `files: array of FileID { file_id, path, type }  or Inline { path, size_bytes, type }`

    Safe file metadata, excluding contents and session-scoped file IDs.

    - `FileID object { file_id, path, type }`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { path, size_bytes, type }`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string or null`

    An optional human-readable display name for the template.

  - `network: object { access, allowed_domains }`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" or "disabled" or "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 of string`

      Domains the environment may access when network access is restricted.

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: object { npm, python, system }`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: array of string`

      npm packages installed globally in the environment.

    - `python: array of string`

      Python packages installed in the environment.

    - `system: array of string`

      System packages installed in the environment.

  - `plugins: array of HostedPlugin`

    Safe plugin metadata, excluding inline archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of SkillReference { skill_id, type, version }  or Inline { description, name, type }`

    Safe skill metadata, preserving unresolved version selectors.

    - `SkillReference object { skill_id, type, version }`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string or null`

        The requested version selector, including `latest`.

    - `Inline object { description, name, type }`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

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

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/environments/templates \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "capability_directories": [
        "string"
      ],
      "created_at": 0,
      "desktop": {
        "enabled": true
      },
      "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
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent environment template

**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).

### Path Parameters

- `environment_template_id: string`

### Returns

- `EnvironmentTemplate object { id, capability_directories, created_at, 9 more }`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

  - `capability_directories: array of string`

    Directories that expose capabilities to the agent.

  - `created_at: number`

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

  - `desktop: object { enabled }`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

  - `files: array of FileID { file_id, path, type }  or Inline { path, size_bytes, type }`

    Safe file metadata, excluding contents and session-scoped file IDs.

    - `FileID object { file_id, path, type }`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { path, size_bytes, type }`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string or null`

    An optional human-readable display name for the template.

  - `network: object { access, allowed_domains }`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" or "disabled" or "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 of string`

      Domains the environment may access when network access is restricted.

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: object { npm, python, system }`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: array of string`

      npm packages installed globally in the environment.

    - `python: array of string`

      Python packages installed in the environment.

    - `system: array of string`

      System packages installed in the environment.

  - `plugins: array of HostedPlugin`

    Safe plugin metadata, excluding inline archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of SkillReference { skill_id, type, version }  or Inline { description, name, type }`

    Safe skill metadata, preserving unresolved version selectors.

    - `SkillReference object { skill_id, type, version }`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string or null`

        The requested version selector, including `latest`.

    - `Inline object { description, name, type }`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "desktop": {
    "enabled": true
  },
  "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
}
```

## Update an agent environment template

**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).

### Path Parameters

- `environment_template_id: string`

### Body Parameters

- `capability_directories: optional array of string or null`

  Directories that expose capabilities to the agent.

- `desktop: optional object { enabled }  or null`

  Replacement desktop configuration, or null to disable the desktop.

  - `enabled: boolean`

    Whether to provision the desktop and its browser proxy.

- `env: optional map[string] or null`

  Replacement confidential environment values.

- `files: optional array of HostedEnvironmentFileParam or null`

  Replacement file configuration materialized for each new session.

  - `FileID object { file_id, path, type }`

    A file previously uploaded through the OpenAI Files API.

    - `file_id: string`

      The ID of the uploaded file.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "file_id"`

      The type of the object. Always `file_id`.

      - `"file_id"`

  - `Inline object { data, path, type }`

    A file supplied directly as standard-base64 data.

    - `data: string`

      The standard-base64-encoded file contents.

    - `path: string`

      The absolute destination path inside `/workspace`.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

- `name: optional string or null`

  A replacement human-readable display name, or `null` to clear the name.

- `network: optional object { access, allowed_domains, blocked_domains }  or null`

  Network access available after setup completes. Omit to preserve the current policy, or pass `null` to reset to the default policy.

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

    The environment's network access mode.

    - `"enabled"`

      Allows unrestricted network access.

    - `"disabled"`

      Disables network access.

    - `"restricted"`

      Applies the configured domain restrictions.

  - `allowed_domains: optional array of string or null`

    Domains the environment may access when network access is restricted.

  - `blocked_domains: optional array of string or 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.

- `packages: optional object { npm, python, system }  or null`

  Packages installed before the runtime network policy applies.

  - `npm: optional array of string or null`

    npm packages to install globally. Defaults to an empty list.

  - `python: optional array of string or null`

    Python packages to install. Defaults to an empty list.

  - `system: optional array of string or null`

    System packages to install. Defaults to an empty list.

- `plugins: optional array of HostedPluginParam or null`

  Replacement plugin configuration installed for each new session.

  - `description: string`

    The plugin description declared in `.codex-plugin/plugin.json`.

  - `name: string`

    The plugin name declared in `.codex-plugin/plugin.json`.

  - `source: InlineCapabilitySourceParam`

    Provides ZIP bytes encoded with standard base64.

    - `data: string`

      Standard-base64 encoded ZIP archive bytes.

    - `media_type: "application/zip"`

      The archive media type, always `application/zip`.

      - `"application/zip"`

        A ZIP archive.

    - `type: "base64"`

      The type of the object. Always `base64`.

      - `"base64"`

  - `type: "inline"`

    The type of the object. Always `inline`.

    - `"inline"`

- `setup_commands: optional array of SetupCommandParam or null`

  Replacement confidential setup commands, never included in returned resources.

  - `command: string`

    The shell command to execute.

  - `cwd: optional string or null`

    The absolute working directory. Defaults to `/workspace`.

- `skills: optional array of HostedSkillParam or null`

  Replacement skill configuration installed for each new session.

  - `SkillReference object { skill_id, type, version }`

    References a skill uploaded through the Skills API.

    - `skill_id: string`

      The ID of the skill created through `/v1/skills`.

    - `type: "skill_reference"`

      The type of the object. Always `skill_reference`.

      - `"skill_reference"`

    - `version: optional string or null`

      The skill version, a positive integer or `latest`; omission selects the default.

  - `Inline object { description, name, source, type }`

    Supplies a skill ZIP directly in the session request.

    - `description: string`

      The skill description declared in `SKILL.md`.

    - `name: string`

      The skill name declared in `SKILL.md`.

    - `source: InlineCapabilitySourceParam`

      Provides ZIP bytes encoded with standard base64.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

### Returns

- `EnvironmentTemplate object { id, capability_directories, created_at, 9 more }`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

  - `capability_directories: array of string`

    Directories that expose capabilities to the agent.

  - `created_at: number`

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

  - `desktop: object { enabled }`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

  - `files: array of FileID { file_id, path, type }  or Inline { path, size_bytes, type }`

    Safe file metadata, excluding contents and session-scoped file IDs.

    - `FileID object { file_id, path, type }`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { path, size_bytes, type }`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string or null`

    An optional human-readable display name for the template.

  - `network: object { access, allowed_domains }`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" or "disabled" or "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 of string`

      Domains the environment may access when network access is restricted.

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: object { npm, python, system }`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: array of string`

      npm packages installed globally in the environment.

    - `python: array of string`

      Python packages installed in the environment.

    - `system: array of string`

      System packages installed in the environment.

  - `plugins: array of HostedPlugin`

    Safe plugin metadata, excluding inline archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of SkillReference { skill_id, type, version }  or Inline { description, name, type }`

    Safe skill metadata, preserving unresolved version selectors.

    - `SkillReference object { skill_id, type, version }`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string or null`

        The requested version selector, including `latest`.

    - `Inline object { description, name, type }`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

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

### Example

```http
curl https://api.openai.com/v1/agents/environments/templates/$ENVIRONMENT_TEMPLATE_ID \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "capability_directories": [
    "string"
  ],
  "created_at": 0,
  "desktop": {
    "enabled": true
  },
  "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
}
```

## Domain Types

### Environment Template

- `EnvironmentTemplate object { id, capability_directories, created_at, 9 more }`

  Reusable configuration that provisions a fresh OpenAI-hosted environment for each session.

  - `id: string`

    The ID of the reusable environment template.

  - `capability_directories: array of string`

    Directories that expose capabilities to the agent.

  - `created_at: number`

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

  - `desktop: object { enabled }`

    Desktop configuration for each OpenAI-hosted environment.

    - `enabled: boolean`

      Whether the environment provisions a desktop and browser proxy.

  - `files: array of FileID { file_id, path, type }  or Inline { path, size_bytes, type }`

    Safe file metadata, excluding contents and session-scoped file IDs.

    - `FileID object { file_id, path, type }`

      A project-scoped Files API reference resolved separately for each session.

      - `file_id: string`

        The ID of the uploaded file.

      - `path: string`

        The file's absolute path inside the environment.

      - `type: "file_id"`

        The type of the object. Always `file_id`.

        - `"file_id"`

    - `Inline object { path, size_bytes, type }`

      Metadata for confidential inline file contents.

      - `path: string`

        The file's absolute path inside the environment.

      - `size_bytes: number`

        The decoded size of the inline file in bytes.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `name: string or null`

    An optional human-readable display name for the template.

  - `network: object { access, allowed_domains }`

    Runtime network access for each OpenAI-hosted environment.

    - `access: "enabled" or "disabled" or "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 of string`

      Domains the environment may access when network access is restricted.

  - `object: "agent.environment.template"`

    The object type. Always `agent.environment.template`.

    - `"agent.environment.template"`

  - `packages: object { npm, python, system }`

    Packages installed in each fresh OpenAI-hosted environment.

    - `npm: array of string`

      npm packages installed globally in the environment.

    - `python: array of string`

      Python packages installed in the environment.

    - `system: array of string`

      System packages installed in the environment.

  - `plugins: array of HostedPlugin`

    Safe plugin metadata, excluding inline archive contents.

    - `description: string`

      The installed plugin description.

    - `name: string`

      The installed plugin name.

    - `type: "inline"`

      The type of the object. Always `inline`.

      - `"inline"`

  - `skills: array of SkillReference { skill_id, type, version }  or Inline { description, name, type }`

    Safe skill metadata, preserving unresolved version selectors.

    - `SkillReference object { skill_id, type, version }`

      A skill resolved afresh from the Skills API whenever a session starts.

      - `skill_id: string`

        The referenced skill ID.

      - `type: "skill_reference"`

        The type of the object. Always `skill_reference`.

        - `"skill_reference"`

      - `version: string or null`

        The requested version selector, including `latest`.

    - `Inline object { description, name, type }`

      Safe metadata for an inline skill archive.

      - `description: string`

        The skill description declared in `SKILL.md`.

      - `name: string`

        The skill name declared in `SKILL.md`.

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

  - `updated_at: number`

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

### Environment Template Deleted

- `EnvironmentTemplateDeleted object { id, deleted, object }`

  A deleted reusable environment template.

  - `id: string`

    The ID of the deleted environment template.

  - `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

**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).

### Body Parameters

- `environment: EnvironmentParam`

  An inline execution environment or a reference to an environment template.

  - `None object { type }`

    Runs the agent without an execution environment.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `OpenAIHosted object { type, capability_directories, container_size, 10 more }`

    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: optional array of string or null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

    - `container_size: optional "small" or "medium" or "large"`

      The hosted container size. Omission selects the medium tier.

      - `"small"`

      - `"medium"`

      - `"large"`

    - `desktop: optional object { enabled }  or 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: optional map[string] or null`

      Environment variables made available to the agent.

    - `environment_id: optional string`

      An existing prewarmed environment. Cannot be combined with a template or inline configuration.

    - `environment_template_id: optional string`

      A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

    - `files: optional array of HostedEnvironmentFileParam or null`

      Files available before the agent starts. Defaults to an empty list.

      - `FileID object { file_id, path, type }`

        A file previously uploaded through the OpenAI Files API.

        - `file_id: string`

          The ID of the uploaded file.

        - `path: string`

          The absolute destination path inside `/workspace`.

        - `type: "file_id"`

          The type of the object. Always `file_id`.

          - `"file_id"`

      - `Inline object { data, path, type }`

        A file supplied directly as standard-base64 data.

        - `data: string`

          The standard-base64-encoded file contents.

        - `path: string`

          The absolute destination path inside `/workspace`.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

    - `network: optional object { access, allowed_domains, blocked_domains }  or null`

      Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

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

        The environment's network access mode.

        - `"enabled"`

          Allows unrestricted network access.

        - `"disabled"`

          Disables network access.

        - `"restricted"`

          Applies the configured domain restrictions.

      - `allowed_domains: optional array of string or null`

        Domains the environment may access when network access is restricted.

      - `blocked_domains: optional array of string or 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.

    - `packages: optional object { npm, python, system }  or null`

      Packages to install in the environment. Defaults to empty package lists.

      - `npm: optional array of string or null`

        npm packages to install globally. Defaults to an empty list.

      - `python: optional array of string or null`

        Python packages to install. Defaults to an empty list.

      - `system: optional array of string or null`

        System packages to install. Defaults to an empty list.

    - `plugins: optional array of HostedPluginParam or null`

      Plugins provided as inline ZIP archives. Defaults to an empty list.

      - `description: string`

        The plugin description declared in `.codex-plugin/plugin.json`.

      - `name: string`

        The plugin name declared in `.codex-plugin/plugin.json`.

      - `source: InlineCapabilitySourceParam`

        Provides ZIP bytes encoded with standard base64.

        - `data: string`

          Standard-base64 encoded ZIP archive bytes.

        - `media_type: "application/zip"`

          The archive media type, always `application/zip`.

          - `"application/zip"`

            A ZIP archive.

        - `type: "base64"`

          The type of the object. Always `base64`.

          - `"base64"`

      - `type: "inline"`

        The type of the object. Always `inline`.

        - `"inline"`

    - `setup_commands: optional array of SetupCommandParam or null`

      Ordered, confidential setup commands. Command bodies are never returned.

      - `command: string`

        The shell command to execute.

      - `cwd: optional string or null`

        The absolute working directory. Defaults to `/workspace`.

    - `skills: optional array of HostedSkillParam or null`

      Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

      - `SkillReference object { skill_id, type, version }`

        References a skill uploaded through the Skills API.

        - `skill_id: string`

          The ID of the skill created through `/v1/skills`.

        - `type: "skill_reference"`

          The type of the object. Always `skill_reference`.

          - `"skill_reference"`

        - `version: optional string or null`

          The skill version, a positive integer or `latest`; omission selects the default.

      - `Inline object { description, name, source, type }`

        Supplies a skill ZIP directly in the session request.

        - `description: string`

          The skill description declared in `SKILL.md`.

        - `name: string`

          The skill name declared in `SKILL.md`.

        - `source: InlineCapabilitySourceParam`

          Provides ZIP bytes encoded with standard base64.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

  - `SelfHosted object { type, workspace_directory, capability_directories }`

    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.

    - `capability_directories: optional array of string or null`

      Directories that contain capabilities exposed to the agent. Defaults to an empty list.

- `agent: optional object { instructions, model, multi_agent, 4 more }`

  Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required.

  - `instructions: optional string or null`

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

  - `model: optional string`

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

  - `multi_agent: optional MultiAgentConfigParam or null`

    Configuration for creating and coordinating subagents.

    - `enabled: boolean`

      Whether subagent tools are enabled.

    - `max_concurrent_subagents: optional number`

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

  - `reasoning: optional AgentReasoningParam or null`

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

    - `effort: optional "none" or "minimal" or "low" or 4 more or null`

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

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

    - `summary: optional "concise" or "detailed" or "auto" or 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: optional "auto" or "default" or "flex" or 3 more or 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: optional AgentTextParam or null`

    Configuration for text generated by the agent.

    - `format: optional TextFormatParam or null`

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

      - `Text object { type }`

        Generates ordinary text without a structured-output constraint.

        - `type: "text"`

          The type of the object. Always `text`.

          - `"text"`

      - `JSONSchema object { schema, type }`

        Constrains generated text to a JSON Schema.

        - `schema: map[unknown]`

          The JSON Schema that generated text must match.

        - `type: "json_schema"`

          The type of the object. Always `json_schema`.

          - `"json_schema"`

    - `verbosity: optional "low" or "medium" or "high" or 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: optional array of AgentToolParam or 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.

    - `Function object { description, name, parameters, 2 more }`

      A function defined by the application.

      - `description: string`

        A description of what the function does.

      - `name: string`

        The name of the function.

      - `parameters: map[unknown]`

        A JSON Schema object describing the function's arguments.

      - `type: "function"`

        The type of the object. Always `function`.

        - `"function"`

      - `defer_loading: optional boolean`

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

    - `ToolSearch object { type }`

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

      - `type: "tool_search"`

        The type of the object. Always `tool_search`.

        - `"tool_search"`

    - `ProgrammaticToolCalling object { type, enabled }`

      Enables calling tools from model-generated code.

      - `type: "programmatic_tool_calling"`

        The type of the object. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

      - `enabled: optional boolean`

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

    - `Mcp object { server_label, transport, type, 5 more }`

      Tools provided by a remote MCP server.

      - `server_label: string`

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

      - `transport: McpTransportParam`

        The transport used to connect to the MCP server.

        - `HTTP object { server_url, type, authorization, headers }`

          Connects to an MCP server over HTTP.

          - `server_url: string`

            The URL of the MCP server.

          - `type: "http"`

            The type of the object. Always `http`.

            - `"http"`

          - `authorization: optional string or null`

            The authorization value sent to the MCP server, if any.

          - `headers: optional map[string] or null`

            Additional HTTP headers sent to the MCP server.

        - `Stdio object { command, cwd, type, 3 more }`

          Starts an MCP server as a local process.

          - `command: string`

            The command used to start the MCP server.

          - `cwd: string`

            The working directory used to start the MCP server.

          - `type: "stdio"`

            The type of the object. Always `stdio`.

            - `"stdio"`

          - `args: optional array of string or null`

            Arguments passed to the MCP server command.

          - `env: optional map[string] or null`

            Environment variables set for the MCP server process.

          - `env_vars: optional array of string or null`

            Environment variable names to inherit from the selected execution environment.

      - `type: "mcp"`

        The type of the object. Always `mcp`.

        - `"mcp"`

      - `allowed_tools: optional array of string or null`

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

      - `connection_origin: optional "service" or "environment" or 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: optional string or null`

        The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

      - `request_metadata: optional map[unknown] or null`

        Metadata included with requests to this MCP server.

      - `required: optional boolean`

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

    - `WebSearch object { type, allowed_domains, context_size, 2 more }`

      Web search.

      - `type: "web_search"`

        The type of the object. Always `web_search`.

        - `"web_search"`

      - `allowed_domains: optional array of string or null`

        Domains the search may include.

      - `context_size: optional "low" or "medium" or "high" or null`

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

        - `"low"`

        - `"medium"`

        - `"high"`

      - `location: optional object { city, country, region, timezone }  or null`

        Approximate location used to localize search results.

        - `city: optional string or null`

          The city name.

        - `country: optional string or null`

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

        - `region: optional string or null`

          The region or state name.

        - `timezone: optional string or null`

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

      - `mode: optional "disabled" or "cached" or "live" or 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.

    - `ComputerUse object { type, include_screenshots }`

      Browser use in an OpenAI-hosted session.

      - `type: "computer_use"`

        The type of the object. Always `computer_use`.

        - `"computer_use"`

      - `include_screenshots: optional boolean`

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

- `agent_id: optional string`

  The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged.

- `input: optional string or array of AgentSessionInputMessageParam or 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 of AgentSessionInputMessageParam`

    - `content: array of InputContentParam`

      The content of the message.

      - `InputText object { text, type }`

        Text input to the model.

        - `text: string`

          The text sent to the model.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        Image input to the model.

        - `image_url: string`

          The URL of the image sent to the model.

        - `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: optional "message"`

      The type of the input item. Always `message`.

      - `"message"`

- `metadata: optional map[string] or 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.

- `stream: optional boolean`

  Whether to stream session events as server-sent events. Defaults to `false`.

- `vault_ids: optional array of string or null`

  The IDs of vaults made available to the session.

### Returns

- `AgentSession object { id, agent, created_at, 9 more }`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

  - `agent: object { id, instructions, model, 6 more }`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

    - `instructions: string or null`

      Custom instructions appended to the agent's default base instructions.

    - `model: string`

      The model used by the agent.

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number or null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

    - `name: string or 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.

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" or "minimal" or "low" or 4 more or null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

        - `Text object { type }`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `JSONSchema object { schema, type }`

          Constrains generated text to a JSON Schema.

          - `schema: map[unknown]`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" or "medium" or "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: array of AgentTool`

      Tools available to the agent.

      - `Function object { defer_loading, description, name, 2 more }`

        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.

        - `name: string`

          The name of the function.

        - `parameters: map[unknown]`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

      - `ProgrammaticToolCalling object { enabled, type }`

        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"`

      - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

        Tools provided by a remote MCP server.

        - `allowed_tools: array of string or null`

          The MCP tools the agent may call.

        - `connection_origin: "service" or "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string or null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

        - `request_metadata: map[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.

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `HTTP object { server_url, type }`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `Stdio object { args, command, cwd, 2 more }`

            Starts an MCP server as a local process.

            - `args: array of string`

              Arguments passed to the MCP server command.

            - `command: string`

              The command used to start the MCP server.

            - `cwd: string`

              The working directory used to start the MCP server.

            - `env_vars: array of string`

              Environment variable names inherited from the execution environment.

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `WebSearch object { allowed_domains, context_size, location, 2 more }`

        Web search.

        - `allowed_domains: array of string or null`

          Allowed search domains, or `null` when the search is unrestricted.

        - `context_size: "low" or "medium" or "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: object { city, country, region, timezone }  or null`

          Approximate location used to localize search results, if provided.

          - `city: string or null`

            The city name.

          - `country: string or null`

            The two-letter ISO country code, such as `US`.

          - `region: string or null`

            The region or state name.

          - `timezone: string or null`

            The IANA timezone, such as `America/Los_Angeles`.

        - `mode: "disabled" or "cached" or "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `ComputerUse object { include_screenshots, type }`

        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"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

  - `environment: Environment`

    The execution environment for the session.

    - `None object { type }`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `desktop: object { enabled }`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

      - `files: array of HostedEnvironmentFile`

        Files available in the environment, excluding their contents.

        - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `file_id: string`

            The ID of the uploaded file.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `Inline object { id, path, size_bytes, type }`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: object { access, allowed_domains }`

        The effective network access policy for the environment.

        - `access: "enabled" or "disabled" or "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 of string`

          Domains the environment may access when network access is restricted.

      - `packages: object { npm, python, system }`

        Packages installed in the environment.

        - `npm: array of string`

          npm packages installed globally in the environment.

        - `python: array of string`

          Python packages installed in the environment.

        - `system: array of string`

          System packages installed in the environment.

      - `plugins: array of HostedPlugin`

        Plugins installed in the environment, excluding their archive contents.

        - `description: string`

          The installed plugin description.

        - `name: string`

          The installed plugin name.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: array of HostedSkill`

        Skills installed in the environment, excluding their archive contents.

        - `HostedSkillReference object { description, name, skill_id, 2 more }`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `skill_id: string`

            The referenced skill ID.

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

        - `Inline object { description, name, type }`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `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: optional "small" or "medium" or "large" or null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

    - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

      - `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`.

  - `error: string or null`

    The error that caused the session to fail, if any.

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

  - `metadata: map[string]`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

    Actions that must be completed before the session can continue.

    - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

      Respond to a computer-use request.

      - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

        The information needed to render the request.

        - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `BrowserOriginAccess object { origin, reason, type }`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

          - `reason: string or null`

            The browser's explanation for this request, or null when unavailable.

          - `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.

      - `turn_id: string`

        The turn that requested approval.

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `FunctionCall object { arguments, call_id, name, 2 more }`

      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.

      - `name: string`

        The function name.

      - `turn_id: string`

        The ID of the turn that requested the function call.

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `EnvironmentConnection object { environment_id, type }`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

  - `vault_ids: array of string`

    The IDs of vaults made available to the session.

### Example

```http
curl https://api.openai.com/v1/agents/sessions \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "environment": {
            "type": "none"
          }
        }'
```

#### Response

```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"
      }
    ]
  },
  "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"
  ]
}
```

## Delete an agent session

**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).

### Path Parameters

- `session_id: string`

### Returns

- `AgentSessionDeleted object { id, deleted, object }`

  A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously.

  - `id: string`

    The ID of the deleted session.

  - `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

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.session.deleted"
}
```

## List agent sessions

**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).

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `agent_id: optional string`

  Only return sessions whose root agent has this ID. Omit to return sessions for all agents.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of AgentSession`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the session.

  - `agent: object { id, instructions, model, 6 more }`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

    - `instructions: string or null`

      Custom instructions appended to the agent's default base instructions.

    - `model: string`

      The model used by the agent.

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number or null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

    - `name: string or 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.

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" or "minimal" or "low" or 4 more or null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

        - `Text object { type }`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `JSONSchema object { schema, type }`

          Constrains generated text to a JSON Schema.

          - `schema: map[unknown]`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" or "medium" or "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: array of AgentTool`

      Tools available to the agent.

      - `Function object { defer_loading, description, name, 2 more }`

        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.

        - `name: string`

          The name of the function.

        - `parameters: map[unknown]`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

      - `ProgrammaticToolCalling object { enabled, type }`

        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"`

      - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

        Tools provided by a remote MCP server.

        - `allowed_tools: array of string or null`

          The MCP tools the agent may call.

        - `connection_origin: "service" or "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string or null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

        - `request_metadata: map[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.

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `HTTP object { server_url, type }`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `Stdio object { args, command, cwd, 2 more }`

            Starts an MCP server as a local process.

            - `args: array of string`

              Arguments passed to the MCP server command.

            - `command: string`

              The command used to start the MCP server.

            - `cwd: string`

              The working directory used to start the MCP server.

            - `env_vars: array of string`

              Environment variable names inherited from the execution environment.

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `WebSearch object { allowed_domains, context_size, location, 2 more }`

        Web search.

        - `allowed_domains: array of string or null`

          Allowed search domains, or `null` when the search is unrestricted.

        - `context_size: "low" or "medium" or "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: object { city, country, region, timezone }  or null`

          Approximate location used to localize search results, if provided.

          - `city: string or null`

            The city name.

          - `country: string or null`

            The two-letter ISO country code, such as `US`.

          - `region: string or null`

            The region or state name.

          - `timezone: string or null`

            The IANA timezone, such as `America/Los_Angeles`.

        - `mode: "disabled" or "cached" or "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `ComputerUse object { include_screenshots, type }`

        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"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

  - `environment: Environment`

    The execution environment for the session.

    - `None object { type }`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `desktop: object { enabled }`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

      - `files: array of HostedEnvironmentFile`

        Files available in the environment, excluding their contents.

        - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `file_id: string`

            The ID of the uploaded file.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `Inline object { id, path, size_bytes, type }`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: object { access, allowed_domains }`

        The effective network access policy for the environment.

        - `access: "enabled" or "disabled" or "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 of string`

          Domains the environment may access when network access is restricted.

      - `packages: object { npm, python, system }`

        Packages installed in the environment.

        - `npm: array of string`

          npm packages installed globally in the environment.

        - `python: array of string`

          Python packages installed in the environment.

        - `system: array of string`

          System packages installed in the environment.

      - `plugins: array of HostedPlugin`

        Plugins installed in the environment, excluding their archive contents.

        - `description: string`

          The installed plugin description.

        - `name: string`

          The installed plugin name.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: array of HostedSkill`

        Skills installed in the environment, excluding their archive contents.

        - `HostedSkillReference object { description, name, skill_id, 2 more }`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `skill_id: string`

            The referenced skill ID.

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

        - `Inline object { description, name, type }`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `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: optional "small" or "medium" or "large" or null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

    - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

      - `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`.

  - `error: string or null`

    The error that caused the session to fail, if any.

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

  - `metadata: map[string]`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

    Actions that must be completed before the session can continue.

    - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

      Respond to a computer-use request.

      - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

        The information needed to render the request.

        - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `BrowserOriginAccess object { origin, reason, type }`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

          - `reason: string or null`

            The browser's explanation for this request, or null when unavailable.

          - `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.

      - `turn_id: string`

        The turn that requested approval.

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `FunctionCall object { arguments, call_id, name, 2 more }`

      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.

      - `name: string`

        The function name.

      - `turn_id: string`

        The ID of the turn that requested the function call.

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `EnvironmentConnection object { environment_id, type }`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

  - `vault_ids: array of string`

    The IDs of vaults made available to the session.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
          }
        ]
      },
      "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"
      ]
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent session

**get** `/agents/sessions/{session_id}`

Retrieves the current state of a managed agent session. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Path Parameters

- `session_id: string`

### Returns

- `AgentSession object { id, agent, created_at, 9 more }`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

  - `agent: object { id, instructions, model, 6 more }`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

    - `instructions: string or null`

      Custom instructions appended to the agent's default base instructions.

    - `model: string`

      The model used by the agent.

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number or null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

    - `name: string or 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.

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" or "minimal" or "low" or 4 more or null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

        - `Text object { type }`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `JSONSchema object { schema, type }`

          Constrains generated text to a JSON Schema.

          - `schema: map[unknown]`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" or "medium" or "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: array of AgentTool`

      Tools available to the agent.

      - `Function object { defer_loading, description, name, 2 more }`

        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.

        - `name: string`

          The name of the function.

        - `parameters: map[unknown]`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

      - `ProgrammaticToolCalling object { enabled, type }`

        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"`

      - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

        Tools provided by a remote MCP server.

        - `allowed_tools: array of string or null`

          The MCP tools the agent may call.

        - `connection_origin: "service" or "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string or null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

        - `request_metadata: map[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.

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `HTTP object { server_url, type }`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `Stdio object { args, command, cwd, 2 more }`

            Starts an MCP server as a local process.

            - `args: array of string`

              Arguments passed to the MCP server command.

            - `command: string`

              The command used to start the MCP server.

            - `cwd: string`

              The working directory used to start the MCP server.

            - `env_vars: array of string`

              Environment variable names inherited from the execution environment.

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `WebSearch object { allowed_domains, context_size, location, 2 more }`

        Web search.

        - `allowed_domains: array of string or null`

          Allowed search domains, or `null` when the search is unrestricted.

        - `context_size: "low" or "medium" or "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: object { city, country, region, timezone }  or null`

          Approximate location used to localize search results, if provided.

          - `city: string or null`

            The city name.

          - `country: string or null`

            The two-letter ISO country code, such as `US`.

          - `region: string or null`

            The region or state name.

          - `timezone: string or null`

            The IANA timezone, such as `America/Los_Angeles`.

        - `mode: "disabled" or "cached" or "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `ComputerUse object { include_screenshots, type }`

        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"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

  - `environment: Environment`

    The execution environment for the session.

    - `None object { type }`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `desktop: object { enabled }`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

      - `files: array of HostedEnvironmentFile`

        Files available in the environment, excluding their contents.

        - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `file_id: string`

            The ID of the uploaded file.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `Inline object { id, path, size_bytes, type }`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: object { access, allowed_domains }`

        The effective network access policy for the environment.

        - `access: "enabled" or "disabled" or "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 of string`

          Domains the environment may access when network access is restricted.

      - `packages: object { npm, python, system }`

        Packages installed in the environment.

        - `npm: array of string`

          npm packages installed globally in the environment.

        - `python: array of string`

          Python packages installed in the environment.

        - `system: array of string`

          System packages installed in the environment.

      - `plugins: array of HostedPlugin`

        Plugins installed in the environment, excluding their archive contents.

        - `description: string`

          The installed plugin description.

        - `name: string`

          The installed plugin name.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: array of HostedSkill`

        Skills installed in the environment, excluding their archive contents.

        - `HostedSkillReference object { description, name, skill_id, 2 more }`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `skill_id: string`

            The referenced skill ID.

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

        - `Inline object { description, name, type }`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `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: optional "small" or "medium" or "large" or null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

    - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

      - `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`.

  - `error: string or null`

    The error that caused the session to fail, if any.

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

  - `metadata: map[string]`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

    Actions that must be completed before the session can continue.

    - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

      Respond to a computer-use request.

      - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

        The information needed to render the request.

        - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `BrowserOriginAccess object { origin, reason, type }`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

          - `reason: string or null`

            The browser's explanation for this request, or null when unavailable.

          - `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.

      - `turn_id: string`

        The turn that requested approval.

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `FunctionCall object { arguments, call_id, name, 2 more }`

      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.

      - `name: string`

        The function name.

      - `turn_id: string`

        The ID of the turn that requested the function call.

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `EnvironmentConnection object { environment_id, type }`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

  - `vault_ids: array of string`

    The IDs of vaults made available to the session.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
      }
    ]
  },
  "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"
  ]
}
```

## Update an agent session

**post** `/agents/sessions/{session_id}`

Updates session metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](/api/docs/guides/agents-api/sessions/manage).

### Path Parameters

- `session_id: string`

### Body Parameters

- `agent: optional object { model, reasoning, service_tier }`

  Model settings for subsequent turns. Omitted fields stay unchanged.

  - `model: optional string`

    The model for subsequent turns. Omit to keep the current model.

  - `reasoning: optional object { effort }`

    Reasoning settings to update. Omit to keep the current effort.

    - `effort: optional "none" or "minimal" or "low" or 4 more or null`

      Omit to keep the current effort. Null selects the model's default effort.

      - `"none"`

      - `"minimal"`

      - `"low"`

      - `"medium"`

      - `"high"`

      - `"xhigh"`

      - `"max"`

  - `service_tier: optional "auto" or "default" or "flex" or 3 more or 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.

- `metadata: optional map[string] or 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.

### Returns

- `AgentSession object { id, agent, created_at, 9 more }`

  A Managed Agents session.

  - `id: string`

    The ID of the session.

  - `agent: object { id, instructions, model, 6 more }`

    The agent running in the session.

    - `id: string`

      The ID of the agent.

    - `instructions: string or null`

      Custom instructions appended to the agent's default base instructions.

    - `model: string`

      The model used by the agent.

    - `multi_agent: MultiAgentConfig`

      Configuration for creating and coordinating subagents.

      - `enabled: boolean`

        Whether subagent tools are enabled. Defaults to false.

      - `max_concurrent_subagents: number or null`

        Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

    - `name: string or 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.

    - `reasoning: AgentReasoning`

      The agent's reasoning configuration.

      - `effort: "none" or "minimal" or "low" or 4 more or null`

        The requested reasoning effort, or `null` when the model selects its own default.

        - `"none"`

        - `"minimal"`

        - `"low"`

        - `"medium"`

        - `"high"`

        - `"xhigh"`

        - `"max"`

      - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

        - `Text object { type }`

          Generates ordinary text without a structured-output constraint.

          - `type: "text"`

            The type of the object. Always `text`.

            - `"text"`

        - `JSONSchema object { schema, type }`

          Constrains generated text to a JSON Schema.

          - `schema: map[unknown]`

            The JSON Schema that generated text must match.

          - `type: "json_schema"`

            The type of the object. Always `json_schema`.

            - `"json_schema"`

      - `verbosity: "low" or "medium" or "high"`

        The amount of text produced by the agent. Defaults to `medium`.

        - `"low"`

        - `"medium"`

        - `"high"`

    - `tools: array of AgentTool`

      Tools available to the agent.

      - `Function object { defer_loading, description, name, 2 more }`

        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.

        - `name: string`

          The name of the function.

        - `parameters: map[unknown]`

          A JSON Schema object describing the function's arguments.

        - `type: "function"`

          The type of the object. Always `function`.

          - `"function"`

      - `ProgrammaticToolCalling object { enabled, type }`

        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"`

      - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

        Tools provided by a remote MCP server.

        - `allowed_tools: array of string or null`

          The MCP tools the agent may call.

        - `connection_origin: "service" or "environment"`

          Where outbound MCP HTTP connections originate.

          - `"service"`

          - `"environment"`

        - `credential_id: string or null`

          The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

        - `request_metadata: map[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.

        - `transport: McpTransport`

          The transport used to connect to the MCP server.

          - `HTTP object { server_url, type }`

            Connects to an MCP server over HTTP.

            - `server_url: string`

              The URL of the MCP server.

            - `type: "http"`

              The type of the object. Always `http`.

              - `"http"`

          - `Stdio object { args, command, cwd, 2 more }`

            Starts an MCP server as a local process.

            - `args: array of string`

              Arguments passed to the MCP server command.

            - `command: string`

              The command used to start the MCP server.

            - `cwd: string`

              The working directory used to start the MCP server.

            - `env_vars: array of string`

              Environment variable names inherited from the execution environment.

            - `type: "stdio"`

              The type of the object. Always `stdio`.

              - `"stdio"`

        - `type: "mcp"`

          The type of the object. Always `mcp`.

          - `"mcp"`

      - `WebSearch object { allowed_domains, context_size, location, 2 more }`

        Web search.

        - `allowed_domains: array of string or null`

          Allowed search domains, or `null` when the search is unrestricted.

        - `context_size: "low" or "medium" or "high"`

          The amount of search context made available to the model. Defaults to `medium`.

          - `"low"`

          - `"medium"`

          - `"high"`

        - `location: object { city, country, region, timezone }  or null`

          Approximate location used to localize search results, if provided.

          - `city: string or null`

            The city name.

          - `country: string or null`

            The two-letter ISO country code, such as `US`.

          - `region: string or null`

            The region or state name.

          - `timezone: string or null`

            The IANA timezone, such as `America/Los_Angeles`.

        - `mode: "disabled" or "cached" or "live"`

          The source used for web search results.

          - `"disabled"`

          - `"cached"`

          - `"live"`

        - `type: "web_search"`

          The type of the object. Always `web_search`.

          - `"web_search"`

      - `ComputerUse object { include_screenshots, type }`

        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"`

  - `created_at: number`

    The Unix timestamp, in seconds, when the session was created.

  - `environment: Environment`

    The execution environment for the session.

    - `None object { type }`

      The session talks to CCA without selecting or provisioning an execution environment.

      - `type: "none"`

        The type of the object. Always `none`.

        - `"none"`

    - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

      An environment hosted by OpenAI.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `desktop: object { enabled }`

        The effective desktop configuration.

        - `enabled: boolean`

          Whether the environment provisions a desktop and browser proxy.

      - `files: array of HostedEnvironmentFile`

        Files available in the environment, excluding their contents.

        - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

          A file copied from the OpenAI Files API.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `file_id: string`

            The ID of the uploaded file.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "file_id"`

            The type of the object. Always `file_id`.

            - `"file_id"`

        - `Inline object { id, path, size_bytes, type }`

          A file supplied inline when the session was created.

          - `id: string`

            The session-scoped ID of the file in the execution environment.

          - `path: string`

            The file's absolute path inside the environment.

          - `size_bytes: number`

            The decoded file size in bytes.

          - `type: "inline"`

            The type of the object. Always `inline`.

            - `"inline"`

      - `network: object { access, allowed_domains }`

        The effective network access policy for the environment.

        - `access: "enabled" or "disabled" or "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 of string`

          Domains the environment may access when network access is restricted.

      - `packages: object { npm, python, system }`

        Packages installed in the environment.

        - `npm: array of string`

          npm packages installed globally in the environment.

        - `python: array of string`

          Python packages installed in the environment.

        - `system: array of string`

          System packages installed in the environment.

      - `plugins: array of HostedPlugin`

        Plugins installed in the environment, excluding their archive contents.

        - `description: string`

          The installed plugin description.

        - `name: string`

          The installed plugin name.

        - `type: "inline"`

          The type of the object. Always `inline`.

          - `"inline"`

      - `skills: array of HostedSkill`

        Skills installed in the environment, excluding their archive contents.

        - `HostedSkillReference object { description, name, skill_id, 2 more }`

          A skill installed from the Skills API.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `skill_id: string`

            The referenced skill ID.

          - `type: "skill_reference"`

            The type of the object. Always `skill_reference`.

            - `"skill_reference"`

          - `version: string`

            The concrete skill version installed for this session.

        - `Inline object { description, name, type }`

          A skill installed from an inline ZIP archive.

          - `description: string`

            The installed skill description.

          - `name: string`

            The installed skill name.

          - `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: optional "small" or "medium" or "large" or null`

        The effective CPU and memory tier, or null when unknown or outside the public tiers.

        - `"small"`

        - `"medium"`

        - `"large"`

    - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

      An environment hosted by the application.

      - `id: string`

        The public ID of the environment.

      - `capability_directories: array of string`

        Directories that contain capabilities exposed to the agent.

      - `remote_url: string`

        Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

      - `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`.

  - `error: string or null`

    The error that caused the session to fail, if any.

  - `last_active_at: number`

    The Unix timestamp, in seconds, when the session was last active.

  - `metadata: map[string]`

    Custom string key-value pairs attached to the session.

  - `object: "agent.session"`

    The object type. Always `agent.session`.

    - `"agent.session"`

  - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

    Actions that must be completed before the session can continue.

    - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

      Respond to a computer-use request.

      - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

        The information needed to render the request.

        - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `BrowserOriginAccess object { origin, reason, type }`

          A browser origin awaiting the application's approval decision.

          - `origin: string`

            The origin the browser needs permission to access.

          - `reason: string or null`

            The browser's explanation for this request, or null when unavailable.

          - `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.

      - `turn_id: string`

        The turn that requested approval.

      - `type: "computer_use_approval_request"`

        The type of the object. Always `computer_use_approval_request`.

        - `"computer_use_approval_request"`

    - `FunctionCall object { arguments, call_id, name, 2 more }`

      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.

      - `name: string`

        The function name.

      - `turn_id: string`

        The ID of the turn that requested the function call.

      - `type: "function_call"`

        The type of the object. Always `function_call`.

        - `"function_call"`

    - `EnvironmentConnection object { environment_id, type }`

      Reconnect a session environment.

      - `environment_id: string`

        The ID of the environment to reconnect.

      - `type: "environment_connection"`

        The type of the object. Always `environment_connection`.

        - `"environment_connection"`

  - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

  - `vault_ids: array of string`

    The IDs of vaults made available to the session.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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"
      }
    ]
  },
  "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"
  ]
}
```

# Artifacts

## Retrieve agent session artifact content

**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).

### Path Parameters

- `session_id: string`

- `artifact_id: string`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID/content \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

## Delete an agent session artifact

**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).

### Path Parameters

- `session_id: string`

- `artifact_id: string`

### Returns

- `SessionArtifactDeleted object { id, deleted, object }`

  Confirmation that an immutable session artifact was deleted.

  - `id: string`

    The ID of the deleted session artifact.

  - `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

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "agent.session.artifact.deleted"
}
```

## List agent session artifacts

**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).

### Path Parameters

- `session_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `environment_id: optional string or null`

  Restrict the listing to artifacts produced by this environment.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of SessionArtifact`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The immutable artifact ID.

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

  - `environment_id: string`

    The ID of the environment that produced the artifact.

  - `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.

  - `session_id: string`

    The ID of the session that owns the artifact.

  - `size_bytes: number`

    The immutable artifact size in bytes.

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `session_id: string`

- `artifact_id: string`

### Returns

- `SessionArtifact object { id, created_at, environment_id, 5 more }`

  An immutable file published by a completed hosted session turn.

  - `id: string`

    The immutable artifact ID.

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

  - `environment_id: string`

    The ID of the environment that produced the artifact.

  - `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.

  - `session_id: string`

    The ID of the session that owns the artifact.

  - `size_bytes: number`

    The immutable artifact size in bytes.

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/artifacts/$ARTIFACT_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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 object { id, created_at, environment_id, 5 more }`

  An immutable file published by a completed hosted session turn.

  - `id: string`

    The immutable artifact ID.

  - `created_at: number`

    The Unix timestamp, in seconds, when the artifact was published.

  - `environment_id: string`

    The ID of the environment that produced the artifact.

  - `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.

  - `session_id: string`

    The ID of the session that owns the artifact.

  - `size_bytes: number`

    The immutable artifact size in bytes.

  - `turn_id: string`

    The ID of the completed turn that published the artifact.

### Session Artifact Deleted

- `SessionArtifactDeleted object { id, deleted, object }`

  Confirmation that an immutable session artifact was deleted.

  - `id: string`

    The ID of the deleted session artifact.

  - `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

**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).

### Header Parameters

- `"Idempotency-Key": optional string`

### Path Parameters

- `session_id: string`

### Body Parameters

- `events: array of AgentSessionInputParam`

  The input events to submit to the session.

  - `AgentSessionInputComputerUseApprovalRequestResult object { request_id, response, type }`

    Responds to a pending Computer Use approval request.

    - `request_id: string`

      The registered request ID from the required action.

    - `response: AgentBrowserAuthenticationSubmitParam or AgentBrowserAuthenticationCancelParam or AgentBrowserOriginAccessParam`

      The response for this request type.

      - `AgentBrowserAuthenticationSubmitParam object { action, fields, type, selected_option }`

        - `action: "submit"`

          - `"submit"`

        - `fields: array of object { field_id, value }`

          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.

          - `field_id: string`

            The field ID from the required action.

          - `value: string`

            The value to enter into the registered control.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

        - `selected_option: optional string or null`

          The chosen method. Required when the required action contains options.

      - `AgentBrowserAuthenticationCancelParam object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `AgentBrowserOriginAccessParam object { decision, type }`

        - `decision: "approve" or "deny" or "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"`

  - `AgentSessionInputMessage object { input, type }`

    Adds one or more user messages and starts a turn.

    - `input: array of AgentSessionInputMessageParam`

      The user messages to add to the session.

      - `content: array of InputContentParam`

        The content of the message.

        - `InputText object { text, type }`

          Text input to the model.

          - `text: string`

            The text sent to the model.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          Image input to the model.

          - `image_url: string`

            The URL of the image sent to the model.

          - `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: optional "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"`

  - `AgentSessionInputCancel object { type }`

    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"`

  - `AgentSessionInputToolResult object { call_id, success, turn_id, 3 more }`

    Submits the result of a function call.

    - `call_id: string`

      The ID of the function call.

    - `success: boolean`

      Whether the function call succeeded.

    - `turn_id: string`

      The ID of the turn that requested the function call.

    - `type: "agent.session.input.tool_result"`

      The type of the object. Always `agent.session.input.tool_result`.

      - `"agent.session.input.tool_result"`

    - `error: optional string or null`

      The error message when the call failed.

    - `output: optional AgentFunctionCallOutputParam or null`

      The function result when the call succeeded.

      - `string`

      - `array of InputContentParam`

        - `InputText object { text, type }`

          Text input to the model.

        - `InputImage object { image_url, type }`

          Image input to the model.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/events \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "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

**get** `/agents/sessions/{session_id}/events`

Streams live events for an agent session. See [session events](/api/docs/guides/agents-api/sessions/events).

### Path Parameters

- `session_id: string`

### Returns

- `AgentSessionEvent = AgentSessionErrorEvent or AgentSessionEnvironmentReadyEvent or AgentSessionEnvironmentSuspendedEvent or 30 more`

  An event emitted by a Managed Agents session.

  - `AgentSessionErrorEvent object { error, event_id, session_id, type }`

    Emitted when a turn or session fails.

    - `error: SessionError`

      The error that occurred.

      - `code: string or null`

        The machine-readable error code, if any.

      - `message: string`

        A customer-safe explanation of the error.

      - `param: string or null`

        The request parameter associated with the error, if any.

      - `type: string`

        The error type.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `type: "error"`

      The type of the object. Always `error`.

      - `"error"`

  - `AgentSessionEnvironmentReadyEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a hosted session environment is ready to connect.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

      - `id: string`

        The public ID of the environment.

      - `error: object { code, message, type }  or null`

        The error reported while preparing the environment, if any.

        - `code: string`

          A machine-readable error code.

        - `message: string`

          A human-readable error message.

        - `type: string`

          The error type.

      - `status: "pending" or "ready" or "connected" or 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.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.ready"`

      The type of the object. Always `agent.session.environment.ready`.

      - `"agent.session.environment.ready"`

  - `AgentSessionEnvironmentSuspendedEvent object { environment, event_id, session_id, 2 more }`

    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.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.suspended"`

      The type of the object. Always `agent.session.environment.suspended`.

      - `"agent.session.environment.suspended"`

  - `AgentSessionEnvironmentExpiredEvent object { environment, event_id, session_id, 2 more }`

    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.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.expired"`

      The type of the object. Always `agent.session.environment.expired`.

      - `"agent.session.environment.expired"`

  - `AgentSessionEnvironmentResetEvent object { environment_id, event_id, reset_count, 3 more }`

    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.

    - `event_id: string`

      The unique ID of the event.

    - `reset_count: number`

      Monotonically increasing reset number. Repeated notifications share this number.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The associated turn, when applicable.

    - `type: "agent.session.environment.reset"`

      The type of the object. Always `agent.session.environment.reset`.

      - `"agent.session.environment.reset"`

  - `AgentOutputCommandExecutionOutputDeltaEvent object { delta, event_id, item_id, 4 more }`

    Emitted when command execution produces an output delta.

    - `delta: string`

      The output text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the command execution item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionCreatedEvent object { event_id, session, type }`

    Emitted when a session is created.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The session that was created.

      - `id: string`

        The ID of the session.

      - `agent: object { id, instructions, model, 6 more }`

        The agent running in the session.

        - `id: string`

          The ID of the agent.

        - `instructions: string or null`

          Custom instructions appended to the agent's default base instructions.

        - `model: string`

          The model used by the agent.

        - `multi_agent: MultiAgentConfig`

          Configuration for creating and coordinating subagents.

          - `enabled: boolean`

            Whether subagent tools are enabled. Defaults to false.

          - `max_concurrent_subagents: number or null`

            Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled.

        - `name: string or 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.

        - `reasoning: AgentReasoning`

          The agent's reasoning configuration.

          - `effort: "none" or "minimal" or "low" or 4 more or null`

            The requested reasoning effort, or `null` when the model selects its own default.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

          - `summary: "concise" or "detailed" or "auto" or 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" or "default" or "flex" or 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.

            - `Text object { type }`

              Generates ordinary text without a structured-output constraint.

              - `type: "text"`

                The type of the object. Always `text`.

                - `"text"`

            - `JSONSchema object { schema, type }`

              Constrains generated text to a JSON Schema.

              - `schema: map[unknown]`

                The JSON Schema that generated text must match.

              - `type: "json_schema"`

                The type of the object. Always `json_schema`.

                - `"json_schema"`

          - `verbosity: "low" or "medium" or "high"`

            The amount of text produced by the agent. Defaults to `medium`.

            - `"low"`

            - `"medium"`

            - `"high"`

        - `tools: array of AgentTool`

          Tools available to the agent.

          - `Function object { defer_loading, description, name, 2 more }`

            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.

            - `name: string`

              The name of the function.

            - `parameters: map[unknown]`

              A JSON Schema object describing the function's arguments.

            - `type: "function"`

              The type of the object. Always `function`.

              - `"function"`

          - `ProgrammaticToolCalling object { enabled, type }`

            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"`

          - `Mcp object { allowed_tools, connection_origin, credential_id, 5 more }`

            Tools provided by a remote MCP server.

            - `allowed_tools: array of string or null`

              The MCP tools the agent may call.

            - `connection_origin: "service" or "environment"`

              Where outbound MCP HTTP connections originate.

              - `"service"`

              - `"environment"`

            - `credential_id: string or null`

              The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL.

            - `request_metadata: map[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.

            - `transport: McpTransport`

              The transport used to connect to the MCP server.

              - `HTTP object { server_url, type }`

                Connects to an MCP server over HTTP.

                - `server_url: string`

                  The URL of the MCP server.

                - `type: "http"`

                  The type of the object. Always `http`.

                  - `"http"`

              - `Stdio object { args, command, cwd, 2 more }`

                Starts an MCP server as a local process.

                - `args: array of string`

                  Arguments passed to the MCP server command.

                - `command: string`

                  The command used to start the MCP server.

                - `cwd: string`

                  The working directory used to start the MCP server.

                - `env_vars: array of string`

                  Environment variable names inherited from the execution environment.

                - `type: "stdio"`

                  The type of the object. Always `stdio`.

                  - `"stdio"`

            - `type: "mcp"`

              The type of the object. Always `mcp`.

              - `"mcp"`

          - `WebSearch object { allowed_domains, context_size, location, 2 more }`

            Web search.

            - `allowed_domains: array of string or null`

              Allowed search domains, or `null` when the search is unrestricted.

            - `context_size: "low" or "medium" or "high"`

              The amount of search context made available to the model. Defaults to `medium`.

              - `"low"`

              - `"medium"`

              - `"high"`

            - `location: object { city, country, region, timezone }  or null`

              Approximate location used to localize search results, if provided.

              - `city: string or null`

                The city name.

              - `country: string or null`

                The two-letter ISO country code, such as `US`.

              - `region: string or null`

                The region or state name.

              - `timezone: string or null`

                The IANA timezone, such as `America/Los_Angeles`.

            - `mode: "disabled" or "cached" or "live"`

              The source used for web search results.

              - `"disabled"`

              - `"cached"`

              - `"live"`

            - `type: "web_search"`

              The type of the object. Always `web_search`.

              - `"web_search"`

          - `ComputerUse object { include_screenshots, type }`

            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"`

      - `created_at: number`

        The Unix timestamp, in seconds, when the session was created.

      - `environment: Environment`

        The execution environment for the session.

        - `None object { type }`

          The session talks to CCA without selecting or provisioning an execution environment.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `OpenAIHosted object { id, capability_directories, desktop, 7 more }`

          An environment hosted by OpenAI.

          - `id: string`

            The public ID of the environment.

          - `capability_directories: array of string`

            Directories that contain capabilities exposed to the agent.

          - `desktop: object { enabled }`

            The effective desktop configuration.

            - `enabled: boolean`

              Whether the environment provisions a desktop and browser proxy.

          - `files: array of HostedEnvironmentFile`

            Files available in the environment, excluding their contents.

            - `HostedEnvironmentFileID object { id, file_id, path, 2 more }`

              A file copied from the OpenAI Files API.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

              - `file_id: string`

                The ID of the uploaded file.

              - `path: string`

                The file's absolute path inside the environment.

              - `size_bytes: number`

                The decoded file size in bytes.

              - `type: "file_id"`

                The type of the object. Always `file_id`.

                - `"file_id"`

            - `Inline object { id, path, size_bytes, type }`

              A file supplied inline when the session was created.

              - `id: string`

                The session-scoped ID of the file in the execution environment.

              - `path: string`

                The file's absolute path inside the environment.

              - `size_bytes: number`

                The decoded file size in bytes.

              - `type: "inline"`

                The type of the object. Always `inline`.

                - `"inline"`

          - `network: object { access, allowed_domains }`

            The effective network access policy for the environment.

            - `access: "enabled" or "disabled" or "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 of string`

              Domains the environment may access when network access is restricted.

          - `packages: object { npm, python, system }`

            Packages installed in the environment.

            - `npm: array of string`

              npm packages installed globally in the environment.

            - `python: array of string`

              Python packages installed in the environment.

            - `system: array of string`

              System packages installed in the environment.

          - `plugins: array of HostedPlugin`

            Plugins installed in the environment, excluding their archive contents.

            - `description: string`

              The installed plugin description.

            - `name: string`

              The installed plugin name.

            - `type: "inline"`

              The type of the object. Always `inline`.

              - `"inline"`

          - `skills: array of HostedSkill`

            Skills installed in the environment, excluding their archive contents.

            - `HostedSkillReference object { description, name, skill_id, 2 more }`

              A skill installed from the Skills API.

              - `description: string`

                The installed skill description.

              - `name: string`

                The installed skill name.

              - `skill_id: string`

                The referenced skill ID.

              - `type: "skill_reference"`

                The type of the object. Always `skill_reference`.

                - `"skill_reference"`

              - `version: string`

                The concrete skill version installed for this session.

            - `Inline object { description, name, type }`

              A skill installed from an inline ZIP archive.

              - `description: string`

                The installed skill description.

              - `name: string`

                The installed skill name.

              - `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: optional "small" or "medium" or "large" or null`

            The effective CPU and memory tier, or null when unknown or outside the public tiers.

            - `"small"`

            - `"medium"`

            - `"large"`

        - `SelfHosted object { id, capability_directories, remote_url, 2 more }`

          An environment hosted by the application.

          - `id: string`

            The public ID of the environment.

          - `capability_directories: array of string`

            Directories that contain capabilities exposed to the agent.

          - `remote_url: string`

            Pass this URL unchanged to `codex exec-server --remote` when connecting this environment.

          - `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`.

      - `error: string or null`

        The error that caused the session to fail, if any.

      - `last_active_at: number`

        The Unix timestamp, in seconds, when the session was last active.

      - `metadata: map[string]`

        Custom string key-value pairs attached to the session.

      - `object: "agent.session"`

        The object type. Always `agent.session`.

        - `"agent.session"`

      - `required_actions: array of ComputerUseApprovalRequest { request, request_id, turn_id, type }  or FunctionCall { arguments, call_id, name, 2 more }  or EnvironmentConnection { environment_id, type }`

        Actions that must be completed before the session can continue.

        - `ComputerUseApprovalRequest object { request, request_id, turn_id, type }`

          Respond to a computer-use request.

          - `request: BrowserAuthentication { credential_origin, fields, options, 2 more }  or BrowserOriginAccess { origin, reason, type }`

            The information needed to render the request.

            - `BrowserAuthentication object { credential_origin, fields, options, 2 more }`

              A registered form awaiting the application's response.

              - `credential_origin: string or null`

                The registered form or frame origin where values will be entered.

              - `fields: array of object { id, label, required, type }`

                Controls to render. All submitted values are sensitive.

                - `id: string`

                  The field ID to submit as field_id in a fields entry.

                - `label: string`

                  The label to display beside the control.

                - `required: boolean`

                  Whether this control requires a nonempty value.

                - `type: string`

                  The rendering type, such as email, password, or text.

              - `options: array of object { id, field_ids, label }`

                Sign-in methods. Empty for a plain form.

                - `id: string`

                  The option ID to submit as selected_option.

                - `field_ids: array of string`

                  IDs from the registered fields that this method accepts.

                - `label: string`

                  The method label to display.

              - `reason: string or null`

                Why the agent needs the user to sign in.

              - `type: "browser_authentication"`

                The type of the object. Always `browser_authentication`.

                - `"browser_authentication"`

            - `BrowserOriginAccess object { origin, reason, type }`

              A browser origin awaiting the application's approval decision.

              - `origin: string`

                The origin the browser needs permission to access.

              - `reason: string or null`

                The browser's explanation for this request, or null when unavailable.

              - `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.

          - `turn_id: string`

            The turn that requested approval.

          - `type: "computer_use_approval_request"`

            The type of the object. Always `computer_use_approval_request`.

            - `"computer_use_approval_request"`

        - `FunctionCall object { arguments, call_id, name, 2 more }`

          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.

          - `name: string`

            The function name.

          - `turn_id: string`

            The ID of the turn that requested the function call.

          - `type: "function_call"`

            The type of the object. Always `function_call`.

            - `"function_call"`

        - `EnvironmentConnection object { environment_id, type }`

          Reconnect a session environment.

          - `environment_id: string`

            The ID of the environment to reconnect.

          - `type: "environment_connection"`

            The type of the object. Always `environment_connection`.

            - `"environment_connection"`

      - `status: "idle" or "in_progress" or "requires_action" or "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 or 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.

        - `input_tokens_details: object { cached_tokens }`

          A breakdown of the agent's input token usage.

          - `cached_tokens: number`

            The number of input tokens retrieved from the prompt cache.

        - `output_tokens: number`

          The number of output tokens generated by the agent.

        - `output_tokens_details: object { reasoning_tokens }`

          A breakdown of the agent's output token usage.

          - `reasoning_tokens: number`

            The number of output tokens used for reasoning.

        - `total_tokens: number`

          The total number of input and output tokens used by the agent.

      - `vault_ids: array of string`

        The IDs of vaults made available to the session.

    - `type: "agent.session.created"`

      The type of the object. Always `agent.session.created`.

      - `"agent.session.created"`

  - `AgentSessionTurnCreatedEvent object { event_id, session_id, turn, 2 more }`

    Emitted when a turn is created.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The turn at the time it was created.

      - `id: string`

        The ID of the turn.

      - `agent_id: string`

        The ID of the agent that ran the turn.

      - `completed_at: number or null`

        The Unix timestamp, in seconds, when the turn reached a terminal state.

      - `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.

      - `error: SessionTurnError or null`

        A customer-safe error. Non-null only for a failed turn.

        - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

          A stable, machine-readable failure category.

          - `"context_length_exceeded"`

            The request exceeds the model's context window.

          - `"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.

      - `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.

      - `started_at: number or null`

        The Unix timestamp, in seconds, when the turn started.

      - `status: "queued" or "in_progress" or "waiting" or 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 or null`

        The ID of the subagent that ran the turn, if applicable.

      - `usage: TokenUsage or null`

        Best-effort token usage for the turn, or null if unknown. Recorded usage may change.

    - `turn_id: string`

      The ID of the turn associated with the event.

    - `type: "agent.session.turn.created"`

      The type of the object. Always `agent.session.turn.created`.

      - `"agent.session.turn.created"`

  - `AgentSessionTurnInProgressEvent object { event_id, session_id, turn, 2 more }`

    Emitted when a turn starts running.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The turn at the time it started running.

    - `turn_id: string`

      The ID of the turn associated with the event.

    - `type: "agent.session.turn.in_progress"`

      The type of the object. Always `agent.session.turn.in_progress`.

      - `"agent.session.turn.in_progress"`

  - `AgentSessionTurnCompletedEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn completes.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The completed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

    - `type: "agent.session.turn.completed"`

      The type of the object. Always `agent.session.turn.completed`.

      - `"agent.session.turn.completed"`

    - `usage: TokenUsage or null`

      Token usage by the root agent during the turn, when available.

  - `AgentSessionTurnFailedEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn fails.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The failed turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

    - `type: "agent.session.turn.failed"`

      The type of the object. Always `agent.session.turn.failed`.

      - `"agent.session.turn.failed"`

    - `usage: TokenUsage or null`

      Token usage by the root agent during the turn, when available.

  - `AgentSessionTurnCancelledEvent object { event_id, session_id, turn, 3 more }`

    Emitted when a turn is cancelled.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn: Turn`

      The cancelled turn.

    - `turn_id: string`

      The ID of the turn associated with the event.

    - `type: "agent.session.turn.cancelled"`

      The type of the object. Always `agent.session.turn.cancelled`.

      - `"agent.session.turn.cancelled"`

    - `usage: TokenUsage or null`

      Token usage by the root agent during the turn, when available.

  - `AgentSessionTurnItemAddedEvent object { event_id, item, output_index, 3 more }`

    Emitted when an item is added to a turn.

    - `event_id: string`

      The unique ID of the event.

    - `item: AgentSessionItem`

      The item that was added.

      - `AgentSessionMessage object { id, content, phase, 4 more }`

        A user or assistant message recorded in a session.

        - `id: string or null`

          The ID of this item, or null for legacy user messages whose ID was not recorded.

        - `content: array of AgentSessionMessageContent`

          The content of the message. User messages contain input text or images; assistant messages contain output text.

          - `InputText object { text, type }`

            Text supplied by the user.

            - `text: string`

              The text supplied by the user.

            - `type: "input_text"`

              The type of the object. Always `input_text`.

              - `"input_text"`

          - `InputImage object { image_url, type }`

            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.

            - `type: "input_image"`

              The type of the object. Always `input_image`.

              - `"input_image"`

          - `OutputText object { text, type }`

            Text produced by the assistant.

            - `text: string`

              The text produced by the assistant.

            - `type: "output_text"`

              The type of the object. Always `output_text`.

              - `"output_text"`

        - `phase: "commentary" or "final_answer" or 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" or "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.

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem object { id, status, summary, 2 more }`

        A reasoning item produced by the agent.

        - `id: string`

          The ID of the reasoning item.

        - `status: AgentOutputItemStatus or null`

          The status of the reasoning item.

        - `summary: array of SummaryText`

          The reasoning summaries produced by the agent.

          - `text: string`

            The reasoning summary text.

          - `type: "summary_text"`

            The content type. Always `summary_text`.

            - `"summary_text"`

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "reasoning"`

          The item type. Always `reasoning`.

          - `"reasoning"`

      - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

        A function call produced by the agent.

        - `id: string`

          The ID of the function call item.

        - `arguments: unknown`

          The arguments to pass to the function.

        - `call_id: string`

          The ID used to submit the function result.

        - `name: string`

          The name of the function to call.

        - `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.

        - `type: "function_call"`

          The item type. Always `function_call`.

          - `"function_call"`

      - `FunctionCallOutput object { id, call_id, error, 4 more }`

        The result supplied for a function call.

        - `id: string`

          The ID of the function call output item.

        - `call_id: string`

          The ID of the function call that produced this output.

        - `error: string or null`

          The error message, if the call failed.

        - `output: AgentFunctionCallOutput or null`

          The function result, if the call succeeded.

          - `string`

          - `array of InputContent`

            - `InputText object { text, type }`

              Text input recorded in a session item.

              - `text: string`

                The text supplied to the agent.

              - `type: "input_text"`

                The type of the object. Always `input_text`.

                - `"input_text"`

            - `InputImage object { image_url, type }`

              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.

              - `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.

        - `type: "function_call_output"`

          The item type. Always `function_call_output`.

          - `"function_call_output"`

      - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

        A message exchanged between agent threads.

        - `id: string`

          The ID of the message.

        - `content: array of AgentContent`

          The content exchanged between the agents.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

            - `text: string`

              The text produced by the agent.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

            - `encrypted_content: string`

              The encrypted content payload.

            - `type: "encrypted_content"`

              The content type. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient_agent_id: string`

          The ID or name of the receiving agent.

        - `sender_agent_id: string`

          The ID or name of the sending agent.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

      - `AgentMcpCallItem object { id, arguments, error, 6 more }`

        A call to a tool on an MCP server.

        - `id: string`

          The ID of the MCP call item.

        - `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.

        - `output: unknown`

          The output returned by the MCP tool, if any.

        - `server_label: string`

          The label of the MCP server.

        - `status: AgentFunctionCallStatus`

          The status of the MCP tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "mcp_call"`

          The item type. Always `mcp_call`.

          - `"mcp_call"`

      - `ComputerUseCall object { id, output, status, 3 more }`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

        - `output: object { image_url, type }  or 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.

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string or null`

          A model-generated description of the activity, when available.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

        - `request: object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

        - `turn_id: string`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

        A credential-free record of an admitted response, not proof of completion.

        - `id: string`

          The stable history item ID.

        - `request_id: string`

          The registered request answered by this item.

        - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

          The admitted response, without submitted credential values.

          - `Submit object { action, selected_option, type }`

            - `action: "submit"`

              - `"submit"`

            - `selected_option: string or null`

              The chosen sign-in method, or null when no options were offered.

            - `type: "browser_authentication"`

              - `"browser_authentication"`

          - `Cancel object { action, type }`

            - `action: "cancel"`

              - `"cancel"`

            - `type: "browser_authentication"`

              - `"browser_authentication"`

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_approval_request_result"`

          - `"computer_use_approval_request_result"`

      - `AgentWebSearchCallItem object { id, action, status, 2 more }`

        A web search call produced by the agent.

        - `id: string`

          The ID of the web search call.

        - `action: WebSearchAction or null`

          The action performed by the web search tool.

          - `Search object { queries, query, type }`

            A search query or group of search queries.

            - `queries: array of string or null`

              The search queries, when multiple queries were used.

            - `query: string or null`

              The search query, when a single query was used.

            - `type: "search"`

              The type of the object. Always `search`.

              - `"search"`

          - `OpenPage object { type, url }`

            Opens a web page.

            - `type: "open_page"`

              The type of the object. Always `open_page`.

              - `"open_page"`

            - `url: string or null`

              The URL of the page that was opened.

          - `FindInPage object { pattern, type, url }`

            Finds text within a web page.

            - `pattern: string or null`

              The text pattern that was searched for.

            - `type: "find_in_page"`

              The type of the object. Always `find_in_page`.

              - `"find_in_page"`

            - `url: string or null`

              The URL of the page that was searched.

          - `Other object { type }`

            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.

        - `type: "web_search_call"`

          The item type. Always `web_search_call`.

          - `"web_search_call"`

      - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

        A command execution produced by the agent.

        - `id: string`

          The ID of the command execution item.

        - `command: string`

          The command that was executed.

        - `cwd: string or null`

          The working directory used to execute the command.

        - `duration_ms: number or null`

          The command duration in milliseconds.

        - `exit_code: number or null`

          The process exit code, if the command completed.

        - `output: string or null`

          The command output, if available.

        - `status: AgentFunctionCallStatus`

          The status of the command execution.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "command_execution"`

          The item type. Always `command_execution`.

          - `"command_execution"`

      - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

        A request to spawn a subagent.

        - `id: string`

          The ID of the tool call item.

        - `agent_id: string`

          The ID of the agent that requested the subagent.

        - `content: array of AgentContent`

          The task given to the spawned agent.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

        - `model: string or null`

          The model requested for the spawned agent.

        - `reasoning_effort: string or null`

          The reasoning effort requested for the spawned agent.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "create_subagent_call"`

          The item type. Always `create_subagent_call`.

          - `"create_subagent_call"`

            The current public item type.

      - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

        A request to send input to another agent.

        - `id: string`

          The ID of the tool call item.

        - `content: array of AgentContent`

          The input sent to the receiving agent.

          - `OutputText object { text, type }`

            A text content part produced by the agent.

          - `EncryptedContent object { encrypted_content, type }`

            Encrypted content exchanged between agents.

        - `recipient_agent_id: string`

          The ID of the agent receiving the input.

        - `sender_agent_id: string`

          The ID of the agent sending the input.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "send_subagent_input_call"`

          The item type. Always `send_subagent_input_call`.

          - `"send_subagent_input_call"`

            The current public item type.

      - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to resume a subagent.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to resume.

        - `sender_agent_id: string`

          The ID of the agent requesting the resume.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "resume_subagent_call"`

          The item type. Always `resume_subagent_call`.

          - `"resume_subagent_call"`

            The current public item type.

      - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

        A request to wait for one or more subagents.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_ids: array of string`

          The IDs of the agents to wait for.

        - `sender_agent_id: string`

          The ID of the agent waiting for results.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "wait_for_subagents_call"`

          The item type. Always `wait_for_subagents_call`.

          - `"wait_for_subagents_call"`

            The current public item type.

      - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to interrupt a subagent's current turn. The subagent remains available.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to interrupt.

        - `sender_agent_id: string`

          The ID of the agent requesting the interrupt.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "interrupt_subagent_call"`

          The item type. Always `interrupt_subagent_call`.

          - `"interrupt_subagent_call"`

            The current public item type.

      - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to close a subagent.

        - `id: string`

          The ID of the tool call item.

        - `recipient_agent_id: string`

          The ID of the agent to close.

        - `sender_agent_id: string`

          The ID of the agent requesting the close.

        - `status: AgentFunctionCallStatus`

          The status of the tool call.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "close_subagent_call"`

          The item type. Always `close_subagent_call`.

          - `"close_subagent_call"`

            The current public item type.

    - `output_index: number or null`

      The index of the item in the turn output, when the item is agent output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.turn.item.added"`

      The type of the object. Always `agent.session.turn.item.added`.

      - `"agent.session.turn.item.added"`

  - `AgentSessionIdleEvent object { event_id, session, type }`

    Emitted when a session becomes idle.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The session that became idle.

    - `type: "agent.session.idle"`

      The type of the object. Always `agent.session.idle`.

      - `"agent.session.idle"`

  - `AgentSessionInProgressEvent object { event_id, session, type }`

    Emitted when a session starts processing a turn.

    - `event_id: string`

      The unique ID of the event.

    - `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"`

  - `AgentSessionRequiresActionEvent object { event_id, session, type }`

    Emitted when a session is waiting for one or more required actions.

    - `event_id: string`

      The unique ID of the event.

    - `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"`

  - `AgentSessionFailedEvent object { event_id, session, type }`

    Emitted when a session fails.

    - `event_id: string`

      The unique ID of the event.

    - `session: AgentSession`

      The failed session.

    - `type: "agent.session.failed"`

      The type of the object. Always `agent.session.failed`.

      - `"agent.session.failed"`

  - `AgentSessionEnvironmentPendingEvent object { environment, event_id, session_id, 2 more }`

    Emitted while a session environment is being prepared.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.pending"`

      The type of the object. Always `agent.session.environment.pending`.

      - `"agent.session.environment.pending"`

  - `AgentSessionEnvironmentConnectedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment connects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.connected"`

      The type of the object. Always `agent.session.environment.connected`.

      - `"agent.session.environment.connected"`

  - `AgentSessionEnvironmentDisconnectedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment disconnects.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.disconnected"`

      The type of the object. Always `agent.session.environment.disconnected`.

      - `"agent.session.environment.disconnected"`

  - `AgentSessionEnvironmentFailedEvent object { environment, event_id, session_id, 2 more }`

    Emitted when a session environment fails.

    - `environment: AgentSessionEnvironmentState`

      The current environment state.

    - `event_id: string`

      The unique ID of the event.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.environment.failed"`

      The type of the object. Always `agent.session.environment.failed`.

      - `"agent.session.environment.failed"`

  - `AgentSessionSubagentCreatedEvent object { event_id, subagent, type }`

    Emitted when a subagent is created.

    - `event_id: string`

      The unique ID of the event.

    - `subagent: Subagent`

      The subagent that was created.

      - `id: string`

        The ID of the subagent.

      - `closed_at: number or null`

        The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

      - `instructions: array of AgentContent or null`

        Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

        - `OutputText object { text, type }`

          A text content part produced by the agent.

        - `EncryptedContent object { encrypted_content, type }`

          Encrypted content exchanged between agents.

      - `name: string or null`

        The runner-assigned nickname, or null when unavailable.

      - `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.

      - `parent_agent_id: string`

        The ID of the agent that created this subagent.

      - `session_id: string`

        The ID of the session that owns the subagent.

      - `status: "active" or "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"`

  - `AgentSessionSubagentActiveEvent object { event_id, subagent, type }`

    Emitted when a closed subagent successfully resumes.

    - `event_id: string`

      The unique ID of the event.

    - `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"`

  - `AgentSessionSubagentClosedEvent object { event_id, subagent, type }`

    Emitted when a subagent is closed.

    - `event_id: string`

      The unique ID of the event.

    - `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"`

  - `AgentSessionTurnItemDoneEvent object { event_id, item, output_index, 3 more }`

    Emitted when an output item is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item: AgentOutputItem`

      The completed output item.

      - `AgentSessionAssistantMessage object { id, content, phase, 4 more }`

        An assistant message produced by the agent.

        - `id: string`

          The ID of the message.

        - `content: array of OutputText`

          The content of the message.

          - `text: string`

            The text produced by the agent.

          - `type: "output_text"`

            The content type. Always `output_text`.

        - `phase: "commentary" or "final_answer" or 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.

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

      - `AgentReasoningItem object { id, status, summary, 2 more }`

        A reasoning item produced by the agent.

      - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

        A function call produced by the agent.

      - `AgentMcpCallItem object { id, arguments, error, 6 more }`

        A call to a tool on an MCP server.

      - `ComputerUseCall object { id, output, status, 3 more }`

        One execution of the platform-provided computer-use capability.

        - `id: string`

          The ID of the activity item.

        - `output: object { image_url, type }  or 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.

          - `type: "computer_screenshot"`

            The content type. Always `computer_screenshot`.

            - `"computer_screenshot"`

        - `status: AgentFunctionCallStatus`

          The execution status of the activity.

        - `title: string or null`

          A model-generated description of the activity, when available.

        - `turn_id: string`

          The ID of the turn that contains this item.

        - `type: "computer_use_call"`

          The item type. Always `computer_use_call`.

          - `"computer_use_call"`

      - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

        A credential-free history record of the emitted login request.

        - `id: string`

          The stable history item ID.

        - `request: object { credential_origin, fields, options, 2 more }`

          A registered form awaiting the application's response.

          - `credential_origin: string or null`

            The registered form or frame origin where values will be entered.

          - `fields: array of object { id, label, required, type }`

            Controls to render. All submitted values are sensitive.

            - `id: string`

              The field ID to submit as field_id in a fields entry.

            - `label: string`

              The label to display beside the control.

            - `required: boolean`

              Whether this control requires a nonempty value.

            - `type: string`

              The rendering type, such as email, password, or text.

          - `options: array of object { id, field_ids, label }`

            Sign-in methods. Empty for a plain form.

            - `id: string`

              The option ID to submit as selected_option.

            - `field_ids: array of string`

              IDs from the registered fields that this method accepts.

            - `label: string`

              The method label to display.

          - `reason: string or null`

            Why the agent needs the user to sign in.

          - `type: "browser_authentication"`

            The type of the object. Always `browser_authentication`.

            - `"browser_authentication"`

        - `request_id: string`

        - `turn_id: string`

        - `type: "computer_use_approval_request"`

          The item type. Always computer_use_approval_request.

          - `"computer_use_approval_request"`

      - `AgentWebSearchCallItem object { id, action, status, 2 more }`

        A web search call produced by the agent.

      - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

        A command execution produced by the agent.

      - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

        A request to spawn a subagent.

      - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

        A request to send input to another agent.

      - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to resume a subagent.

      - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

        A request to wait for one or more subagents.

      - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to interrupt a subagent's current turn. The subagent remains available.

      - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

        A request to close a subagent.

    - `output_index: number`

      The index of the output item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `type: "agent.session.turn.item.done"`

      The type of the object. Always `agent.session.turn.item.done`.

      - `"agent.session.turn.item.done"`

  - `AgentSessionTurnContentPartAddedEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output text content part is added.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: OutputText`

      The initial content part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnContentPartDoneEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output content part is complete.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: OutputText`

      The completed content part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnOutputTextDeltaEvent object { content_index, delta, event_id, 5 more }`

    Emitted when text is appended to an output text content part.

    - `content_index: number`

      The index of the content part in the message.

    - `delta: string`

      The text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnOutputTextDoneEvent object { content_index, event_id, item_id, 5 more }`

    Emitted when an output text content part is complete.

    - `content_index: number`

      The index of the content part in the message.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the message item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `text: string`

      The complete output text.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnReasoningSummaryPartAddedEvent object { event_id, item_id, output_index, 5 more }`

    Emitted when a reasoning summary content part is added.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: SummaryText`

      The initial summary part.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnReasoningSummaryPartDoneEvent object { event_id, item_id, output_index, 6 more }`

    Emitted when a reasoning summary part is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `part: SummaryText`

      The completed summary part.

    - `session_id: string`

      The ID of the session associated with the event.

    - `status: "incomplete" or null`

      Present as `incomplete` when summary generation was interrupted.

      - `"incomplete"`

    - `summary_index: number`

      The index of the summary part.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnReasoningSummaryTextDeltaEvent object { delta, event_id, item_id, 5 more }`

    Emitted when text is appended to a reasoning summary.

    - `delta: string`

      The summary text that was appended.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

  - `AgentSessionTurnReasoningSummaryTextDoneEvent object { event_id, item_id, output_index, 5 more }`

    Emitted when a reasoning summary content part is complete.

    - `event_id: string`

      The unique ID of the event.

    - `item_id: string`

      The ID of the reasoning item.

    - `output_index: number`

      The index of the item in the turn output.

    - `session_id: string`

      The ID of the session associated with the event.

    - `summary_index: number`

      The index of the summary content part.

    - `text: string`

      The complete reasoning summary text.

    - `turn_id: string or null`

      The ID of the turn associated with the event, when applicable.

    - `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"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/events \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

# Items

## List agent session items

**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).

### Path Parameters

- `session_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of AgentSessionItem`

  The resources returned in this page, in the requested sort order.

  - `AgentSessionMessage object { id, content, phase, 4 more }`

    A user or assistant message recorded in a session.

    - `id: string or null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

    - `content: array of AgentSessionMessageContent`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      - `InputText object { text, type }`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        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.

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `OutputText object { text, type }`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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" or "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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

    - `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.

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutput object { id, call_id, error, 4 more }`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

    - `call_id: string`

      The ID of the function call that produced this output.

    - `error: string or null`

      The error message, if the call failed.

    - `output: AgentFunctionCallOutput or null`

      The function result, if the call succeeded.

      - `string`

      - `array of InputContent`

        - `InputText object { text, type }`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

          - `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.

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

    - `content: array of AgentContent`

      The content exchanged between the agents.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

    - `sender_agent_id: string`

      The ID or name of the sending agent.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

    - `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.

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

      A model-generated description of the activity, when available.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

        The registered form or frame origin where values will be entered.

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

          The field ID to submit as field_id in a fields entry.

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

    - `request_id: string`

      The registered request answered by this item.

    - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

      The admitted response, without submitted credential values.

      - `Submit object { action, selected_option, type }`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string or null`

          The chosen sign-in method, or null when no options were offered.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `Cancel object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/items \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `session_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of Subagent`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the subagent.

  - `closed_at: number or null`

    The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

  - `instructions: array of AgentContent or null`

    Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

    - `OutputText object { text, type }`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContent object { encrypted_content, type }`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string or null`

    The runner-assigned nickname, or null when unavailable.

  - `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.

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

  - `session_id: string`

    The ID of the session that owns the subagent.

  - `status: "active" or "closed"`

    The current status of the subagent.

    - `"active"`

      The subagent remains available, including while idle between turns.

    - `"closed"`

      The subagent is closed.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `session_id: string`

- `subagent_id: string`

### Returns

- `Subagent object { id, closed_at, instructions, 6 more }`

  A subagent created within a session.

  - `id: string`

    The ID of the subagent.

  - `closed_at: number or null`

    The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume.

  - `instructions: array of AgentContent or null`

    Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available.

    - `OutputText object { text, type }`

      A text content part produced by the agent.

      - `text: string`

        The text produced by the agent.

      - `type: "output_text"`

        The content type. Always `output_text`.

        - `"output_text"`

    - `EncryptedContent object { encrypted_content, type }`

      Encrypted content exchanged between agents.

      - `encrypted_content: string`

        The encrypted content payload.

      - `type: "encrypted_content"`

        The content type. Always `encrypted_content`.

        - `"encrypted_content"`

  - `name: string or null`

    The runner-assigned nickname, or null when unavailable.

  - `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.

  - `parent_agent_id: string`

    The ID of the agent that created this subagent.

  - `session_id: string`

    The ID of the session that owns the subagent.

  - `status: "active" or "closed"`

    The current status of the subagent.

    - `"active"`

      The subagent remains available, including while idle between turns.

    - `"closed"`

      The subagent is closed.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `session_id: string`

- `subagent_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of AgentSessionItem`

  The resources returned in this page, in the requested sort order.

  - `AgentSessionMessage object { id, content, phase, 4 more }`

    A user or assistant message recorded in a session.

    - `id: string or null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

    - `content: array of AgentSessionMessageContent`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      - `InputText object { text, type }`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        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.

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `OutputText object { text, type }`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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" or "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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

    - `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.

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutput object { id, call_id, error, 4 more }`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

    - `call_id: string`

      The ID of the function call that produced this output.

    - `error: string or null`

      The error message, if the call failed.

    - `output: AgentFunctionCallOutput or null`

      The function result, if the call succeeded.

      - `string`

      - `array of InputContent`

        - `InputText object { text, type }`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

          - `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.

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

    - `content: array of AgentContent`

      The content exchanged between the agents.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

    - `sender_agent_id: string`

      The ID or name of the sending agent.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

    - `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.

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

      A model-generated description of the activity, when available.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

        The registered form or frame origin where values will be entered.

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

          The field ID to submit as field_id in a fields entry.

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

    - `request_id: string`

      The registered request answered by this item.

    - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

      The admitted response, without submitted credential values.

      - `Submit object { action, selected_option, type }`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string or null`

          The chosen sign-in method, or null when no options were offered.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `Cancel object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/items \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `session_id: string`

- `subagent_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of Turn`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the turn.

  - `agent_id: string`

    The ID of the agent that ran the turn.

  - `completed_at: number or null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  - `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.

  - `error: SessionTurnError or null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"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.

  - `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.

  - `started_at: number or null`

    The Unix timestamp, in seconds, when the turn started.

  - `status: "queued" or "in_progress" or "waiting" or 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 or null`

    The ID of the subagent that ran the turn, if applicable.

  - `usage: TokenUsage or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve a subagent 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).

### Path Parameters

- `session_id: string`

- `subagent_id: string`

- `turn_id: string`

### Returns

- `Turn object { id, agent_id, completed_at, 8 more }`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

  - `agent_id: string`

    The ID of the agent that ran the turn.

  - `completed_at: number or null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  - `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.

  - `error: SessionTurnError or null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"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.

  - `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.

  - `started_at: number or null`

    The Unix timestamp, in seconds, when the turn started.

  - `status: "queued" or "in_progress" or "waiting" or 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 or null`

    The ID of the subagent that ran the turn, if applicable.

  - `usage: TokenUsage or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns/$TURN_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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
  }
}
```

# Items

## List subagent turn items

**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).

### Path Parameters

- `session_id: string`

- `subagent_id: string`

- `turn_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of AgentSessionItem`

  The resources returned in this page, in the requested sort order.

  - `AgentSessionMessage object { id, content, phase, 4 more }`

    A user or assistant message recorded in a session.

    - `id: string or null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

    - `content: array of AgentSessionMessageContent`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      - `InputText object { text, type }`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        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.

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `OutputText object { text, type }`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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" or "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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

    - `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.

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutput object { id, call_id, error, 4 more }`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

    - `call_id: string`

      The ID of the function call that produced this output.

    - `error: string or null`

      The error message, if the call failed.

    - `output: AgentFunctionCallOutput or null`

      The function result, if the call succeeded.

      - `string`

      - `array of InputContent`

        - `InputText object { text, type }`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

          - `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.

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

    - `content: array of AgentContent`

      The content exchanged between the agents.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

    - `sender_agent_id: string`

      The ID or name of the sending agent.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

    - `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.

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

      A model-generated description of the activity, when available.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

        The registered form or frame origin where values will be entered.

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

          The field ID to submit as field_id in a fields entry.

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

    - `request_id: string`

      The registered request answered by this item.

    - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

      The admitted response, without submitted credential values.

      - `Submit object { action, selected_option, type }`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string or null`

          The chosen sign-in method, or null when no options were offered.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `Cancel object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID/turns/$TURN_ID/items \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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.

### Path Parameters

- `session_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of SessionTrace`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The root turn ID. Use this ID as the pagination anchor.

  - `created_at: number`

    The Unix timestamp in seconds when the root turn was created.

  - `object: "agent.session.trace"`

    The object type, which is always `agent.session.trace`.

    - `"agent.session.trace"`

  - `otlp: map[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.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/traces \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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 object { id, created_at, object, 2 more }`

  - `id: string`

    The root turn ID. Use this ID as the pagination anchor.

  - `created_at: number`

    The Unix timestamp in seconds when the root turn was created.

  - `object: "agent.session.trace"`

    The object type, which is always `agent.session.trace`.

    - `"agent.session.trace"`

  - `otlp: map[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.

# Turns

## List agent session turns

**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).

### Path Parameters

- `session_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of Turn`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the turn.

  - `agent_id: string`

    The ID of the agent that ran the turn.

  - `completed_at: number or null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  - `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.

  - `error: SessionTurnError or null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"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.

  - `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.

  - `started_at: number or null`

    The Unix timestamp, in seconds, when the turn started.

  - `status: "queued" or "in_progress" or "waiting" or 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 or null`

    The ID of the subagent that ran the turn, if applicable.

  - `usage: TokenUsage or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/turns \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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
      }
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

## Retrieve an agent session 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).

### Path Parameters

- `session_id: string`

- `turn_id: string`

### Returns

- `Turn object { id, agent_id, completed_at, 8 more }`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

  - `agent_id: string`

    The ID of the agent that ran the turn.

  - `completed_at: number or null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  - `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.

  - `error: SessionTurnError or null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"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.

  - `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.

  - `started_at: number or null`

    The Unix timestamp, in seconds, when the turn started.

  - `status: "queued" or "in_progress" or "waiting" or 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 or null`

    The ID of the subagent that ran the turn, if applicable.

  - `usage: TokenUsage or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/turns/$TURN_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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
  }
}
```

## Domain Types

### Turn

- `Turn object { id, agent_id, completed_at, 8 more }`

  The canonical public representation of a session turn.

  - `id: string`

    The ID of the turn.

  - `agent_id: string`

    The ID of the agent that ran the turn.

  - `completed_at: number or null`

    The Unix timestamp, in seconds, when the turn reached a terminal state.

  - `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.

  - `error: SessionTurnError or null`

    A customer-safe error. Non-null only for a failed turn.

    - `code: "context_length_exceeded" or "session_budget_exceeded" or "usage_limit_exceeded" or 20 more`

      A stable, machine-readable failure category.

      - `"context_length_exceeded"`

        The request exceeds the model's context window.

      - `"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.

  - `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.

  - `started_at: number or null`

    The Unix timestamp, in seconds, when the turn started.

  - `status: "queued" or "in_progress" or "waiting" or 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 or null`

    The ID of the subagent that ran the turn, if applicable.

  - `usage: TokenUsage or 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.

    - `input_tokens_details: object { cached_tokens }`

      A breakdown of the agent's input token usage.

      - `cached_tokens: number`

        The number of input tokens retrieved from the prompt cache.

    - `output_tokens: number`

      The number of output tokens generated by the agent.

    - `output_tokens_details: object { reasoning_tokens }`

      A breakdown of the agent's output token usage.

      - `reasoning_tokens: number`

        The number of output tokens used for reasoning.

    - `total_tokens: number`

      The total number of input and output tokens used by the agent.

# Items

## List agent session turn items

**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).

### Path Parameters

- `session_id: string`

- `turn_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `order: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

### Returns

- `data: array of AgentSessionItem`

  The resources returned in this page, in the requested sort order.

  - `AgentSessionMessage object { id, content, phase, 4 more }`

    A user or assistant message recorded in a session.

    - `id: string or null`

      The ID of this item, or null for legacy user messages whose ID was not recorded.

    - `content: array of AgentSessionMessageContent`

      The content of the message. User messages contain input text or images; assistant messages contain output text.

      - `InputText object { text, type }`

        Text supplied by the user.

        - `text: string`

          The text supplied by the user.

        - `type: "input_text"`

          The type of the object. Always `input_text`.

          - `"input_text"`

      - `InputImage object { image_url, type }`

        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.

        - `type: "input_image"`

          The type of the object. Always `input_image`.

          - `"input_image"`

      - `OutputText object { text, type }`

        Text produced by the assistant.

        - `text: string`

          The text produced by the assistant.

        - `type: "output_text"`

          The type of the object. Always `output_text`.

          - `"output_text"`

    - `phase: "commentary" or "final_answer" or 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" or "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.

    - `type: "message"`

      The item type. Always `message`.

      - `"message"`

  - `AgentReasoningItem object { id, status, summary, 2 more }`

    A reasoning item produced by the agent.

    - `id: string`

      The ID of the reasoning item.

    - `status: AgentOutputItemStatus or null`

      The status of the reasoning item.

    - `summary: array of SummaryText`

      The reasoning summaries produced by the agent.

      - `text: string`

        The reasoning summary text.

      - `type: "summary_text"`

        The content type. Always `summary_text`.

        - `"summary_text"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "reasoning"`

      The item type. Always `reasoning`.

      - `"reasoning"`

  - `AgentFunctionCallItem object { id, arguments, call_id, 4 more }`

    A function call produced by the agent.

    - `id: string`

      The ID of the function call item.

    - `arguments: unknown`

      The arguments to pass to the function.

    - `call_id: string`

      The ID used to submit the function result.

    - `name: string`

      The name of the function to call.

    - `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.

    - `type: "function_call"`

      The item type. Always `function_call`.

      - `"function_call"`

  - `FunctionCallOutput object { id, call_id, error, 4 more }`

    The result supplied for a function call.

    - `id: string`

      The ID of the function call output item.

    - `call_id: string`

      The ID of the function call that produced this output.

    - `error: string or null`

      The error message, if the call failed.

    - `output: AgentFunctionCallOutput or null`

      The function result, if the call succeeded.

      - `string`

      - `array of InputContent`

        - `InputText object { text, type }`

          Text input recorded in a session item.

          - `text: string`

            The text supplied to the agent.

          - `type: "input_text"`

            The type of the object. Always `input_text`.

            - `"input_text"`

        - `InputImage object { image_url, type }`

          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.

          - `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.

    - `type: "function_call_output"`

      The item type. Always `function_call_output`.

      - `"function_call_output"`

  - `AgentMessage object { id, content, recipient_agent_id, 3 more }`

    A message exchanged between agent threads.

    - `id: string`

      The ID of the message.

    - `content: array of AgentContent`

      The content exchanged between the agents.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

        - `text: string`

          The text produced by the agent.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

        - `encrypted_content: string`

          The encrypted content payload.

        - `type: "encrypted_content"`

          The content type. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient_agent_id: string`

      The ID or name of the receiving agent.

    - `sender_agent_id: string`

      The ID or name of the sending agent.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "agent_message"`

      The item type. Always `agent_message`.

      - `"agent_message"`

  - `AgentMcpCallItem object { id, arguments, error, 6 more }`

    A call to a tool on an MCP server.

    - `id: string`

      The ID of the MCP call item.

    - `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.

    - `output: unknown`

      The output returned by the MCP tool, if any.

    - `server_label: string`

      The label of the MCP server.

    - `status: AgentFunctionCallStatus`

      The status of the MCP tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "mcp_call"`

      The item type. Always `mcp_call`.

      - `"mcp_call"`

  - `ComputerUseCall object { id, output, status, 3 more }`

    One execution of the platform-provided computer-use capability.

    - `id: string`

      The ID of the activity item.

    - `output: object { image_url, type }  or 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.

      - `type: "computer_screenshot"`

        The content type. Always `computer_screenshot`.

        - `"computer_screenshot"`

    - `status: AgentFunctionCallStatus`

      The execution status of the activity.

    - `title: string or null`

      A model-generated description of the activity, when available.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_call"`

      The item type. Always `computer_use_call`.

      - `"computer_use_call"`

  - `ComputerUseApprovalRequest object { id, request, request_id, 2 more }`

    A credential-free history record of the emitted login request.

    - `id: string`

      The stable history item ID.

    - `request: object { credential_origin, fields, options, 2 more }`

      A registered form awaiting the application's response.

      - `credential_origin: string or null`

        The registered form or frame origin where values will be entered.

      - `fields: array of object { id, label, required, type }`

        Controls to render. All submitted values are sensitive.

        - `id: string`

          The field ID to submit as field_id in a fields entry.

        - `label: string`

          The label to display beside the control.

        - `required: boolean`

          Whether this control requires a nonempty value.

        - `type: string`

          The rendering type, such as email, password, or text.

      - `options: array of object { id, field_ids, label }`

        Sign-in methods. Empty for a plain form.

        - `id: string`

          The option ID to submit as selected_option.

        - `field_ids: array of string`

          IDs from the registered fields that this method accepts.

        - `label: string`

          The method label to display.

      - `reason: string or null`

        Why the agent needs the user to sign in.

      - `type: "browser_authentication"`

        The type of the object. Always `browser_authentication`.

        - `"browser_authentication"`

    - `request_id: string`

    - `turn_id: string`

    - `type: "computer_use_approval_request"`

      The item type. Always computer_use_approval_request.

      - `"computer_use_approval_request"`

  - `ComputerUseApprovalRequestResult object { id, request_id, response, 2 more }`

    A credential-free record of an admitted response, not proof of completion.

    - `id: string`

      The stable history item ID.

    - `request_id: string`

      The registered request answered by this item.

    - `response: Submit { action, selected_option, type }  or Cancel { action, type }`

      The admitted response, without submitted credential values.

      - `Submit object { action, selected_option, type }`

        - `action: "submit"`

          - `"submit"`

        - `selected_option: string or null`

          The chosen sign-in method, or null when no options were offered.

        - `type: "browser_authentication"`

          - `"browser_authentication"`

      - `Cancel object { action, type }`

        - `action: "cancel"`

          - `"cancel"`

        - `type: "browser_authentication"`

          - `"browser_authentication"`

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "computer_use_approval_request_result"`

      - `"computer_use_approval_request_result"`

  - `AgentWebSearchCallItem object { id, action, status, 2 more }`

    A web search call produced by the agent.

    - `id: string`

      The ID of the web search call.

    - `action: WebSearchAction or null`

      The action performed by the web search tool.

      - `Search object { queries, query, type }`

        A search query or group of search queries.

        - `queries: array of string or null`

          The search queries, when multiple queries were used.

        - `query: string or null`

          The search query, when a single query was used.

        - `type: "search"`

          The type of the object. Always `search`.

          - `"search"`

      - `OpenPage object { type, url }`

        Opens a web page.

        - `type: "open_page"`

          The type of the object. Always `open_page`.

          - `"open_page"`

        - `url: string or null`

          The URL of the page that was opened.

      - `FindInPage object { pattern, type, url }`

        Finds text within a web page.

        - `pattern: string or null`

          The text pattern that was searched for.

        - `type: "find_in_page"`

          The type of the object. Always `find_in_page`.

          - `"find_in_page"`

        - `url: string or null`

          The URL of the page that was searched.

      - `Other object { type }`

        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.

    - `type: "web_search_call"`

      The item type. Always `web_search_call`.

      - `"web_search_call"`

  - `AgentCommandExecutionItem object { id, command, cwd, 6 more }`

    A command execution produced by the agent.

    - `id: string`

      The ID of the command execution item.

    - `command: string`

      The command that was executed.

    - `cwd: string or null`

      The working directory used to execute the command.

    - `duration_ms: number or null`

      The command duration in milliseconds.

    - `exit_code: number or null`

      The process exit code, if the command completed.

    - `output: string or null`

      The command output, if available.

    - `status: AgentFunctionCallStatus`

      The status of the command execution.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "command_execution"`

      The item type. Always `command_execution`.

      - `"command_execution"`

  - `AgentCreateSubagentCallItem object { id, agent_id, content, 5 more }`

    A request to spawn a subagent.

    - `id: string`

      The ID of the tool call item.

    - `agent_id: string`

      The ID of the agent that requested the subagent.

    - `content: array of AgentContent`

      The task given to the spawned agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `model: string or null`

      The model requested for the spawned agent.

    - `reasoning_effort: string or null`

      The reasoning effort requested for the spawned agent.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "create_subagent_call"`

      The item type. Always `create_subagent_call`.

      - `"create_subagent_call"`

        The current public item type.

  - `AgentSendSubagentInputCallItem object { id, content, recipient_agent_id, 4 more }`

    A request to send input to another agent.

    - `id: string`

      The ID of the tool call item.

    - `content: array of AgentContent`

      The input sent to the receiving agent.

      - `OutputText object { text, type }`

        A text content part produced by the agent.

      - `EncryptedContent object { encrypted_content, type }`

        Encrypted content exchanged between agents.

    - `recipient_agent_id: string`

      The ID of the agent receiving the input.

    - `sender_agent_id: string`

      The ID of the agent sending the input.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "send_subagent_input_call"`

      The item type. Always `send_subagent_input_call`.

      - `"send_subagent_input_call"`

        The current public item type.

  - `AgentResumeSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to resume a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to resume.

    - `sender_agent_id: string`

      The ID of the agent requesting the resume.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "resume_subagent_call"`

      The item type. Always `resume_subagent_call`.

      - `"resume_subagent_call"`

        The current public item type.

  - `AgentWaitForSubagentsCallItem object { id, recipient_agent_ids, sender_agent_id, 3 more }`

    A request to wait for one or more subagents.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_ids: array of string`

      The IDs of the agents to wait for.

    - `sender_agent_id: string`

      The ID of the agent waiting for results.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "wait_for_subagents_call"`

      The item type. Always `wait_for_subagents_call`.

      - `"wait_for_subagents_call"`

        The current public item type.

  - `AgentInterruptSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to interrupt a subagent's current turn. The subagent remains available.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to interrupt.

    - `sender_agent_id: string`

      The ID of the agent requesting the interrupt.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "interrupt_subagent_call"`

      The item type. Always `interrupt_subagent_call`.

      - `"interrupt_subagent_call"`

        The current public item type.

  - `AgentCloseSubagentCallItem object { id, recipient_agent_id, sender_agent_id, 3 more }`

    A request to close a subagent.

    - `id: string`

      The ID of the tool call item.

    - `recipient_agent_id: string`

      The ID of the agent to close.

    - `sender_agent_id: string`

      The ID of the agent requesting the close.

    - `status: AgentFunctionCallStatus`

      The status of the tool call.

    - `turn_id: string`

      The ID of the turn that contains this item.

    - `type: "close_subagent_call"`

      The item type. Always `close_subagent_call`.

      - `"close_subagent_call"`

        The current public item type.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/turns/$TURN_ID/items \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**post** `/vaults`

Creates a vault for the current project. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Body Parameters

- `metadata: optional map[string] or null`

  Key-value pairs to associate with the vault, such as an application or team identifier.

- `name: optional string`

  The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

### Returns

- `Vault object { id, created_at, metadata, 2 more }`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

  - `metadata: map[string]`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string or null`

    The human-readable name of the vault, if set.

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```http
curl https://api.openai.com/v1/vaults \
    -X POST \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Delete a vault

**delete** `/vaults/{vault_id}`

Deletes a vault and all its credentials. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Path Parameters

- `vault_id: string`

### Returns

- `VaultDeleted object { id, deleted, object }`

  Confirmation that a vault was deleted.

  - `id: string`

    The ID of the deleted vault.

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.deleted"`

    The object type. Always `vault.deleted`.

    - `"vault.deleted"`

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "vault.deleted"
}
```

## List vaults

**get** `/vaults`

Lists vaults using ID-based pagination. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `metadata: optional map[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: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

- `status: optional 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" or "archived"`

    Whether a vault or credential is active or archived.

    - `"active"`

    - `"archived"`

  - `array of VaultStatus`

    - `"active"`

    - `"archived"`

### Returns

- `data: array of Vault`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the vault.

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

  - `metadata: map[string]`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string or null`

    The human-readable name of the vault, if set.

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/vaults \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**get** `/vaults/{vault_id}`

Retrieves a vault by its ID. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Path Parameters

- `vault_id: string`

### Returns

- `Vault object { id, created_at, metadata, 2 more }`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

  - `metadata: map[string]`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string or null`

    The human-readable name of the vault, if set.

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Update a 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).

### Path Parameters

- `vault_id: string`

### Body Parameters

- `metadata: optional map[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: optional string or 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.

### Returns

- `Vault object { id, created_at, metadata, 2 more }`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

  - `metadata: map[string]`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string or null`

    The human-readable name of the vault, if set.

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
```

## Domain Types

### Vault

- `Vault object { id, created_at, metadata, 2 more }`

  A collection of credentials for MCP servers and OpenAI-hosted environments.

  - `id: string`

    The ID of the vault.

  - `created_at: number`

    The Unix timestamp, in seconds, when the vault was created.

  - `metadata: map[string]`

    Key-value pairs associated with the vault, such as an application or team identifier.

  - `name: string or null`

    The human-readable name of the vault, if set.

  - `object: "vault"`

    The object type. Always `vault`.

    - `"vault"`

### Vault Deleted

- `VaultDeleted object { id, deleted, object }`

  Confirmation that a vault was deleted.

  - `id: string`

    The ID of the deleted vault.

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.deleted"`

    The object type. Always `vault.deleted`.

    - `"vault.deleted"`

### Vault Status

- `VaultStatus = "active" or "archived"`

  Whether a vault or credential is active or archived.

  - `"active"`

  - `"archived"`

### Vault Status Filter

- `VaultStatusFilter = VaultStatus or array of VaultStatus`

  One or more lifecycle statuses to include when listing vaults or credentials.

  - `VaultStatus = "active" or "archived"`

    Whether a vault or credential is active or archived.

    - `"active"`

    - `"archived"`

  - `array of VaultStatus`

    - `"active"`

    - `"archived"`

# Credentials

## Create a vault 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).

### Path Parameters

- `vault_id: string`

### Body Parameters

- `auth: CredentialAuthCreateParam`

  The authentication method and write-only secret values to store.

  - `McpOauth object { access_token, mcp_server_url, type, 2 more }`

    An OAuth credential for an HTTPS MCP destination.

    - `access_token: string`

      A write-only OAuth access token; never returned by credential resources.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `expires_at: optional string or null`

      When the OAuth access token expires, as an RFC 3339 timestamp, if known.

    - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more }  or null`

      Optional refresh configuration for an HTTPS OAuth token endpoint.

      - `client_id: string`

        The OAuth client ID used when requesting a new access token.

      - `refresh_token: string`

        The refresh token to store. This secret is never returned in credential resources.

      - `token_endpoint: string`

        The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token.

      - `token_endpoint_auth: McpOauthTokenEndpointAuthCreateParam`

        How the OAuth client authenticates to the token endpoint.

        - `None object { type }`

          Sends the client ID without a client secret.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `ClientSecretBasic object { client_secret, type }`

          Sends the client ID and secret using HTTP Basic authentication.

          - `client_secret: string`

            The OAuth client secret to store. Never returned in credential resources.

          - `type: "client_secret_basic"`

            The type of the object. Always `client_secret_basic`.

            - `"client_secret_basic"`

        - `ClientSecretPost object { client_secret, type }`

          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.

          - `type: "client_secret_post"`

            The type of the object. Always `client_secret_post`.

            - `"client_secret_post"`

      - `resource: optional string or null`

        The resource URI to send to the OAuth token endpoint during refresh, if required.

      - `scope: optional string or null`

        Space-separated OAuth scopes to request during refresh, if required.

  - `StaticBearer object { token, mcp_server_url, type }`

    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.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `EnvironmentVariable object { networking, secret_name, secret_value, type }`

    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.

      - `Unrestricted object { type }`

        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"`

      - `Limited object { allowed_hosts, type }`

        Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

        - `allowed_hosts: array of 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.

        - `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.

    - `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.

    - `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.

- `metadata: optional map[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 object { id, auth, created_at, 5 more }`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string or null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `refresh: object { client_id, resource, scope, 2 more }  or 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.

        - `resource: string or null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

        - `scope: string or null`

          Space-separated OAuth scopes requested during refresh, if configured.

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `None object { type }`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `ClientSecretBasic object { type }`

            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"`

          - `ClientSecretPost object { type }`

            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"`

    - `StaticBearer object { mcp_server_url, type }`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `EnvironmentVariable object { networking, secret_name, type }`

      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.

        - `Unrestricted object { type }`

          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"`

        - `Limited object { allowed_hosts, type }`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: array of 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.

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

      - `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.

  - `metadata: map[string]`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

  - `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.

  - `vault_id: string`

    The ID of the vault containing this credential.

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "auth": {
            "access_token": "access_token",
            "mcp_server_url": "mcp_server_url",
            "type": "mcp_oauth"
          },
          "name": "x"
        }'
```

#### Response

```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

**delete** `/vaults/{vault_id}/credentials/{credential_id}`

Deletes a vault credential. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Path Parameters

- `vault_id: string`

- `credential_id: string`

### Returns

- `CredentialDeleted object { id, deleted, object }`

  Confirmation that a vault credential was deleted.

  - `id: string`

    The ID of the deleted credential.

  - `deleted: boolean`

    Whether the resource was deleted. Always `true`.

  - `object: "vault.credential.deleted"`

    The object type. Always `vault.credential.deleted`.

    - `"vault.credential.deleted"`

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \
    -X DELETE \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "vault.credential.deleted"
}
```

## List vault credentials

**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).

### Path Parameters

- `vault_id: string`

### Query Parameters

- `after: optional string`

  Return resources after this resource ID in the selected order.

- `limit: optional number`

  The maximum number of resources to return, between 1 and 100. Defaults to 20.

- `metadata: optional map[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: optional "asc" or "desc"`

  The order in which resources are returned. Defaults to `desc`.

  - `"asc"`

    Returns resources in ascending order.

  - `"desc"`

    Returns resources in descending order.

- `status: optional 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" or "archived"`

    Whether a vault or credential is active or archived.

    - `"active"`

    - `"archived"`

  - `array of VaultStatus`

    - `"active"`

    - `"archived"`

### Returns

- `data: array of Credential`

  The resources returned in this page, in the requested sort order.

  - `id: string`

    The ID of the credential.

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string or null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `refresh: object { client_id, resource, scope, 2 more }  or 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.

        - `resource: string or null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

        - `scope: string or null`

          Space-separated OAuth scopes requested during refresh, if configured.

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `None object { type }`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `ClientSecretBasic object { type }`

            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"`

          - `ClientSecretPost object { type }`

            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"`

    - `StaticBearer object { mcp_server_url, type }`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `EnvironmentVariable object { networking, secret_name, type }`

      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.

        - `Unrestricted object { type }`

          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"`

        - `Limited object { allowed_hosts, type }`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: array of 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.

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

      - `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.

  - `metadata: map[string]`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

  - `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.

  - `vault_id: string`

    The ID of the vault containing this credential.

- `first_id: string or null`

  The ID of the first resource in `data`, or `null` if the page is empty.

- `has_more: boolean`

  Whether there are more resources to retrieve after this page.

- `last_id: string or null`

  The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters.

- `object: "list"`

  The object type, which is always `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**get** `/vaults/{vault_id}/credentials/{credential_id}`

Retrieves vault credential metadata without returning secret values. See [vaults](/api/docs/guides/agents-api/tools/vaults).

### Path Parameters

- `vault_id: string`

- `credential_id: string`

### Returns

- `Credential object { id, auth, created_at, 5 more }`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string or null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `refresh: object { client_id, resource, scope, 2 more }  or 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.

        - `resource: string or null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

        - `scope: string or null`

          Space-separated OAuth scopes requested during refresh, if configured.

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `None object { type }`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `ClientSecretBasic object { type }`

            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"`

          - `ClientSecretPost object { type }`

            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"`

    - `StaticBearer object { mcp_server_url, type }`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `EnvironmentVariable object { networking, secret_name, type }`

      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.

        - `Unrestricted object { type }`

          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"`

        - `Limited object { allowed_hosts, type }`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: array of 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.

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

      - `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.

  - `metadata: map[string]`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

  - `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.

  - `vault_id: string`

    The ID of the vault containing this credential.

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Path Parameters

- `vault_id: string`

- `credential_id: string`

### Body Parameters

- `auth: optional CredentialAuthRotateParam`

  Replacement values for the credential's existing authentication method.

  - `McpOauth object { type, access_token, expires_at, refresh }`

    Rotate an OAuth credential for an HTTPS MCP destination.

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `access_token: optional string or null`

      A write-only replacement OAuth access token.

    - `expires_at: optional string or 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.

    - `refresh: optional object { refresh_token, scope, token_endpoint_auth }  or null`

      Optional write-only refresh-token and client-secret updates.

      - `refresh_token: optional string or null`

        The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources.

      - `scope: optional string or null`

        Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter.

      - `token_endpoint_auth: optional McpOauthTokenEndpointAuthRotateParam or null`

        Client-secret updates for the existing token endpoint authentication method.

        - `ClientSecretBasic object { type, client_secret }`

          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: optional string or null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

        - `ClientSecretPost object { type, client_secret }`

          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: optional string or null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

  - `StaticBearer object { token, type }`

    Replace the bearer token for the credential's MCP server.

    - `token: string`

      The replacement bearer token. This secret is never returned in credential resources.

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `EnvironmentVariable object { secret_value, type }`

    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.

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

- `metadata: optional map[string]`

  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 object { id, auth, created_at, 5 more }`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string or null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `refresh: object { client_id, resource, scope, 2 more }  or 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.

        - `resource: string or null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

        - `scope: string or null`

          Space-separated OAuth scopes requested during refresh, if configured.

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `None object { type }`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `ClientSecretBasic object { type }`

            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"`

          - `ClientSecretPost object { type }`

            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"`

    - `StaticBearer object { mcp_server_url, type }`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `EnvironmentVariable object { networking, secret_name, type }`

      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.

        - `Unrestricted object { type }`

          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"`

        - `Limited object { allowed_hosts, type }`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: array of 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.

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

      - `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.

  - `metadata: map[string]`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

  - `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.

  - `vault_id: string`

    The ID of the vault containing this credential.

### Example

```http
curl https://api.openai.com/v1/vaults/$VAULT_ID/credentials/$CREDENTIAL_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'
```

#### Response

```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 object { id, auth, created_at, 5 more }`

  Metadata for a stored credential. Secret values are never returned.

  - `id: string`

    The ID of the credential.

  - `auth: CredentialAuth`

    The authentication method and non-secret configuration of the credential.

    - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

      Public metadata for an OAuth credential; tokens and client secrets are never returned.

      - `expires_at: string or null`

        When the OAuth access token expires, as an RFC 3339 timestamp, if known.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `refresh: object { client_id, resource, scope, 2 more }  or 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.

        - `resource: string or null`

          The resource URI sent to the OAuth token endpoint during refresh, if configured.

        - `scope: string or null`

          Space-separated OAuth scopes requested during refresh, if configured.

        - `token_endpoint: string`

          The HTTPS OAuth token endpoint used for refresh.

        - `token_endpoint_auth: McpOauthTokenEndpointAuth`

          How the OAuth client authenticates to the token endpoint, excluding its client secret.

          - `None object { type }`

            Sends the client ID without a client secret.

            - `type: "none"`

              The type of the object. Always `none`.

              - `"none"`

          - `ClientSecretBasic object { type }`

            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"`

          - `ClientSecretPost object { type }`

            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"`

    - `StaticBearer object { mcp_server_url, type }`

      Metadata for a bearer-token credential, without automatic OAuth refresh.

      - `mcp_server_url: string`

        The HTTPS MCP server URL authorized by this credential.

      - `type: "static_bearer"`

        The type of the object. Always `static_bearer`.

        - `"static_bearer"`

    - `EnvironmentVariable object { networking, secret_name, type }`

      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.

        - `Unrestricted object { type }`

          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"`

        - `Limited object { allowed_hosts, type }`

          Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

          - `allowed_hosts: array of 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.

          - `type: "limited"`

            The type of the object. Always `limited`.

            - `"limited"`

      - `secret_name: string`

        The environment variable name that receives the placeholder in the sandbox.

      - `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.

  - `metadata: map[string]`

    Application-defined key-value pairs associated with this credential.

  - `name: string`

    The human-readable name of the credential.

  - `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.

  - `vault_id: string`

    The ID of the vault containing this credential.

### Credential Auth

- `CredentialAuth = McpOauth { expires_at, mcp_server_url, refresh, type }  or StaticBearer { mcp_server_url, type }  or EnvironmentVariable { networking, secret_name, type }`

  The authentication configuration of a vault credential, excluding secrets.

  - `McpOauth object { expires_at, mcp_server_url, refresh, type }`

    Public metadata for an OAuth credential; tokens and client secrets are never returned.

    - `expires_at: string or null`

      When the OAuth access token expires, as an RFC 3339 timestamp, if known.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `refresh: object { client_id, resource, scope, 2 more }  or 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.

      - `resource: string or null`

        The resource URI sent to the OAuth token endpoint during refresh, if configured.

      - `scope: string or null`

        Space-separated OAuth scopes requested during refresh, if configured.

      - `token_endpoint: string`

        The HTTPS OAuth token endpoint used for refresh.

      - `token_endpoint_auth: McpOauthTokenEndpointAuth`

        How the OAuth client authenticates to the token endpoint, excluding its client secret.

        - `None object { type }`

          Sends the client ID without a client secret.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `ClientSecretBasic object { type }`

          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"`

        - `ClientSecretPost object { type }`

          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"`

  - `StaticBearer object { mcp_server_url, type }`

    Metadata for a bearer-token credential, without automatic OAuth refresh.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `EnvironmentVariable object { networking, secret_name, type }`

    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.

      - `Unrestricted object { type }`

        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"`

      - `Limited object { allowed_hosts, type }`

        Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

        - `allowed_hosts: array of 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.

        - `type: "limited"`

          The type of the object. Always `limited`.

          - `"limited"`

    - `secret_name: string`

      The environment variable name that receives the placeholder in the sandbox.

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Auth Create Param

- `CredentialAuthCreateParam = McpOauth { access_token, mcp_server_url, type, 2 more }  or StaticBearer { token, mcp_server_url, type }  or EnvironmentVariable { networking, secret_name, secret_value, type }`

  Authentication credentials for an MCP server or an OpenAI-hosted environment.

  - `McpOauth object { access_token, mcp_server_url, type, 2 more }`

    An OAuth credential for an HTTPS MCP destination.

    - `access_token: string`

      A write-only OAuth access token; never returned by credential resources.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `expires_at: optional string or null`

      When the OAuth access token expires, as an RFC 3339 timestamp, if known.

    - `refresh: optional object { client_id, refresh_token, token_endpoint, 3 more }  or null`

      Optional refresh configuration for an HTTPS OAuth token endpoint.

      - `client_id: string`

        The OAuth client ID used when requesting a new access token.

      - `refresh_token: string`

        The refresh token to store. This secret is never returned in credential resources.

      - `token_endpoint: string`

        The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token.

      - `token_endpoint_auth: McpOauthTokenEndpointAuthCreateParam`

        How the OAuth client authenticates to the token endpoint.

        - `None object { type }`

          Sends the client ID without a client secret.

          - `type: "none"`

            The type of the object. Always `none`.

            - `"none"`

        - `ClientSecretBasic object { client_secret, type }`

          Sends the client ID and secret using HTTP Basic authentication.

          - `client_secret: string`

            The OAuth client secret to store. Never returned in credential resources.

          - `type: "client_secret_basic"`

            The type of the object. Always `client_secret_basic`.

            - `"client_secret_basic"`

        - `ClientSecretPost object { client_secret, type }`

          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.

          - `type: "client_secret_post"`

            The type of the object. Always `client_secret_post`.

            - `"client_secret_post"`

      - `resource: optional string or null`

        The resource URI to send to the OAuth token endpoint during refresh, if required.

      - `scope: optional string or null`

        Space-separated OAuth scopes to request during refresh, if required.

  - `StaticBearer object { token, mcp_server_url, type }`

    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.

    - `mcp_server_url: string`

      The HTTPS MCP server URL authorized by this credential.

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `EnvironmentVariable object { networking, secret_name, secret_value, type }`

    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.

      - `Unrestricted object { type }`

        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"`

      - `Limited object { allowed_hosts, type }`

        Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

        - `allowed_hosts: array of 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.

        - `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.

    - `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.

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Auth Rotate Param

- `CredentialAuthRotateParam = McpOauth { type, access_token, expires_at, refresh }  or StaticBearer { token, type }  or EnvironmentVariable { secret_value, type }`

  Updates to a vault credential without changing its authentication method or destination configuration.

  - `McpOauth object { type, access_token, expires_at, refresh }`

    Rotate an OAuth credential for an HTTPS MCP destination.

    - `type: "mcp_oauth"`

      The type of the object. Always `mcp_oauth`.

      - `"mcp_oauth"`

    - `access_token: optional string or null`

      A write-only replacement OAuth access token.

    - `expires_at: optional string or 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.

    - `refresh: optional object { refresh_token, scope, token_endpoint_auth }  or null`

      Optional write-only refresh-token and client-secret updates.

      - `refresh_token: optional string or null`

        The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources.

      - `scope: optional string or null`

        Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter.

      - `token_endpoint_auth: optional McpOauthTokenEndpointAuthRotateParam or null`

        Client-secret updates for the existing token endpoint authentication method.

        - `ClientSecretBasic object { type, client_secret }`

          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: optional string or null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

        - `ClientSecretPost object { type, client_secret }`

          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: optional string or null`

            The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

  - `StaticBearer object { token, type }`

    Replace the bearer token for the credential's MCP server.

    - `token: string`

      The replacement bearer token. This secret is never returned in credential resources.

    - `type: "static_bearer"`

      The type of the object. Always `static_bearer`.

      - `"static_bearer"`

  - `EnvironmentVariable object { secret_value, type }`

    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.

    - `type: "environment_variable"`

      The type of the object. Always `environment_variable`.

      - `"environment_variable"`

### Credential Deleted

- `CredentialDeleted object { id, deleted, object }`

  Confirmation that a vault credential was deleted.

  - `id: string`

    The ID of the deleted credential.

  - `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 = Unrestricted { type }  or Limited { allowed_hosts, type }`

  Destination permissions for an environment-variable credential. These do not grant network access to the environment.

  - `Unrestricted object { type }`

    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"`

  - `Limited object { allowed_hosts, type }`

    Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

    - `allowed_hosts: array of 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.

    - `type: "limited"`

      The type of the object. Always `limited`.

      - `"limited"`

### Credential Networking Param

- `CredentialNetworkingParam = Unrestricted { type }  or Limited { allowed_hosts, type }`

  Destination permissions for an environment-variable credential. These do not grant network access to the environment.

  - `Unrestricted object { type }`

    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"`

  - `Limited object { allowed_hosts, type }`

    Allows substitution only for the listed hosts. The environment network policy must also allow these hosts.

    - `allowed_hosts: array of 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.

    - `type: "limited"`

      The type of the object. Always `limited`.

      - `"limited"`

### Mcp OAuth Token Endpoint Auth

- `McpOauthTokenEndpointAuth = None { type }  or ClientSecretBasic { type }  or ClientSecretPost { type }`

  The client authentication method used for OAuth token refresh.

  - `None object { type }`

    Sends the client ID without a client secret.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `ClientSecretBasic object { type }`

    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"`

  - `ClientSecretPost object { type }`

    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 = None { type }  or ClientSecretBasic { client_secret, type }  or ClientSecretPost { client_secret, type }`

  Client authentication credentials for OAuth token refresh.

  - `None object { type }`

    Sends the client ID without a client secret.

    - `type: "none"`

      The type of the object. Always `none`.

      - `"none"`

  - `ClientSecretBasic object { client_secret, type }`

    Sends the client ID and secret using HTTP Basic authentication.

    - `client_secret: string`

      The OAuth client secret to store. Never returned in credential resources.

    - `type: "client_secret_basic"`

      The type of the object. Always `client_secret_basic`.

      - `"client_secret_basic"`

  - `ClientSecretPost object { client_secret, type }`

    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.

    - `type: "client_secret_post"`

      The type of the object. Always `client_secret_post`.

      - `"client_secret_post"`

### Mcp OAuth Token Endpoint Auth Rotate Param

- `McpOauthTokenEndpointAuthRotateParam = ClientSecretBasic { type, client_secret }  or ClientSecretPost { type, client_secret }`

  Client-secret updates that preserve the credential's OAuth authentication method.

  - `ClientSecretBasic object { type, client_secret }`

    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: optional string or null`

      The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

  - `ClientSecretPost object { type, client_secret }`

    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: optional string or null`

      The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources.

# Assistants

## Create assistant

**post** `/assistants`

Create an assistant with a model and instructions.

### Body Parameters

- `model: string or "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 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`

  - `AssistantSupportedModels = "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 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"`

- `description: optional string or null`

  The description of the assistant. The maximum length is 512 characters.

- `instructions: optional string or null`

  The system instructions that the assistant uses. The maximum length is 256,000 characters.

- `metadata: optional Metadata or 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: optional string or null`

  The name of the assistant. The maximum length is 256 characters.

- `reasoning_effort: optional ReasoningEffort or 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: optional AssistantResponseFormatOption or 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` is the default value

    - `"auto"`

  - `ResponseFormatText object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `ResponseFormatJSONObject object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

  - `ResponseFormatJSONSchema object { json_schema, type }`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `json_schema: object { name, description, schema, strict }`

      Structured Outputs configuration options, including a JSON Schema.

      - `name: string`

        The name of the response format. Must be a-z, A-Z, 0-9, or contain
        underscores and dashes, with a maximum length of 64.

      - `description: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `schema: optional map[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: optional boolean or 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: optional number or 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.

- `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

    - `file_ids: optional array of 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.

  - `file_search: optional object { vector_store_ids, vector_stores }`

    - `vector_store_ids: optional array of 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.

    - `vector_stores: optional array of object { chunking_strategy, file_ids, metadata }`

      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.

      - `chunking_strategy: optional Auto { type }  or Static { static, type }`

        The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.

        - `Auto object { type }`

          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 object { static, type }`

          - `static: object { chunk_overlap_tokens, max_chunk_size_tokens }`

            - `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`.

          - `type: "static"`

            Always `static`.

            - `"static"`

      - `file_ids: optional array of 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.

      - `metadata: optional Metadata or 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: optional array of CodeInterpreterTool or FileSearchTool or FunctionTool`

  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`.

  - `CodeInterpreterTool object { type }`

    - `type: "code_interpreter"`

      The type of tool being defined: `code_interpreter`

      - `"code_interpreter"`

  - `FileSearchTool object { type, file_search }`

    - `type: "file_search"`

      The type of tool being defined: `file_search`

      - `"file_search"`

    - `file_search: optional object { max_num_results, ranking_options }`

      Overrides for the file search tool.

      - `max_num_results: optional 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.

      - `ranking_options: optional object { score_threshold, ranker }`

        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.

        - `ranker: optional "auto" or "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 object { function, type }`

    - `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: optional string`

        A description of what the function does, used by the model to choose when and how to call the function.

      - `parameters: optional 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: optional boolean or 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: optional number or 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.

### Returns

- `Assistant object { id, created_at, description, 10 more }`

  Represents an `assistant` that can call the model and use tools.

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the assistant was created.

  - `description: string or null`

    The description of the assistant. The maximum length is 512 characters.

  - `instructions: string or null`

    The system instructions that the assistant uses. The maximum length is 256,000 characters.

  - `metadata: Metadata or 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 or null`

    The name of the assistant. The maximum length is 256 characters.

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    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`.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: optional AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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: optional number or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

  - `top_p: optional number or 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.

### Example

```http
curl https://api.openai.com/v1/assistants \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "model": "gpt-4.1",
          "temperature": 1,
          "top_p": 1
        }'
```

#### Response

```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

```http
curl "https://api.openai.com/v1/assistants" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "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"
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/assistants \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "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"]}},
    "model": "gpt-4.1"
  }'
```

#### Response

```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

**delete** `/assistants/{assistant_id}`

Delete an assistant.

### Path Parameters

- `assistant_id: string`

### Returns

- `AssistantDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "assistant.deleted"`

    - `"assistant.deleted"`

### Example

```http
curl https://api.openai.com/v1/assistants/$ASSISTANT_ID \
    -X DELETE \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "assistant.deleted"
}
```

### Example

```http
curl https://api.openai.com/v1/assistants/asst_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -X DELETE
```

#### Response

```json
{
  "id": "asst_abc123",
  "object": "assistant.deleted",
  "deleted": true
}
```

## List assistants

**get** `/assistants`

Returns a list of assistants.

### Query Parameters

- `after: optional 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: optional 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: optional number`

  A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

- `order: optional "asc" or "desc"`

  Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

  - `"asc"`

  - `"desc"`

### Returns

- `data: array of Assistant`

  - `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.

  - `description: string or null`

    The description of the assistant. The maximum length is 512 characters.

  - `instructions: string or null`

    The system instructions that the assistant uses. The maximum length is 256,000 characters.

  - `metadata: Metadata or 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 or null`

    The name of the assistant. The maximum length is 256 characters.

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    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`.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: optional AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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: optional number or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

  - `top_p: optional number or 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.

- `first_id: string`

- `has_more: boolean`

- `last_id: string`

- `object: string`

### Example

```http
curl https://api.openai.com/v1/assistants \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

```http
curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```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

**get** `/assistants/{assistant_id}`

Retrieves an assistant.

### Path Parameters

- `assistant_id: string`

### Returns

- `Assistant object { id, created_at, description, 10 more }`

  Represents an `assistant` that can call the model and use tools.

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the assistant was created.

  - `description: string or null`

    The description of the assistant. The maximum length is 512 characters.

  - `instructions: string or null`

    The system instructions that the assistant uses. The maximum length is 256,000 characters.

  - `metadata: Metadata or 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 or null`

    The name of the assistant. The maximum length is 256 characters.

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    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`.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: optional AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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: optional number or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

  - `top_p: optional number or 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.

### Example

```http
curl https://api.openai.com/v1/assistants/$ASSISTANT_ID \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

```http
curl https://api.openai.com/v1/assistants/asst_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```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

**post** `/assistants/{assistant_id}`

Modifies an assistant.

### Path Parameters

- `assistant_id: string`

### Body Parameters

- `description: optional string or null`

  The description of the assistant. The maximum length is 512 characters.

- `instructions: optional string or null`

  The system instructions that the assistant uses. The maximum length is 256,000 characters.

- `metadata: optional Metadata or 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: optional string or "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 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`

  - `AssistantSupportedModels = "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 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: optional string or null`

  The name of the assistant. The maximum length is 256 characters.

- `reasoning_effort: optional ReasoningEffort or 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: optional AssistantResponseFormatOption or 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` is the default value

    - `"auto"`

  - `ResponseFormatText object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `ResponseFormatJSONObject object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

  - `ResponseFormatJSONSchema object { json_schema, type }`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `json_schema: object { name, description, schema, strict }`

      Structured Outputs configuration options, including a JSON Schema.

      - `name: string`

        The name of the response format. Must be a-z, A-Z, 0-9, or contain
        underscores and dashes, with a maximum length of 64.

      - `description: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `schema: optional map[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: optional boolean or 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: optional number or 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.

- `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

    - `file_ids: optional array of 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.

  - `file_search: optional object { vector_store_ids }`

    - `vector_store_ids: optional array of 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.

- `tools: optional array of CodeInterpreterTool or FileSearchTool or FunctionTool`

  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`.

  - `CodeInterpreterTool object { type }`

    - `type: "code_interpreter"`

      The type of tool being defined: `code_interpreter`

      - `"code_interpreter"`

  - `FileSearchTool object { type, file_search }`

    - `type: "file_search"`

      The type of tool being defined: `file_search`

      - `"file_search"`

    - `file_search: optional object { max_num_results, ranking_options }`

      Overrides for the file search tool.

      - `max_num_results: optional 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.

      - `ranking_options: optional object { score_threshold, ranker }`

        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.

        - `ranker: optional "auto" or "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 object { function, type }`

    - `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: optional string`

        A description of what the function does, used by the model to choose when and how to call the function.

      - `parameters: optional 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: optional boolean or 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: optional number or 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.

### Returns

- `Assistant object { id, created_at, description, 10 more }`

  Represents an `assistant` that can call the model and use tools.

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the assistant was created.

  - `description: string or null`

    The description of the assistant. The maximum length is 512 characters.

  - `instructions: string or null`

    The system instructions that the assistant uses. The maximum length is 256,000 characters.

  - `metadata: Metadata or 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 or null`

    The name of the assistant. The maximum length is 256 characters.

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    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`.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: optional AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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: optional number or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

  - `top_p: optional number or 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.

### Example

```http
curl https://api.openai.com/v1/assistants/$ASSISTANT_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "temperature": 1,
          "top_p": 1
        }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/assistants/asst_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
      "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"}],
      "model": "gpt-4.1"
    }'
```

#### Response

```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 object { id, created_at, description, 10 more }`

  Represents an `assistant` that can call the model and use tools.

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the assistant was created.

  - `description: string or null`

    The description of the assistant. The maximum length is 512 characters.

  - `instructions: string or null`

    The system instructions that the assistant uses. The maximum length is 256,000 characters.

  - `metadata: Metadata or 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 or null`

    The name of the assistant. The maximum length is 256 characters.

  - `object: "assistant"`

    The object type, which is always `assistant`.

    - `"assistant"`

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    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`.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: optional AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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: optional number or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

  - `top_p: optional number or 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.

### Assistant Deleted

- `AssistantDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "assistant.deleted"`

    - `"assistant.deleted"`

### Assistant Stream Event

- `AssistantStreamEvent = ThreadCreated { data, event, enabled }  or ThreadRunCreated { data, event }  or ThreadRunQueued { data, event }  or 22 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 object { data, event, enabled }`

    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.

      - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

          - `file_ids: optional array of 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.

        - `file_search: optional object { vector_store_ids }`

          - `vector_store_ids: optional array of 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.

    - `event: "thread.created"`

      - `"thread.created"`

    - `enabled: optional boolean`

      Whether to enable input audio transcription.

  - `ThreadRunCreated object { data, event }`

    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 or null`

        The Unix timestamp (in seconds) for when the run was cancelled.

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the run was completed.

      - `created_at: number`

        The Unix timestamp (in seconds) for when the run was created.

      - `expires_at: number or null`

        The Unix timestamp (in seconds) for when the run will expire.

      - `failed_at: number or null`

        The Unix timestamp (in seconds) for when the run failed.

      - `incomplete_details: object { reason }  or null`

        Details on why the run is incomplete. Will be `null` if the run is not incomplete.

        - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

        The last error associated with this run. Will be `null` if there are no errors.

        - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

        The maximum number of completion tokens specified to have been used over the course of the run.

      - `max_prompt_tokens: number or null`

        The maximum number of prompt tokens specified to have been used over the course of the run.

      - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

        Details on the action required to continue the run. Will be `null` if no action is required.

        - `submit_tool_outputs: object { tool_calls }`

          Details on the tool outputs needed for this run to continue.

          - `tool_calls: array of 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: object { arguments, name }`

              The function definition.

              - `arguments: string`

                The arguments that the model expects you to pass to the function.

              - `name: string`

                The name of the function.

            - `type: "function"`

              The type of tool call the output is required for. For now, this is always `function`.

              - `"function"`

        - `type: "submit_tool_outputs"`

          For now, this is always `submit_tool_outputs`.

          - `"submit_tool_outputs"`

      - `response_format: AssistantResponseFormatOption or 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` is the default value

          - `"auto"`

        - `ResponseFormatText object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `ResponseFormatJSONObject object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

        - `ResponseFormatJSONSchema object { json_schema, type }`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `json_schema: object { name, description, schema, strict }`

            Structured Outputs configuration options, including a JSON Schema.

            - `name: string`

              The name of the response format. Must be a-z, A-Z, 0-9, or contain
              underscores and dashes, with a maximum length of 64.

            - `description: optional string`

              A description of what the response format is for, used by the model to
              determine how to respond in the format.

            - `schema: optional map[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: optional boolean or 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 or null`

        The Unix timestamp (in seconds) for when the run was started.

      - `status: "queued" or "in_progress" or "requires_action" or 6 more`

        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 or 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" or "auto" or "required"`

          `none` means the model will not call any tools 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 before responding to the user.

          - `"none"`

          - `"auto"`

          - `"required"`

        - `AssistantToolChoice object { type, function }`

          Specifies a tool the model should use. Use to force the model to call a specific tool.

          - `type: "function" or "code_interpreter" or "file_search"`

            The type of the tool. If type is `function`, the function name must be set

            - `"function"`

            - `"code_interpreter"`

            - `"file_search"`

          - `function: optional AssistantToolChoiceFunction`

            - `name: string`

              The name of the function to call.

      - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

        The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

        - `CodeInterpreterTool object { type }`

          - `type: "code_interpreter"`

            The type of tool being defined: `code_interpreter`

            - `"code_interpreter"`

        - `FileSearchTool object { type, file_search }`

          - `type: "file_search"`

            The type of tool being defined: `file_search`

            - `"file_search"`

          - `file_search: optional object { max_num_results, ranking_options }`

            Overrides for the file search tool.

            - `max_num_results: optional 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.

            - `ranking_options: optional object { score_threshold, ranker }`

              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.

              - `ranker: optional "auto" or "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 object { function, type }`

          - `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: optional string`

              A description of what the function does, used by the model to choose when and how to call the function.

            - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

          The number of most recent messages from the thread when constructing the context for the run.

      - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

        The sampling temperature used for this run. If not set, defaults to 1.

      - `top_p: optional number or null`

        The nucleus sampling value used for this run. If not set, defaults to 1.

    - `event: "thread.run.created"`

      - `"thread.run.created"`

  - `ThreadRunQueued object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 or null`

        The Unix timestamp (in seconds) for when the run step was cancelled.

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the run step completed.

      - `created_at: number`

        The Unix timestamp (in seconds) for when the run step was created.

      - `expired_at: number or null`

        The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

      - `failed_at: number or null`

        The Unix timestamp (in seconds) for when the run step failed.

      - `last_error: object { code, message }  or null`

        The last error associated with this run step. Will be `null` if there are no errors.

        - `code: "server_error" or "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 or 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" or "cancelled" or "failed" or 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 or ToolCallsStepDetails`

        The details of the run step.

        - `MessageCreationStepDetails object { message_creation, type }`

          Details of the message creation by the run step.

          - `message_creation: object { message_id }`

            - `message_id: string`

              The ID of the message that was created by this run step.

          - `type: "message_creation"`

            Always `message_creation`.

            - `"message_creation"`

        - `ToolCallsStepDetails object { tool_calls, type }`

          Details of the tool call.

          - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

            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 object { id, code_interpreter, type }`

              Details of the Code Interpreter tool call the run step was involved in.

              - `id: string`

                The ID of the tool call.

              - `code_interpreter: object { input, outputs }`

                The Code Interpreter tool call definition.

                - `input: string`

                  The input to the Code Interpreter tool call.

                - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

                  The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

                  - `CodeInterpreterLogOutput object { logs, type }`

                    Text output from the Code Interpreter tool call as part of a run step.

                    - `logs: string`

                      The text output from the Code Interpreter tool call.

                    - `type: "logs"`

                      Always `logs`.

                      - `"logs"`

                  - `CodeInterpreterImageOutput object { image, type }`

                    - `image: object { file_id }`

                      - `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 object { id, file_search, type }`

              - `id: string`

                The ID of the tool call object.

              - `file_search: object { ranking_options, results }`

                For now, this is always going to be an empty object.

                - `ranking_options: optional object { ranker, score_threshold }`

                  The ranking options for the file search.

                  - `ranker: "auto" or "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.

                - `results: optional array of object { file_id, file_name, score, content }`

                  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.

                  - `content: optional array of object { text, type }`

                    The content of the result that was found. The content is only included if requested via the include query parameter.

                    - `text: optional string`

                      The text content of the file.

                    - `type: optional "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 object { id, function, type }`

              - `id: string`

                The ID of the tool call object.

              - `function: object { arguments, name, output }`

                The definition of the function that was called.

                - `arguments: string`

                  The arguments passed to the function.

                - `name: string`

                  The name of the function.

                - `output: string or 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" or "tool_calls"`

        The type of run step, which can be either `message_creation` or `tool_calls`.

        - `"message_creation"`

        - `"tool_calls"`

      - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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 object { data, event }`

    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 object { data, event }`

    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: object { step_details }`

        The delta containing the fields that have changed on the run step.

        - `step_details: optional RunStepDeltaMessageDelta or ToolCallDeltaObject`

          The details of the run step.

          - `RunStepDeltaMessageDelta object { type, message_creation }`

            Details of the message creation by the run step.

            - `type: "message_creation"`

              Always `message_creation`.

              - `"message_creation"`

            - `message_creation: optional object { message_id }`

              - `message_id: optional string`

                The ID of the message that was created by this run step.

          - `ToolCallDeltaObject object { type, tool_calls }`

            Details of the tool call.

            - `type: "tool_calls"`

              Always `tool_calls`.

              - `"tool_calls"`

            - `tool_calls: optional array of CodeInterpreterToolCallDelta or FileSearchToolCallDelta or FunctionToolCallDelta`

              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 object { index, type, id, code_interpreter }`

                Details of the Code Interpreter tool call the run step was involved in.

                - `index: number`

                  The index of the tool call in the tool calls array.

                - `type: "code_interpreter"`

                  The type of tool call. This is always going to be `code_interpreter` for this type of tool call.

                  - `"code_interpreter"`

                - `id: optional string`

                  The ID of the tool call.

                - `code_interpreter: optional object { input, outputs }`

                  The Code Interpreter tool call definition.

                  - `input: optional string`

                    The input to the Code Interpreter tool call.

                  - `outputs: optional array of CodeInterpreterLogs or 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 object { index, type, logs }`

                      Text output from the Code Interpreter tool call as part of a run step.

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "logs"`

                        Always `logs`.

                        - `"logs"`

                      - `logs: optional string`

                        The text output from the Code Interpreter tool call.

                    - `CodeInterpreterOutputImage object { index, type, image }`

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "image"`

                        Always `image`.

                        - `"image"`

                      - `image: optional object { file_id }`

                        - `file_id: optional string`

                          The [file](/api/reference/resources/files) ID of the image.

              - `FileSearchToolCallDelta object { file_search, index, type, id }`

                - `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: optional string`

                  The ID of the tool call object.

              - `FunctionToolCallDelta object { index, type, id, function }`

                - `index: number`

                  The index of the tool call in the tool calls array.

                - `type: "function"`

                  The type of tool call. This is always going to be `function` for this type of tool call.

                  - `"function"`

                - `id: optional string`

                  The ID of the tool call object.

                - `function: optional object { arguments, name, output }`

                  The definition of the function that was called.

                  - `arguments: optional string`

                    The arguments passed to the function.

                  - `name: optional string`

                    The name of the function.

                  - `output: optional string or 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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 or null`

        If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

      - `attachments: array of object { file_id, tools }  or null`

        A list of files attached to the message, and the tools they were added to.

        - `file_id: optional string`

          The ID of the file to attach to the message.

        - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

          The tools to add this file to.

          - `CodeInterpreterTool object { type }`

          - `FileSearchTool object { type }`

            - `type: "file_search"`

              The type of tool being defined: `file_search`

              - `"file_search"`

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the message was completed.

      - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

        The content of the message in array of text and/or images.

        - `ImageFileContentBlock object { image_file, type }`

          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: optional "auto" or "low" or "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 object { image_url, type }`

          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.

            - `detail: optional "auto" or "low" or "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 object { text, type }`

          The text content that is part of a message.

          - `text: Text`

            - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

              - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

                A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

                - `end_index: number`

                - `file_citation: object { file_id }`

                  - `file_id: string`

                    The ID of the specific File the citation is from.

                - `start_index: number`

                - `text: string`

                  The text in the message content that needs to be replaced.

                - `type: "file_citation"`

                  Always `file_citation`.

                  - `"file_citation"`

              - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

                A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

                - `end_index: number`

                - `file_path: object { file_id }`

                  - `file_id: string`

                    The ID of the file that was generated.

                - `start_index: number`

                - `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 object { refusal, type }`

          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.

      - `incomplete_at: number or null`

        The Unix timestamp (in seconds) for when the message was marked as incomplete.

      - `incomplete_details: object { reason }  or null`

        On an incomplete message, details about why the message is incomplete.

        - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

          The reason the message is incomplete.

          - `"content_filter"`

          - `"max_tokens"`

          - `"run_cancelled"`

          - `"run_expired"`

          - `"run_failed"`

      - `metadata: Metadata or 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" or "assistant"`

        The entity that produced the message. One of `user` or `assistant`.

        - `"user"`

        - `"assistant"`

      - `run_id: string or 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" or "incomplete" or "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 object { data, event }`

    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 object { data, event }`

    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: optional array of ImageFileDeltaBlock or TextDeltaBlock or RefusalDeltaBlock or ImageURLDeltaBlock`

          The content of the message in array of text and/or images.

          - `ImageFileDeltaBlock object { index, type, image_file }`

            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: optional ImageFileDelta`

              - `detail: optional "auto" or "low" or "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: optional 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 object { index, type, text }`

            The text content that is part of a message.

            - `index: number`

              The index of the content part in the message.

            - `type: "text"`

              Always `text`.

              - `"text"`

            - `text: optional TextDelta`

              - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

                - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

                  A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

                  - `index: number`

                    The index of the annotation in the text content part.

                  - `type: "file_citation"`

                    Always `file_citation`.

                    - `"file_citation"`

                  - `end_index: optional number`

                  - `file_citation: optional object { file_id, quote }`

                    - `file_id: optional string`

                      The ID of the specific File the citation is from.

                    - `quote: optional string`

                      The specific quote in the file.

                  - `start_index: optional number`

                  - `text: optional string`

                    The text in the message content that needs to be replaced.

                - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

                  A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

                  - `index: number`

                    The index of the annotation in the text content part.

                  - `type: "file_path"`

                    Always `file_path`.

                    - `"file_path"`

                  - `end_index: optional number`

                  - `file_path: optional object { file_id }`

                    - `file_id: optional string`

                      The ID of the file that was generated.

                  - `start_index: optional number`

                  - `text: optional string`

                    The text in the message content that needs to be replaced.

              - `value: optional string`

                The data that makes up the text.

          - `RefusalDeltaBlock object { index, type, refusal }`

            The refusal content that is part of a message.

            - `index: number`

              The index of the refusal part in the message.

            - `type: "refusal"`

              Always `refusal`.

              - `"refusal"`

            - `refusal: optional string`

          - `ImageURLDeltaBlock object { index, type, image_url }`

            References an image URL in the content of a message.

            - `index: number`

              The index of the content part in the message.

            - `type: "image_url"`

              Always `image_url`.

              - `"image_url"`

            - `image_url: optional ImageURLDelta`

              - `detail: optional "auto" or "low" or "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: optional string`

                The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

        - `role: optional "user" or "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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 or null`

      - `message: string`

      - `param: string or null`

      - `type: string`

      - `misalignment: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

    - `event: "error"`

      - `"error"`

  - `DoneEvent object { data, event }`

    Occurs when a stream ends.

    - `data: "[DONE]"`

      - `"[DONE]"`

    - `event: "done"`

      - `"done"`

### Code Interpreter Tool

- `CodeInterpreterTool object { type }`

  - `type: "code_interpreter"`

    The type of tool being defined: `code_interpreter`

    - `"code_interpreter"`

### File Search Tool

- `FileSearchTool object { type, file_search }`

  - `type: "file_search"`

    The type of tool being defined: `file_search`

    - `"file_search"`

  - `file_search: optional object { max_num_results, ranking_options }`

    Overrides for the file search tool.

    - `max_num_results: optional 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.

    - `ranking_options: optional object { score_threshold, ranker }`

      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.

      - `ranker: optional "auto" or "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 object { function, type }`

  - `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: optional string`

      A description of what the function does, used by the model to choose when and how to call the function.

    - `parameters: optional 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: optional boolean or 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 { data, event }  or ThreadMessageInProgress { data, event }  or ThreadMessageDelta { data, event }  or 2 more`

  Occurs when a [message](/api/docs/assistants/migration) is created.

  - `ThreadMessageCreated object { data, event }`

    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 or null`

        If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

      - `attachments: array of object { file_id, tools }  or null`

        A list of files attached to the message, and the tools they were added to.

        - `file_id: optional string`

          The ID of the file to attach to the message.

        - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

          The tools to add this file to.

          - `CodeInterpreterTool object { type }`

            - `type: "code_interpreter"`

              The type of tool being defined: `code_interpreter`

              - `"code_interpreter"`

          - `FileSearchTool object { type }`

            - `type: "file_search"`

              The type of tool being defined: `file_search`

              - `"file_search"`

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the message was completed.

      - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

        The content of the message in array of text and/or images.

        - `ImageFileContentBlock object { image_file, type }`

          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: optional "auto" or "low" or "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 object { image_url, type }`

          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.

            - `detail: optional "auto" or "low" or "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 object { text, type }`

          The text content that is part of a message.

          - `text: Text`

            - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

              - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

                A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

                - `end_index: number`

                - `file_citation: object { file_id }`

                  - `file_id: string`

                    The ID of the specific File the citation is from.

                - `start_index: number`

                - `text: string`

                  The text in the message content that needs to be replaced.

                - `type: "file_citation"`

                  Always `file_citation`.

                  - `"file_citation"`

              - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

                A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

                - `end_index: number`

                - `file_path: object { file_id }`

                  - `file_id: string`

                    The ID of the file that was generated.

                - `start_index: number`

                - `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 object { refusal, type }`

          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.

      - `incomplete_at: number or null`

        The Unix timestamp (in seconds) for when the message was marked as incomplete.

      - `incomplete_details: object { reason }  or null`

        On an incomplete message, details about why the message is incomplete.

        - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

          The reason the message is incomplete.

          - `"content_filter"`

          - `"max_tokens"`

          - `"run_cancelled"`

          - `"run_expired"`

          - `"run_failed"`

      - `metadata: Metadata or 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" or "assistant"`

        The entity that produced the message. One of `user` or `assistant`.

        - `"user"`

        - `"assistant"`

      - `run_id: string or 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" or "incomplete" or "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 object { data, event }`

    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 object { data, event }`

    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: optional array of ImageFileDeltaBlock or TextDeltaBlock or RefusalDeltaBlock or ImageURLDeltaBlock`

          The content of the message in array of text and/or images.

          - `ImageFileDeltaBlock object { index, type, image_file }`

            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: optional ImageFileDelta`

              - `detail: optional "auto" or "low" or "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: optional 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 object { index, type, text }`

            The text content that is part of a message.

            - `index: number`

              The index of the content part in the message.

            - `type: "text"`

              Always `text`.

              - `"text"`

            - `text: optional TextDelta`

              - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

                - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

                  A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

                  - `index: number`

                    The index of the annotation in the text content part.

                  - `type: "file_citation"`

                    Always `file_citation`.

                    - `"file_citation"`

                  - `end_index: optional number`

                  - `file_citation: optional object { file_id, quote }`

                    - `file_id: optional string`

                      The ID of the specific File the citation is from.

                    - `quote: optional string`

                      The specific quote in the file.

                  - `start_index: optional number`

                  - `text: optional string`

                    The text in the message content that needs to be replaced.

                - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

                  A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

                  - `index: number`

                    The index of the annotation in the text content part.

                  - `type: "file_path"`

                    Always `file_path`.

                    - `"file_path"`

                  - `end_index: optional number`

                  - `file_path: optional object { file_id }`

                    - `file_id: optional string`

                      The ID of the file that was generated.

                  - `start_index: optional number`

                  - `text: optional string`

                    The text in the message content that needs to be replaced.

              - `value: optional string`

                The data that makes up the text.

          - `RefusalDeltaBlock object { index, type, refusal }`

            The refusal content that is part of a message.

            - `index: number`

              The index of the refusal part in the message.

            - `type: "refusal"`

              Always `refusal`.

              - `"refusal"`

            - `refusal: optional string`

          - `ImageURLDeltaBlock object { index, type, image_url }`

            References an image URL in the content of a message.

            - `index: number`

              The index of the content part in the message.

            - `type: "image_url"`

              Always `image_url`.

              - `"image_url"`

            - `image_url: optional ImageURLDelta`

              - `detail: optional "auto" or "low" or "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: optional string`

                The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

        - `role: optional "user" or "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 object { data, event }`

    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 object { data, event }`

    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 { data, event }  or ThreadRunStepInProgress { data, event }  or ThreadRunStepDelta { data, event }  or 4 more`

  Occurs when a [run step](/api/docs/assistants/migration) is created.

  - `ThreadRunStepCreated object { data, event }`

    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 or null`

        The Unix timestamp (in seconds) for when the run step was cancelled.

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the run step completed.

      - `created_at: number`

        The Unix timestamp (in seconds) for when the run step was created.

      - `expired_at: number or null`

        The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

      - `failed_at: number or null`

        The Unix timestamp (in seconds) for when the run step failed.

      - `last_error: object { code, message }  or null`

        The last error associated with this run step. Will be `null` if there are no errors.

        - `code: "server_error" or "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 or 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" or "cancelled" or "failed" or 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 or ToolCallsStepDetails`

        The details of the run step.

        - `MessageCreationStepDetails object { message_creation, type }`

          Details of the message creation by the run step.

          - `message_creation: object { message_id }`

            - `message_id: string`

              The ID of the message that was created by this run step.

          - `type: "message_creation"`

            Always `message_creation`.

            - `"message_creation"`

        - `ToolCallsStepDetails object { tool_calls, type }`

          Details of the tool call.

          - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

            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 object { id, code_interpreter, type }`

              Details of the Code Interpreter tool call the run step was involved in.

              - `id: string`

                The ID of the tool call.

              - `code_interpreter: object { input, outputs }`

                The Code Interpreter tool call definition.

                - `input: string`

                  The input to the Code Interpreter tool call.

                - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

                  The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

                  - `CodeInterpreterLogOutput object { logs, type }`

                    Text output from the Code Interpreter tool call as part of a run step.

                    - `logs: string`

                      The text output from the Code Interpreter tool call.

                    - `type: "logs"`

                      Always `logs`.

                      - `"logs"`

                  - `CodeInterpreterImageOutput object { image, type }`

                    - `image: object { file_id }`

                      - `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 object { id, file_search, type }`

              - `id: string`

                The ID of the tool call object.

              - `file_search: object { ranking_options, results }`

                For now, this is always going to be an empty object.

                - `ranking_options: optional object { ranker, score_threshold }`

                  The ranking options for the file search.

                  - `ranker: "auto" or "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.

                - `results: optional array of object { file_id, file_name, score, content }`

                  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.

                  - `content: optional array of object { text, type }`

                    The content of the result that was found. The content is only included if requested via the include query parameter.

                    - `text: optional string`

                      The text content of the file.

                    - `type: optional "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 object { id, function, type }`

              - `id: string`

                The ID of the tool call object.

              - `function: object { arguments, name, output }`

                The definition of the function that was called.

                - `arguments: string`

                  The arguments passed to the function.

                - `name: string`

                  The name of the function.

                - `output: string or 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" or "tool_calls"`

        The type of run step, which can be either `message_creation` or `tool_calls`.

        - `"message_creation"`

        - `"tool_calls"`

      - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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 object { data, event }`

    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 object { data, event }`

    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: object { step_details }`

        The delta containing the fields that have changed on the run step.

        - `step_details: optional RunStepDeltaMessageDelta or ToolCallDeltaObject`

          The details of the run step.

          - `RunStepDeltaMessageDelta object { type, message_creation }`

            Details of the message creation by the run step.

            - `type: "message_creation"`

              Always `message_creation`.

              - `"message_creation"`

            - `message_creation: optional object { message_id }`

              - `message_id: optional string`

                The ID of the message that was created by this run step.

          - `ToolCallDeltaObject object { type, tool_calls }`

            Details of the tool call.

            - `type: "tool_calls"`

              Always `tool_calls`.

              - `"tool_calls"`

            - `tool_calls: optional array of CodeInterpreterToolCallDelta or FileSearchToolCallDelta or FunctionToolCallDelta`

              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 object { index, type, id, code_interpreter }`

                Details of the Code Interpreter tool call the run step was involved in.

                - `index: number`

                  The index of the tool call in the tool calls array.

                - `type: "code_interpreter"`

                  The type of tool call. This is always going to be `code_interpreter` for this type of tool call.

                  - `"code_interpreter"`

                - `id: optional string`

                  The ID of the tool call.

                - `code_interpreter: optional object { input, outputs }`

                  The Code Interpreter tool call definition.

                  - `input: optional string`

                    The input to the Code Interpreter tool call.

                  - `outputs: optional array of CodeInterpreterLogs or 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 object { index, type, logs }`

                      Text output from the Code Interpreter tool call as part of a run step.

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "logs"`

                        Always `logs`.

                        - `"logs"`

                      - `logs: optional string`

                        The text output from the Code Interpreter tool call.

                    - `CodeInterpreterOutputImage object { index, type, image }`

                      - `index: number`

                        The index of the output in the outputs array.

                      - `type: "image"`

                        Always `image`.

                        - `"image"`

                      - `image: optional object { file_id }`

                        - `file_id: optional string`

                          The [file](/api/reference/resources/files) ID of the image.

              - `FileSearchToolCallDelta object { file_search, index, type, id }`

                - `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: optional string`

                  The ID of the tool call object.

              - `FunctionToolCallDelta object { index, type, id, function }`

                - `index: number`

                  The index of the tool call in the tool calls array.

                - `type: "function"`

                  The type of tool call. This is always going to be `function` for this type of tool call.

                  - `"function"`

                - `id: optional string`

                  The ID of the tool call object.

                - `function: optional object { arguments, name, output }`

                  The definition of the function that was called.

                  - `arguments: optional string`

                    The arguments passed to the function.

                  - `name: optional string`

                    The name of the function.

                  - `output: optional string or 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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 { data, event }  or ThreadRunQueued { data, event }  or ThreadRunInProgress { data, event }  or 7 more`

  Occurs when a new [run](/api/docs/assistants/migration) is created.

  - `ThreadRunCreated object { data, event }`

    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 or null`

        The Unix timestamp (in seconds) for when the run was cancelled.

      - `completed_at: number or null`

        The Unix timestamp (in seconds) for when the run was completed.

      - `created_at: number`

        The Unix timestamp (in seconds) for when the run was created.

      - `expires_at: number or null`

        The Unix timestamp (in seconds) for when the run will expire.

      - `failed_at: number or null`

        The Unix timestamp (in seconds) for when the run failed.

      - `incomplete_details: object { reason }  or null`

        Details on why the run is incomplete. Will be `null` if the run is not incomplete.

        - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

        The last error associated with this run. Will be `null` if there are no errors.

        - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

        The maximum number of completion tokens specified to have been used over the course of the run.

      - `max_prompt_tokens: number or null`

        The maximum number of prompt tokens specified to have been used over the course of the run.

      - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

        Details on the action required to continue the run. Will be `null` if no action is required.

        - `submit_tool_outputs: object { tool_calls }`

          Details on the tool outputs needed for this run to continue.

          - `tool_calls: array of 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: object { arguments, name }`

              The function definition.

              - `arguments: string`

                The arguments that the model expects you to pass to the function.

              - `name: string`

                The name of the function.

            - `type: "function"`

              The type of tool call the output is required for. For now, this is always `function`.

              - `"function"`

        - `type: "submit_tool_outputs"`

          For now, this is always `submit_tool_outputs`.

          - `"submit_tool_outputs"`

      - `response_format: AssistantResponseFormatOption or 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` is the default value

          - `"auto"`

        - `ResponseFormatText object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `ResponseFormatJSONObject object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

        - `ResponseFormatJSONSchema object { json_schema, type }`

          JSON Schema response format. Used to generate structured JSON responses.
          Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

          - `json_schema: object { name, description, schema, strict }`

            Structured Outputs configuration options, including a JSON Schema.

            - `name: string`

              The name of the response format. Must be a-z, A-Z, 0-9, or contain
              underscores and dashes, with a maximum length of 64.

            - `description: optional string`

              A description of what the response format is for, used by the model to
              determine how to respond in the format.

            - `schema: optional map[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: optional boolean or 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 or null`

        The Unix timestamp (in seconds) for when the run was started.

      - `status: "queued" or "in_progress" or "requires_action" or 6 more`

        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 or 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" or "auto" or "required"`

          `none` means the model will not call any tools 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 before responding to the user.

          - `"none"`

          - `"auto"`

          - `"required"`

        - `AssistantToolChoice object { type, function }`

          Specifies a tool the model should use. Use to force the model to call a specific tool.

          - `type: "function" or "code_interpreter" or "file_search"`

            The type of the tool. If type is `function`, the function name must be set

            - `"function"`

            - `"code_interpreter"`

            - `"file_search"`

          - `function: optional AssistantToolChoiceFunction`

            - `name: string`

              The name of the function to call.

      - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

        The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

        - `CodeInterpreterTool object { type }`

          - `type: "code_interpreter"`

            The type of tool being defined: `code_interpreter`

            - `"code_interpreter"`

        - `FileSearchTool object { type, file_search }`

          - `type: "file_search"`

            The type of tool being defined: `file_search`

            - `"file_search"`

          - `file_search: optional object { max_num_results, ranking_options }`

            Overrides for the file search tool.

            - `max_num_results: optional 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.

            - `ranking_options: optional object { score_threshold, ranker }`

              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.

              - `ranker: optional "auto" or "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 object { function, type }`

          - `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: optional string`

              A description of what the function does, used by the model to choose when and how to call the function.

            - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

          The number of most recent messages from the thread when constructing the context for the run.

      - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

        The sampling temperature used for this run. If not set, defaults to 1.

      - `top_p: optional number or null`

        The nucleus sampling value used for this run. If not set, defaults to 1.

    - `event: "thread.run.created"`

      - `"thread.run.created"`

  - `ThreadRunQueued object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event }`

    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 object { data, event, enabled }`

  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.

    - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

        - `file_ids: optional array of 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.

      - `file_search: optional object { vector_store_ids }`

        - `vector_store_ids: optional array of 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.

  - `event: "thread.created"`

    - `"thread.created"`

  - `enabled: optional boolean`

    Whether to enable input audio transcription.

# ChatKit

## Domain Types

### ChatKit Workflow

- `ChatKitWorkflow object { id, state_variables, tracing, version }`

  Workflow metadata and state returned for the session.

  - `id: string`

    Identifier of the workflow backing the session.

  - `state_variables: map[string or boolean or number] or null`

    State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

    - `string`

    - `boolean`

    - `number`

  - `tracing: object { enabled }`

    Tracing settings applied to the workflow.

    - `enabled: boolean`

      Indicates whether tracing is enabled.

  - `version: string or null`

    Specific workflow version used for the session. Defaults to null when using the latest deployment.

# Sessions

## Cancel a ChatKit session

**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.

### Path Parameters

- `session_id: string`

### Returns

- `ChatSession object { id, chatkit_configuration, client_secret, 7 more }`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    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 or null`

        Maximum upload size in megabytes.

      - `max_files: number or 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 or 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.

  - `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: map[string or boolean or number] or null`

      State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

      - `string`

      - `boolean`

      - `number`

    - `tracing: object { enabled }`

      Tracing settings applied to the workflow.

      - `enabled: boolean`

        Indicates whether tracing is enabled.

    - `version: string or null`

      Specific workflow version used for the session. Defaults to null when using the latest deployment.

### Example

```http
curl https://api.openai.com/v1/chatkit/sessions/$SESSION_ID/cancel \
    -X POST \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

```http
curl -X POST \
  https://api.openai.com/v1/chatkit/sessions/cksess_123/cancel \
  -H "OpenAI-Beta: chatkit_beta=v1" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**post** `/chatkit/sessions`

Create a ChatKit session.

### Body Parameters

- `user: string`

  A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope.

- `workflow: ChatSessionWorkflowParam`

  Workflow that powers the session.

  - `id: string`

    Identifier for the workflow invoked by the session.

  - `state_variables: optional map[string or boolean or 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`

    - `boolean`

    - `number`

  - `tracing: optional object { enabled }`

    Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default.

    - `enabled: optional boolean`

      Whether tracing is enabled during the session. Defaults to true.

  - `version: optional string`

    Specific workflow version to run. Defaults to the latest deployed version.

- `chatkit_configuration: optional ChatSessionChatKitConfigurationParam`

  Optional overrides for ChatKit runtime configuration features

  - `automatic_thread_titling: optional object { enabled }`

    Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default.

    - `enabled: optional boolean`

      Enable automatic thread title generation. Defaults to true.

  - `file_upload: optional object { enabled, max_file_size, max_files }`

    Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB).

    - `enabled: optional boolean`

      Enable uploads for this session. Defaults to false.

    - `max_file_size: optional number`

      Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size.

    - `max_files: optional number`

      Maximum number of files that can be uploaded to the session. Defaults to 10.

  - `history: optional object { enabled, recent_threads }`

    Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null).

    - `enabled: optional boolean`

      Enables chat users to access previous ChatKit threads. Defaults to true.

    - `recent_threads: optional number`

      Number of recent ChatKit threads users have access to. Defaults to unlimited when unset.

- `expires_after: optional 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.

- `rate_limits: optional ChatSessionRateLimitsParam`

  Optional override for per-minute request limits. When omitted, defaults to 10.

  - `max_requests_per_1_minute: optional number`

    Maximum number of requests allowed per minute for the session. Defaults to 10.

### Returns

- `ChatSession object { id, chatkit_configuration, client_secret, 7 more }`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    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 or null`

        Maximum upload size in megabytes.

      - `max_files: number or 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 or 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.

  - `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: map[string or boolean or number] or null`

      State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

      - `string`

      - `boolean`

      - `number`

    - `tracing: object { enabled }`

      Tracing settings applied to the workflow.

      - `enabled: boolean`

        Indicates whether tracing is enabled.

    - `version: string or null`

      Specific workflow version used for the session. Defaults to null when using the latest deployment.

### Example

```http
curl https://api.openai.com/v1/chatkit/sessions \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "user": "x",
          "workflow": {
            "id": "id"
          }
        }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/chatkit/sessions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: chatkit_beta=v1" \
  -d '{
    "user": "user_123",
    "workflow": {"id": "workflow_alpha"}
  }'
```

#### Response

```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

**delete** `/chatkit/threads/{thread_id}`

Delete a ChatKit thread along with its items and stored attachments.

### Path Parameters

- `thread_id: string`

### Returns

- `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

```http
curl https://api.openai.com/v1/chatkit/threads/$THREAD_ID \
    -X DELETE \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "chatkit.thread.deleted"
}
```

## List ChatKit threads

**get** `/chatkit/threads`

List ChatKit threads with optional pagination and user filters.

### Query Parameters

- `after: optional string`

  List items created after this thread item ID. Defaults to null for the first page.

- `before: optional string`

  List items created before this thread item ID. Defaults to null for the newest results.

- `limit: optional number`

  Maximum number of thread items to return. Defaults to 20.

- `order: optional "asc" or "desc"`

  Sort order for results by creation time. Defaults to `desc`.

  - `"asc"`

  - `"desc"`

- `user: optional string`

  Filter threads that belong to this user identifier. Defaults to null to return all users.

### Returns

- `data: array of ChatKitThread`

  A list of items

  - `id: string`

    Identifier of the thread.

  - `created_at: number`

    Unix timestamp (in seconds) for when the thread was created.

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active { type }  or Locked { reason, type }  or Closed { reason, type }`

    Current status for the thread. Defaults to `active` for newly created threads.

    - `Active object { type }`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked object { reason, type }`

      Indicates that a thread is locked and cannot accept new input.

      - `reason: string or 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 object { reason, type }`

      Indicates that a thread has been closed.

      - `reason: string or 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 or 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.

- `first_id: string or null`

  The ID of the first item in the list.

- `has_more: boolean`

  Whether there are more items available.

- `last_id: string or null`

  The ID of the last item in the list.

- `object: "list"`

  The type of object returned, must be `list`.

  - `"list"`

### Example

```http
curl https://api.openai.com/v1/chatkit/threads \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

```http
curl "https://api.openai.com/v1/chatkit/threads?limit=2&order=desc" \
  -H "OpenAI-Beta: chatkit_beta=v1" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**get** `/chatkit/threads/{thread_id}/items`

List items that belong to a ChatKit thread.

### Path Parameters

- `thread_id: string`

### Query Parameters

- `after: optional string`

  List items created after this thread item ID. Defaults to null for the first page.

- `before: optional string`

  List items created before this thread item ID. Defaults to null for the newest results.

- `limit: optional number`

  Maximum number of thread items to return. Defaults to 20.

- `order: optional "asc" or "desc"`

  Sort order for results by creation time. Defaults to `desc`.

  - `"asc"`

  - `"desc"`

### Returns

- `ChatKitThreadItemList object { data, first_id, has_more, 2 more }`

  A paginated list of thread items rendered for the ChatKit API.

  - `data: array of ChatKitThreadUserMessageItem or ChatKitThreadAssistantMessageItem or ChatKitWidgetItem or 3 more`

    A list of items

    - `ChatKitThreadUserMessageItem object { id, attachments, content, 5 more }`

      User-authored messages within a thread.

      - `id: string`

        Identifier of the thread item.

      - `attachments: array of 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 or null`

          Preview URL for rendering the attachment inline.

        - `type: "image" or "file"`

          Attachment discriminator.

          - `"image"`

          - `"file"`

      - `content: array of InputText { text, type }  or QuotedText { text, type }`

        Ordered content elements supplied by the user.

        - `InputText object { text, type }`

          Text block that a user contributed to the thread.

          - `text: string`

            Plain-text content supplied by the user.

          - `type: "input_text"`

            Type discriminator that is always `input_text`.

            - `"input_text"`

        - `QuotedText object { text, type }`

          Quoted snippet that the user referenced in their message.

          - `text: string`

            Quoted text content.

          - `type: "quoted_text"`

            Type discriminator that is always `quoted_text`.

            - `"quoted_text"`

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `inference_options: object { model, tool_choice }  or null`

        Inference overrides applied to the message. Defaults to null when unset.

        - `model: string or null`

          Model name that generated the response. Defaults to null when using the session default.

        - `tool_choice: object { id }  or 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 object { id, content, created_at, 3 more }`

      Assistant-authored message within a thread.

      - `id: string`

        Identifier of the thread item.

      - `content: array of ChatKitResponseOutputText`

        Ordered assistant response segments.

        - `annotations: array of File { source, type }  or URL { source, type }`

          Ordered list of annotations attached to the response text.

          - `File object { source, type }`

            Annotation that references an uploaded file.

            - `source: object { filename, type }`

              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 object { source, type }`

            Annotation that references a URL.

            - `source: object { type, url }`

              URL referenced by the annotation.

              - `type: "url"`

                Type discriminator that is always `url`.

                - `"url"`

              - `url: string`

                URL referenced by the annotation.

            - `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.

      - `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 object { id, created_at, object, 3 more }`

      Thread item that renders a widget payload.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `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 object { id, arguments, call_id, 7 more }`

      Record of a client side tool invocation initiated by the assistant.

      - `id: string`

        Identifier of the thread item.

      - `arguments: string`

        JSON-encoded arguments that were sent to the tool.

      - `call_id: string`

        Identifier for the client tool call.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `name: string`

        Tool name that was invoked.

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `output: string or null`

        JSON-encoded output captured from the tool. Defaults to null while execution is in progress.

      - `status: "in_progress" or "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 object { id, created_at, heading, 5 more }`

      Task emitted by the workflow to show progress and status updates.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `heading: string or 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 or null`

        Optional summary that describes the task. Defaults to null when omitted.

      - `task_type: "custom" or "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 object { id, created_at, object, 3 more }`

      Collection of workflow tasks grouped together in the thread.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `tasks: array of object { heading, summary, type }`

        Tasks included in the group.

        - `heading: string or null`

          Optional heading for the grouped task. Defaults to null when not provided.

        - `summary: string or null`

          Optional summary that describes the grouped task. Defaults to null when omitted.

        - `type: "custom" or "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 or null`

    The ID of the first item in the list.

  - `has_more: boolean`

    Whether there are more items available.

  - `last_id: string or null`

    The ID of the last item in the list.

  - `object: "list"`

    The type of object returned, must be `list`.

    - `"list"`

### Example

```http
curl https://api.openai.com/v1/chatkit/threads/$THREAD_ID/items \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

```http
curl "https://api.openai.com/v1/chatkit/threads/cthr_abc123/items?limit=3" \
  -H "OpenAI-Beta: chatkit_beta=v1" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**get** `/chatkit/threads/{thread_id}`

Retrieve a ChatKit thread by its identifier.

### Path Parameters

- `thread_id: string`

### Returns

- `ChatKitThread object { id, created_at, object, 3 more }`

  Represents a ChatKit thread and its current status.

  - `id: string`

    Identifier of the thread.

  - `created_at: number`

    Unix timestamp (in seconds) for when the thread was created.

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active { type }  or Locked { reason, type }  or Closed { reason, type }`

    Current status for the thread. Defaults to `active` for newly created threads.

    - `Active object { type }`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked object { reason, type }`

      Indicates that a thread is locked and cannot accept new input.

      - `reason: string or 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 object { reason, type }`

      Indicates that a thread has been closed.

      - `reason: string or 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 or 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

```http
curl https://api.openai.com/v1/chatkit/threads/$THREAD_ID \
    -H 'OpenAI-Beta: chatkit_beta=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "cthr_def456",
  "created_at": 1712345600,
  "object": "chatkit.thread",
  "status": {
    "type": "active"
  },
  "title": "Demo feedback",
  "user": "user_456"
}
```

### Example

```http
curl https://api.openai.com/v1/chatkit/threads/cthr_abc123 \
  -H "OpenAI-Beta: chatkit_beta=v1" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "cthr_abc123",
  "object": "chatkit.thread",
  "title": "Customer escalation",
  "created_at": 1712345600,
  "status": {
    "type": "active"
  },
  "user": "user_123"
}
```

## Domain Types

### Chat Session

- `ChatSession object { id, chatkit_configuration, client_secret, 7 more }`

  Represents a ChatKit session and its resolved configuration.

  - `id: string`

    Identifier for the ChatKit session.

  - `chatkit_configuration: ChatSessionChatKitConfiguration`

    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 or null`

        Maximum upload size in megabytes.

      - `max_files: number or 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 or 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.

  - `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: map[string or boolean or number] or null`

      State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided.

      - `string`

      - `boolean`

      - `number`

    - `tracing: object { enabled }`

      Tracing settings applied to the workflow.

      - `enabled: boolean`

        Indicates whether tracing is enabled.

    - `version: string or null`

      Specific workflow version used for the session. Defaults to null when using the latest deployment.

### Chat Session Automatic Thread Titling

- `ChatSessionAutomaticThreadTitling object { enabled }`

  Automatic thread title preferences for the session.

  - `enabled: boolean`

    Whether automatic thread titling is enabled.

### Chat Session ChatKit Configuration

- `ChatSessionChatKitConfiguration object { automatic_thread_titling, file_upload, history }`

  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 or null`

      Maximum upload size in megabytes.

    - `max_files: number or 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 or null`

      Number of prior threads surfaced in history views. Defaults to null when all history is retained.

### Chat Session ChatKit Configuration Param

- `ChatSessionChatKitConfigurationParam object { automatic_thread_titling, file_upload, history }`

  Optional per-session configuration settings for ChatKit behavior.

  - `automatic_thread_titling: optional object { enabled }`

    Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default.

    - `enabled: optional boolean`

      Enable automatic thread title generation. Defaults to true.

  - `file_upload: optional object { enabled, max_file_size, max_files }`

    Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB).

    - `enabled: optional boolean`

      Enable uploads for this session. Defaults to false.

    - `max_file_size: optional number`

      Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size.

    - `max_files: optional number`

      Maximum number of files that can be uploaded to the session. Defaults to 10.

  - `history: optional object { enabled, recent_threads }`

    Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null).

    - `enabled: optional boolean`

      Enables chat users to access previous ChatKit threads. Defaults to true.

    - `recent_threads: optional number`

      Number of recent ChatKit threads users have access to. Defaults to unlimited when unset.

### Chat Session Expires After Param

- `ChatSessionExpiresAfterParam object { anchor, seconds }`

  Controls when the session expires relative to an anchor timestamp.

  - `anchor: "created_at"`

    Base timestamp used to calculate expiration. Currently fixed to `created_at`.

    - `"created_at"`

  - `seconds: number`

    Number of seconds after the anchor when the session expires.

### Chat Session File Upload

- `ChatSessionFileUpload object { enabled, max_file_size, max_files }`

  Upload permissions and limits applied to the session.

  - `enabled: boolean`

    Indicates if uploads are enabled for the session.

  - `max_file_size: number or null`

    Maximum upload size in megabytes.

  - `max_files: number or null`

    Maximum number of uploads allowed during the session.

### Chat Session History

- `ChatSessionHistory object { enabled, recent_threads }`

  History retention preferences returned for the session.

  - `enabled: boolean`

    Indicates if chat history is persisted for the session.

  - `recent_threads: number or null`

    Number of prior threads surfaced in history views. Defaults to null when all history is retained.

### Chat Session Rate Limits

- `ChatSessionRateLimits object { max_requests_per_1_minute }`

  Active per-minute request limit for the session.

  - `max_requests_per_1_minute: number`

    Maximum allowed requests per one-minute window.

### Chat Session Rate Limits Param

- `ChatSessionRateLimitsParam object { max_requests_per_1_minute }`

  Controls request rate limits for the session.

  - `max_requests_per_1_minute: optional number`

    Maximum number of requests allowed per minute for the session. Defaults to 10.

### Chat Session Status

- `ChatSessionStatus = "active" or "expired" or "cancelled"`

  - `"active"`

  - `"expired"`

  - `"cancelled"`

### Chat Session Workflow Param

- `ChatSessionWorkflowParam object { id, state_variables, tracing, version }`

  Workflow reference and overrides applied to the chat session.

  - `id: string`

    Identifier for the workflow invoked by the session.

  - `state_variables: optional map[string or boolean or 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`

    - `boolean`

    - `number`

  - `tracing: optional object { enabled }`

    Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default.

    - `enabled: optional boolean`

      Whether tracing is enabled during the session. Defaults to true.

  - `version: optional string`

    Specific workflow version to run. Defaults to the latest deployed version.

### ChatKit Attachment

- `ChatKitAttachment object { id, mime_type, name, 2 more }`

  Attachment metadata included on thread items.

  - `id: string`

    Identifier for the attachment.

  - `mime_type: string`

    MIME type of the attachment.

  - `name: string`

    Original display name for the attachment.

  - `preview_url: string or null`

    Preview URL for rendering the attachment inline.

  - `type: "image" or "file"`

    Attachment discriminator.

    - `"image"`

    - `"file"`

### ChatKit Response Output Text

- `ChatKitResponseOutputText object { annotations, text, type }`

  Assistant response text accompanied by optional annotations.

  - `annotations: array of File { source, type }  or URL { source, type }`

    Ordered list of annotations attached to the response text.

    - `File object { source, type }`

      Annotation that references an uploaded file.

      - `source: object { filename, type }`

        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 object { source, type }`

      Annotation that references a URL.

      - `source: object { type, url }`

        URL referenced by the annotation.

        - `type: "url"`

          Type discriminator that is always `url`.

          - `"url"`

        - `url: string`

          URL referenced by the annotation.

      - `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 object { id, created_at, object, 3 more }`

  Represents a ChatKit thread and its current status.

  - `id: string`

    Identifier of the thread.

  - `created_at: number`

    Unix timestamp (in seconds) for when the thread was created.

  - `object: "chatkit.thread"`

    Type discriminator that is always `chatkit.thread`.

    - `"chatkit.thread"`

  - `status: Active { type }  or Locked { reason, type }  or Closed { reason, type }`

    Current status for the thread. Defaults to `active` for newly created threads.

    - `Active object { type }`

      Indicates that a thread is active.

      - `type: "active"`

        Status discriminator that is always `active`.

        - `"active"`

    - `Locked object { reason, type }`

      Indicates that a thread is locked and cannot accept new input.

      - `reason: string or 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 object { reason, type }`

      Indicates that a thread has been closed.

      - `reason: string or 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 or 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 object { id, content, created_at, 3 more }`

  Assistant-authored message within a thread.

  - `id: string`

    Identifier of the thread item.

  - `content: array of ChatKitResponseOutputText`

    Ordered assistant response segments.

    - `annotations: array of File { source, type }  or URL { source, type }`

      Ordered list of annotations attached to the response text.

      - `File object { source, type }`

        Annotation that references an uploaded file.

        - `source: object { filename, type }`

          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 object { source, type }`

        Annotation that references a URL.

        - `source: object { type, url }`

          URL referenced by the annotation.

          - `type: "url"`

            Type discriminator that is always `url`.

            - `"url"`

          - `url: string`

            URL referenced by the annotation.

        - `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.

  - `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 object { data, first_id, has_more, 2 more }`

  A paginated list of thread items rendered for the ChatKit API.

  - `data: array of ChatKitThreadUserMessageItem or ChatKitThreadAssistantMessageItem or ChatKitWidgetItem or 3 more`

    A list of items

    - `ChatKitThreadUserMessageItem object { id, attachments, content, 5 more }`

      User-authored messages within a thread.

      - `id: string`

        Identifier of the thread item.

      - `attachments: array of 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 or null`

          Preview URL for rendering the attachment inline.

        - `type: "image" or "file"`

          Attachment discriminator.

          - `"image"`

          - `"file"`

      - `content: array of InputText { text, type }  or QuotedText { text, type }`

        Ordered content elements supplied by the user.

        - `InputText object { text, type }`

          Text block that a user contributed to the thread.

          - `text: string`

            Plain-text content supplied by the user.

          - `type: "input_text"`

            Type discriminator that is always `input_text`.

            - `"input_text"`

        - `QuotedText object { text, type }`

          Quoted snippet that the user referenced in their message.

          - `text: string`

            Quoted text content.

          - `type: "quoted_text"`

            Type discriminator that is always `quoted_text`.

            - `"quoted_text"`

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `inference_options: object { model, tool_choice }  or null`

        Inference overrides applied to the message. Defaults to null when unset.

        - `model: string or null`

          Model name that generated the response. Defaults to null when using the session default.

        - `tool_choice: object { id }  or 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 object { id, content, created_at, 3 more }`

      Assistant-authored message within a thread.

      - `id: string`

        Identifier of the thread item.

      - `content: array of ChatKitResponseOutputText`

        Ordered assistant response segments.

        - `annotations: array of File { source, type }  or URL { source, type }`

          Ordered list of annotations attached to the response text.

          - `File object { source, type }`

            Annotation that references an uploaded file.

            - `source: object { filename, type }`

              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 object { source, type }`

            Annotation that references a URL.

            - `source: object { type, url }`

              URL referenced by the annotation.

              - `type: "url"`

                Type discriminator that is always `url`.

                - `"url"`

              - `url: string`

                URL referenced by the annotation.

            - `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.

      - `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 object { id, created_at, object, 3 more }`

      Thread item that renders a widget payload.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `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 object { id, arguments, call_id, 7 more }`

      Record of a client side tool invocation initiated by the assistant.

      - `id: string`

        Identifier of the thread item.

      - `arguments: string`

        JSON-encoded arguments that were sent to the tool.

      - `call_id: string`

        Identifier for the client tool call.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `name: string`

        Tool name that was invoked.

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `output: string or null`

        JSON-encoded output captured from the tool. Defaults to null while execution is in progress.

      - `status: "in_progress" or "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 object { id, created_at, heading, 5 more }`

      Task emitted by the workflow to show progress and status updates.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `heading: string or 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 or null`

        Optional summary that describes the task. Defaults to null when omitted.

      - `task_type: "custom" or "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 object { id, created_at, object, 3 more }`

      Collection of workflow tasks grouped together in the thread.

      - `id: string`

        Identifier of the thread item.

      - `created_at: number`

        Unix timestamp (in seconds) for when the item was created.

      - `object: "chatkit.thread_item"`

        Type discriminator that is always `chatkit.thread_item`.

        - `"chatkit.thread_item"`

      - `tasks: array of object { heading, summary, type }`

        Tasks included in the group.

        - `heading: string or null`

          Optional heading for the grouped task. Defaults to null when not provided.

        - `summary: string or null`

          Optional summary that describes the grouped task. Defaults to null when omitted.

        - `type: "custom" or "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 or null`

    The ID of the first item in the list.

  - `has_more: boolean`

    Whether there are more items available.

  - `last_id: string or 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 object { id, attachments, content, 5 more }`

  User-authored messages within a thread.

  - `id: string`

    Identifier of the thread item.

  - `attachments: array of 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 or null`

      Preview URL for rendering the attachment inline.

    - `type: "image" or "file"`

      Attachment discriminator.

      - `"image"`

      - `"file"`

  - `content: array of InputText { text, type }  or QuotedText { text, type }`

    Ordered content elements supplied by the user.

    - `InputText object { text, type }`

      Text block that a user contributed to the thread.

      - `text: string`

        Plain-text content supplied by the user.

      - `type: "input_text"`

        Type discriminator that is always `input_text`.

        - `"input_text"`

    - `QuotedText object { text, type }`

      Quoted snippet that the user referenced in their message.

      - `text: string`

        Quoted text content.

      - `type: "quoted_text"`

        Type discriminator that is always `quoted_text`.

        - `"quoted_text"`

  - `created_at: number`

    Unix timestamp (in seconds) for when the item was created.

  - `inference_options: object { model, tool_choice }  or null`

    Inference overrides applied to the message. Defaults to null when unset.

    - `model: string or null`

      Model name that generated the response. Defaults to null when using the session default.

    - `tool_choice: object { id }  or 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 object { id, created_at, object, 3 more }`

  Thread item that renders a widget payload.

  - `id: string`

    Identifier of the thread item.

  - `created_at: number`

    Unix timestamp (in seconds) for when the item was created.

  - `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 object { id, deleted, object }`

  Confirmation payload returned after deleting a thread.

  - `id: string`

    Identifier of the deleted thread.

  - `deleted: boolean`

    Indicates that the thread has been deleted.

  - `object: "chatkit.thread.deleted"`

    Type discriminator that is always `chatkit.thread.deleted`.

    - `"chatkit.thread.deleted"`

# Responses

## Cancel a response

**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).

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Path Parameters

- `response_id: string`

### Returns

- `BetaResponse object { id, access_programs, created_at, 34 more }`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: object { cyber }  or null`

    - `cyber: "standard" or "daybreak_blue" or "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.

  - `error: BetaResponseError or null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

      - `detailed_explanation: optional string`

        The public explanation for this block.

      - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

        An optional classification; clients must accept additional values.

        - `string`

        - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target: optional string or null`

        An opaque target for explicitly continuing this review, or null when unavailable.

      - `steer: optional object { message }`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param: optional string or null`

      The request parameter associated with the error, or null if none was recorded.

    - `type: optional string or null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: object { reason }  or null`

    Details about why the response is incomplete.

    - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

      A text input to the model, equivalent to a text input with the
      `developer` role.

    - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      A list of one or many input items to the model, containing
      different content types.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

        - `content: string or BetaResponseInputMessageContentList`

          Text, image, or audio input to the model, used to generate a response.
          Can also contain previous assistant responses.

          - `TextInput = string`

            A text input to the model.

          - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string`

                The content of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string`

                The URL of the file to be sent to the model.

              - `filename: optional string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

        - `role: "user" or "assistant" or "system" or "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

          The content of the output message.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

              - `FileCitation object { file_id, filename, index, type }`

                A citation to a file.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index 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 object { end_index, start_index, title, 2 more }`

                A citation for a web resource used to generate a model response.

                - `end_index: number`

                  The index of the last character of the URL citation in the message.

                - `start_index: number`

                  The index of the first character of the URL citation in the message.

                - `title: string`

                  The title of the web resource.

                - `type: "url_citation"`

                  The type of the URL citation. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the web resource.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                A citation for a container file used to generate a model response.

                - `container_id: string`

                  The ID of the container file.

                - `end_index: number`

                  The index of the last character of the container file citation in the message.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the container file citation in the message.

                - `type: "container_file_citation"`

                  The type of the container file citation. Always `container_file_citation`.

                  - `"container_file_citation"`

              - `FilePath object { file_id, index, type }`

                A path to a file.

                - `file_id: string`

                  The ID of the file.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_path"`

                  The type of the file path. Always `file_path`.

                  - `"file_path"`

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

              - `top_logprobs: array of object { token, bytes, logprob }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `phase: optional "commentary" or "final_answer" or 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"`

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

          - `Click object { button, type, x, 2 more }`

            A click action.

            - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

              The keys being held while clicking.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

            - `keys: array of string or 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 object { path, type, keys }`

            A drag action.

            - `path: array of object { x, y }`

              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: optional array of string or null`

              The keys being held while dragging the mouse.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

            - `keys: array of 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 object { type, x, y, keys }`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"move"`

            - `x: number`

              The x-coordinate to move to.

            - `y: number`

              The y-coordinate to move to.

            - `keys: optional array of string or null`

              The keys being held while moving the mouse.

          - `Screenshot object { type }`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

            - `scroll_x: number`

              The horizontal scroll distance.

            - `scroll_y: number`

              The vertical scroll distance.

            - `type: "scroll"`

              Specifies the event type. For a scroll action, this property is always set to `scroll`.

              - `"scroll"`

            - `x: number`

              The x-coordinate where the scroll occurred.

            - `y: number`

              The y-coordinate where the scroll occurred.

            - `keys: optional array of string or null`

              The keys being held while scrolling.

          - `Type object { text, type }`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait object { type }`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click object { button, type, x, 2 more }`

            A click action.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

          - `Drag object { path, type, keys }`

            A drag action.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

          - `Move object { type, x, y, keys }`

            A mouse move action.

          - `Screenshot object { type }`

            A screenshot action.

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

          - `Type object { text, type }`

            An action to type in text.

          - `Wait object { type }`

            A wait action.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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: optional string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: optional string`

            The URL of the screenshot image.

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              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: optional BetaImageDetail or 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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string or null`

                The base64-encoded data of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string or null`

                The URL of the file to be sent to the model.

              - `filename: optional string or null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "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: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `allowed_domains: array of string`

                      A list of allowed domains when type is `allowlist`.

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                      Optional domain-scoped secrets for allowlisted domains.

                      - `domain: string`

                        The domain associated with the secret.

                      - `name: string`

                        The name of the secret to inject for the domain.

                      - `value: string`

                        The secret value to inject for the domain.

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                  An optional list of skills referenced by id or inline data.

                  - `BetaSkillReference object { skill_id, type, version }`

                    - `skill_id: string`

                      The ID of the referenced skill.

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version: optional string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill object { description, name, source, type }`

                    - `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.

                      - `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 object { type, skills }`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills: optional array of BetaLocalSkill`

                  An optional list of skills.

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `path: string`

                    The path to the directory containing the skill.

              - `BetaContainerReference object { container_id, type }`

                - `container_id: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools loaded inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                  The name of the loaded function tool.

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              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.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

          - `McpProtocolError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError object { content, type }`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

    - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

    - `string`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: array of 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 object { id, content, role, 4 more }`

      An output message from the model.

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional 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 or 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.

  - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" or "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 of map[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 object { type }`

      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" or "web_search_preview" or "computer" or 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 object { name, type }`

      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 object { server_label, type, name }`

      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: optional string or null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom object { name, type }`

      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 object { type }`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch object { type }`

      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 object { type }`

      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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

    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.

    - `Function object { name, parameters, strict, 6 more }`

      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: map[unknown] or null`

        A JSON schema object describing the parameters of the function.

      - `strict: boolean or null`

        Whether strict parameter validation is enforced for this function tool.

      - `type: "function"`

        The type of the function tool. Always `function`.

        - `"function"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

      - `defer_loading: optional boolean`

        Whether this function is deferred and loaded via tool search.

      - `description: optional string or null`

        A description of the function. Used by the model to determine whether or not to call the function.

      - `output_schema: optional map[unknown] or null`

        A JSON schema object describing the JSON value encoded in string outputs for this function.

    - `FileSearch object { type, vector_store_ids, filters, 2 more }`

      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 of string`

        The IDs of the vector stores to search.

      - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

        A filter to apply.

        - `ComparisonFilter object { key, type, value }`

          A filter used to compare a specified attribute key to a given value using a defined comparison operation.

          - `key: string`

            The key to compare against the value.

          - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

            The value to compare against the attribute key; supports string, number, or boolean types.

            - `string`

            - `number`

            - `boolean`

            - `array of string or number`

              - `string`

              - `number`

        - `BetaCompoundFilter = unknown`

          Combine multiple filters using `and` or `or`.

      - `max_num_results: optional number`

        The maximum number of results to return. This number should be between 1 and 50 inclusive.

      - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

        Ranking options for search.

        - `hybrid_search: optional object { embedding_weight, text_weight }`

          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: optional "auto" or "default-2024-11-15"`

          The ranker to use for the file search.

          - `"auto"`

          - `"default-2024-11-15"`

        - `score_threshold: optional 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.

    - `Computer object { type }`

      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"`

    - `ComputerUsePreview object { display_height, display_width, environment, type }`

      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" or "mac" or "linux" or 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"`

    - `WebSearch object { type, external_web_access, filters, 2 more }`

      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" or "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: optional 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: optional object { allowed_domains }  or null`

        Filters for the search.

        - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `type: optional "approximate"`

          The type of location approximation. Always `approximate`.

          - `"approximate"`

    - `Mcp object { server_label, type, allowed_callers, 9 more }`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

        List of allowed tool names or a filter object.

        - `McpAllowedTools = array of string`

          A string array of allowed tool names

        - `McpToolFilter object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

        Whether this MCP tool is deferred and discovered via tool search.

      - `headers: optional map[string] or null`

        Optional HTTP headers to send to the MCP server. Use for authentication
        or other purposes.

      - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

        Specify which of the MCP server's tools require approval.

        - `McpToolApprovalFilter object { always, never }`

          Specify which of the MCP server's tools require approval. Can be
          `always`, `never`, or a filter object associated with tools
          that require approval.

          - `always: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

          - `never: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `McpToolApprovalSetting = "always" or "never"`

          Specify a single approval policy for all tools. One of `always` or
          `never`. When set to `always`, all tools will require approval. When
          set to `never`, all tools will not require approval.

          - `"always"`

          - `"never"`

      - `server_description: optional string`

        Optional description of the MCP server, used to provide more context.

      - `server_url: optional string`

        The URL for the MCP server. One of `server_url`, `connector_id`, or
        `tunnel_id` must be provided.

      - `tunnel_id: optional 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 object { container, type, allowed_callers }`

      A tool that runs Python code to help generate a response to a prompt.

      - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

        The code interpreter container. Can be a container ID or an object that
        specifies uploaded file IDs to make available to your code, along with an
        optional `memory_limit` setting.

        - `string`

          The container ID.

        - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

          Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

          - `type: "auto"`

            Always `auto`.

            - `"auto"`

          - `file_ids: optional array of string`

            An optional list of uploaded files to make available to your code.

          - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

            The memory limit for the code interpreter container.

            - `"1g"`

            - `"4g"`

            - `"16g"`

            - `"64g"`

          - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

            Network access policy for the container.

            - `BetaContainerNetworkPolicyDisabled object { type }`

            - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

      - `type: "code_interpreter"`

        The type of the code interpreter tool. Always `code_interpreter`.

        - `"code_interpreter"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

    - `ProgrammaticToolCalling object { type }`

      - `type: "programmatic_tool_calling"`

        The type of the tool. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `ImageGeneration object { type, action, background, 9 more }`

      A tool that generates images using the GPT image models.

      - `type: "image_generation"`

        The type of the image generation tool. Always `image_generation`.

        - `"image_generation"`

      - `action: optional "generate" or "edit" or "auto"`

        Whether to generate a new image or edit an existing image. Default: `auto`.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `background: optional "transparent" or "opaque" or "auto"`

        Set the background of the generated image. One of `transparent`, `opaque`,
        or `auto`. `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`.
        Default: `auto`.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

        Optional mask for inpainting. Contains `image_url`
        (string, optional) and `file_id` (string, optional).

        - `file_id: optional string`

          File ID for the mask image.

        - `image_url: optional string`

          Base64-encoded mask image.

      - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `string`

        - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `"gpt-image-1"`

          - `"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"`

      - `moderation: optional "auto" or "low"`

        Moderation level for the generated image. Default: `auto`.

        - `"auto"`

        - `"low"`

      - `output_compression: optional number`

        Compression level for the output image. Default: 100.

      - `output_format: optional "png" or "webp" or "jpeg"`

        The output format of the generated image. One of `png`, `webp`, or
        `jpeg`. Default: `png`.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `partial_images: optional number`

        Number of partial images to generate in streaming mode, from 0 (default value) to 3.

      - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

          - `"auto"`

    - `LocalShell object { type }`

      A tool that allows the model to execute shell commands in a local environment.

      - `type: "local_shell"`

        The type of the local shell tool. Always `local_shell`.

        - `"local_shell"`

    - `Shell object { type, allowed_callers, environment }`

      A tool that allows the model to execute shell commands.

      - `type: "shell"`

        The type of the shell tool. Always `shell`.

        - `"shell"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

        - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

    - `Custom object { name, type, allowed_callers, 4 more }`

      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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this tool should be deferred and discovered via tool search.

      - `description: optional string`

        Optional description of the custom tool, used to provide more context.

      - `format: optional Text { type }  or Grammar { definition, syntax, type }`

        The input format for the custom tool. Default is unconstrained text.

        - `Text object { type }`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar object { definition, syntax, type }`

          A grammar defined by the user.

          - `definition: string`

            The grammar definition.

          - `syntax: "lark" or "regex"`

            The syntax of the grammar definition. One of `lark` or `regex`.

            - `"lark"`

            - `"regex"`

          - `type: "grammar"`

            Grammar format. Always `grammar`.

            - `"grammar"`

    - `Namespace object { description, name, tools, type }`

      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`).

      - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

        The function/custom tools available inside this namespace.

        - `Function object { name, type, allowed_callers, 6 more }`

          - `name: string`

          - `type: "function"`

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this function should be deferred and discovered via tool search.

          - `description: optional string or null`

          - `output_schema: optional map[unknown] or null`

            A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

          - `parameters: optional unknown or null`

          - `strict: optional boolean or 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.

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "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"`

    - `ToolSearch object { type, description, execution, parameters }`

      Hosted or BYOT tool search configuration for deferred tools.

      - `type: "tool_search"`

        The type of the tool. Always `tool_search`.

        - `"tool_search"`

      - `description: optional string or null`

        Description shown to the model for a client-executed tool search tool.

      - `execution: optional "server" or "client"`

        Whether tool search is executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `parameters: optional unknown or null`

        Parameter schema for a client-executed tool search tool.

    - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `type: "web_search_preview" or "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: optional array of "text" or "image"`

        - `"text"`

        - `"image"`

      - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

    - `ApplyPatch object { type, allowed_callers }`

      Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "apply_patch"`

        The type of the tool. Always `apply_patch`.

        - `"apply_patch"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

  - `top_p: number or 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.

  - `background: optional boolean or null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at: optional number or null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

  - `conversation: optional object { id }  or 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.

  - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response input.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response output.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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_text: optional string or null`

    SDK-only convenience property that contains the aggregated text output
    from all `output_text` items in the `output` array, if any are present.
    Supported in the Python and JavaScript SDKs.

  - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

    - `version: optional string or null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit object { type }`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound object { type }`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable object { type }`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" or "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

    - `comparison_response_id: optional string or null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `string`

      - `"standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `"standard"`

        - `"pro"`

    - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

  - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

        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: map[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: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `strict: optional boolean or 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 object { type }`

        JSON object response format. An older method of generating JSON responses.
        Using `json_schema` is recommended for models that support it. Note that the
        model will not generate JSON without a system or user message instructing it
        to do so.

        - `type: "json_object"`

          The type of response format being defined. Always `json_object`.

          - `"json_object"`

    - `verbosity: optional "low" or "medium" or "high" or 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"`

  - `top_logprobs: optional number or 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.

  - `truncation: optional "auto" or "disabled" or 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.
    - `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: optional BetaResponseUsage or null`

    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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      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: optional string or null`

    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

```http
curl https://api.openai.com/v1/responses/$RESPONSE_ID/cancel \
    -X POST \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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,
    "context": null
  },
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "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": {},
  "conversation": {
    "id": "id"
  },
  "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",
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "service_tier": "auto"
}
```

### Example

```http
curl -X POST https://api.openai.com/v1/responses/resp_123/cancel \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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

**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).

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Body Parameters

- `model: "gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or string or null`

  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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

  - `string`

- `input: optional string or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or null`

  Text, image, or file inputs to the model, used to generate a response

  - `string`

    A text input to the model, equivalent to a text input with the `user` role.

  - `array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

    A list of one or many input items to the model, containing different content types.

    - `BetaEasyInputMessage object { content, role, phase, type }`

      A message input to the model with a role indicating instruction following
      hierarchy. Instructions given with the `developer` or `system` role take
      precedence over instructions given with the `user` role. Messages with the
      `assistant` role are presumed to have been generated by the model in previous
      interactions.

      - `content: string or BetaResponseInputMessageContentList`

        Text, image, or audio input to the model, used to generate a response.
        Can also contain previous assistant responses.

        - `TextInput = string`

          A text input to the model.

        - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `role: "user" or "assistant" or "system" or "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message object { content, role, agent, 2 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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" or "system" or "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: optional "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { call_id, output, type, 4 more }`

      The output of a computer tool call.

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id: optional string or null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "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: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id: optional string or null`

        The unique ID of this agent message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { action, arguments, call_id, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id: optional string or null`

        The unique ID of this multi-agent call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

          Citations associated with the text content.

          - `FileCitation object { file_id, filename, index, type }`

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation object { end_index, start_index, title, 2 more }`

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `start_index: number`

              The index of the first character of the citation in the message.

            - `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.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `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.

            - `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: optional string or null`

        The unique ID of this multi-agent call output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { arguments, type, id, 4 more }`

      - `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: optional string or null`

        The unique ID of this tool search call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ToolSearchOutput object { tools, type, id, 4 more }`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by the tool search output.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools loaded inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

                The name of the loaded function tool.

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id: optional string or null`

        The unique ID of this tool search output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools object { role, tools, type, 2 more }`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        A list of additional tools made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id: optional string or null`

        The unique ID of this additional tools item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { type, id, agent, reasoning }`

      An update to the conversation's response configuration. The configuration
      remains in effect for subsequent responses until it is replaced by another
      configuration update.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id: optional string or null`

        The unique ID of the configuration update item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        Updates to reasoning configuration. Only effort is supported.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { encrypted_content, type, id, agent }`

      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.

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id: optional string or null`

        The ID of the compaction item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { action, call_id, type, 5 more }`

      A tool representing a request to execute one or more shell commands.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

          Ordered shell commands for the execution environment to run.

        - `max_output_length: optional number or null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms: optional number or 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.

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id: optional string or null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput object { call_id, output, type, 5 more }`

      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.

      - `output: array of BetaResponseFunctionShellCallOutputContent`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          The exit or timeout outcome associated with this shell call.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            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.

        - `stdout: string`

          Captured stdout output for the shell call.

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id: optional string or null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length: optional number or null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall object { call_id, operation, status, 4 more }`

      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.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile object { diff, path, type }`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

          - `path: string`

            Path of the file to create relative to the workspace root.

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

          - `path: string`

            Path of the file to update relative to the workspace root.

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" or "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: optional string or null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

      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.

      - `status: "completed" or "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: optional string or null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output: optional string or null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

      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: optional string or null`

        The unique ID of the approval response

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CompactionTrigger object { type, id, agent }`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id: optional string or null`

        The unique ID of this compaction trigger.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference object { id, agent, type }`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type: optional "item_reference" or null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of this 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 item type. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

- `instructions: optional string or null`

  A system (or developer) message inserted into the model's context.
  When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

- `previous_response_id: optional string or 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_cache_key: optional string or null`

  A key to use when reading from or writing to the prompt cache.

- `prompt_cache_options: optional object { mode, ttl }  or null`

  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`, which is currently the only supported value. See the [prompt caching guide](/api/docs/guides/prompt-caching) for current details.

  - `mode: optional "implicit" or "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: optional "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: optional "in_memory" or "24h" or null`

  How long to retain a prompt cache entry created by this request.

  - `"in_memory"`

  - `"24h"`

- `service_tier: optional "auto" or "default" or "fast" or 2 more or 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. 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"`

### Returns

- `BetaCompactedResponse object { id, created_at, object, 2 more }`

  - `id: string`

    The unique identifier for the compacted response.

  - `created_at: number`

    Unix timestamp (in seconds) when the compacted conversation was created.

  - `object: "response.compaction"`

    The object type. Always `response.compaction`.

    - `"response.compaction"`

  - `output: array of Message { id, content, role, 4 more }  or Program { id, call_id, code, 3 more }  or ProgramOutput { id, call_id, result, 3 more }  or 28 more`

    The compacted list of output items.

    - `Message object { id, content, role, 4 more }`

      A message to or from the model.

      - `id: string`

        The unique ID of the message.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        The content of the message

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

          - `text: string`

            The text input to the model.

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          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: optional string or null`

            The ID of the file to be sent to the model.

          - `image_url: optional string or null`

            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"input_file"`

          - `detail: optional "auto" or "low" or "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: optional string`

            The content of the file to be sent to the model.

          - `file_id: optional string or null`

            The ID of the file to be sent to the model.

          - `file_url: optional string`

            The URL of the file to be sent to the model.

          - `filename: optional string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `status: "in_progress" or "completed" or "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. Always set to `message`.

        - `"message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCallOutput object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"function_call_output"`

      - `id: optional string`

        The unique ID of the function tool call output. Populated when this item
        is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

  - `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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

### Example

```http
curl https://api.openai.com/v1/responses/compact \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "model": "gpt-6-astra",
          "previous_response_id": "resp_123"
        }'
```

#### Response

```json
{
  "id": "resp_001",
  "created_at": 1731459200,
  "object": "response.compaction",
  "output": [
    {
      "id": "msg_001",
      "status": "completed",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Summarize our launch checklist from last week."
        }
      ]
    },
    {
      "id": "msg_002",
      "status": "completed",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "You are performing a CONTEXT CHECKPOINT COMPACTION..."
        }
      ]
    },
    {
      "type": "compaction",
      "id": "cmp_001",
      "encrypted_content": "encrypted-summary"
    }
  ],
  "usage": {
    "input_tokens": 42897,
    "input_tokens_details": {
      "cache_write_tokens": 0,
      "cached_tokens": 0
    },
    "output_tokens": 12000,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 54897
  }
}
```

### Example

```http
curl -X POST https://api.openai.com/v1/responses/compact \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
      "model": "gpt-6-astra",
      "input": [
        {
          "role": "user",
          "content": "Create a simple landing page for a dog petting café."
        },
        {
          "id": "msg_001",
          "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"
        }
      ]
    }'
```

#### Response

```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.

Open a WebSocket connection using the URL below. Supply path and query parameters and authentication during the opening handshake. Once connected, send client events and receive server events as JSON messages. Close the connection when finished.

**WebSocket** `wss://api.openai.com/v1/responses`

### Authentication

Use Bearer Auth (header Authorization).

### Events

[Client events](/api/reference/resources/beta#\(resource\)%20beta.responses%20%3E%20\(model\)%20beta_responses_client_event%20%3E%20\(schema\))

[Server events](/api/reference/resources/beta#\(resource\)%20beta.responses%20%3E%20\(model\)%20beta_responses_server_event%20%3E%20\(schema\))

## Create a model response

**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.

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Body Parameters

- `access_programs: optional object { cyber }`

  Domain-specific access programs to use for this request.

  - `cyber: optional "standard" or "daybreak_blue" or "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: optional boolean or null`

  Whether to run the model response in the background.
  [Learn more](/api/docs/guides/background).

- `context_management: optional array of object { type, compact_threshold }  or null`

  Context management configuration for this request.

  - `type: string`

    The context management entry type. Currently only 'compaction' is supported.

  - `compact_threshold: optional number or null`

    Token threshold at which compaction should be triggered for this entry.

- `conversation: optional string or BetaResponseConversationParam or null`

  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.

  - `ConversationID = string`

    The unique ID of the conversation.

  - `BetaResponseConversationParam object { id }`

    The conversation that this response belongs to.

    - `id: string`

      The unique ID of the conversation.

- `include: optional array of BetaResponseIncludable or null`

  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: optional string or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

  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)

  - `TextInput = string`

    A text input to the model, equivalent to a text input with the
    `user` role.

  - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

    A list of one or many input items to the model, containing
    different content types.

    - `BetaEasyInputMessage object { content, role, phase, type }`

      A message input to the model with a role indicating instruction following
      hierarchy. Instructions given with the `developer` or `system` role take
      precedence over instructions given with the `user` role. Messages with the
      `assistant` role are presumed to have been generated by the model in previous
      interactions.

      - `content: string or BetaResponseInputMessageContentList`

        Text, image, or audio input to the model, used to generate a response.
        Can also contain previous assistant responses.

        - `TextInput = string`

          A text input to the model.

        - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `role: "user" or "assistant" or "system" or "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message object { content, role, agent, 2 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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" or "system" or "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: optional "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { call_id, output, type, 4 more }`

      The output of a computer tool call.

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id: optional string or null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "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: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id: optional string or null`

        The unique ID of this agent message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { action, arguments, call_id, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id: optional string or null`

        The unique ID of this multi-agent call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

          Citations associated with the text content.

          - `FileCitation object { file_id, filename, index, type }`

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation object { end_index, start_index, title, 2 more }`

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `start_index: number`

              The index of the first character of the citation in the message.

            - `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.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `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.

            - `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: optional string or null`

        The unique ID of this multi-agent call output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { arguments, type, id, 4 more }`

      - `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: optional string or null`

        The unique ID of this tool search call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ToolSearchOutput object { tools, type, id, 4 more }`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by the tool search output.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools loaded inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

                The name of the loaded function tool.

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id: optional string or null`

        The unique ID of this tool search output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools object { role, tools, type, 2 more }`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        A list of additional tools made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id: optional string or null`

        The unique ID of this additional tools item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { type, id, agent, reasoning }`

      An update to the conversation's response configuration. The configuration
      remains in effect for subsequent responses until it is replaced by another
      configuration update.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id: optional string or null`

        The unique ID of the configuration update item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        Updates to reasoning configuration. Only effort is supported.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { encrypted_content, type, id, agent }`

      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.

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id: optional string or null`

        The ID of the compaction item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { action, call_id, type, 5 more }`

      A tool representing a request to execute one or more shell commands.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

          Ordered shell commands for the execution environment to run.

        - `max_output_length: optional number or null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms: optional number or 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.

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id: optional string or null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput object { call_id, output, type, 5 more }`

      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.

      - `output: array of BetaResponseFunctionShellCallOutputContent`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          The exit or timeout outcome associated with this shell call.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            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.

        - `stdout: string`

          Captured stdout output for the shell call.

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id: optional string or null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length: optional number or null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall object { call_id, operation, status, 4 more }`

      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.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile object { diff, path, type }`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

          - `path: string`

            Path of the file to create relative to the workspace root.

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

          - `path: string`

            Path of the file to update relative to the workspace root.

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" or "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: optional string or null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

      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.

      - `status: "completed" or "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: optional string or null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output: optional string or null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

      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: optional string or null`

        The unique ID of the approval response

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CompactionTrigger object { type, id, agent }`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id: optional string or null`

        The unique ID of this compaction trigger.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference object { id, agent, type }`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type: optional "item_reference" or null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of this 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 item type. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

- `instructions: optional string or 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.

- `max_output_tokens: optional number or 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: optional number or 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.

- `metadata: optional map[string] or 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: optional "gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

  - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

  - `string`

- `moderation: optional object { model, policy }  or null`

  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: optional object { input, output }  or null`

    The policy to apply to moderated response input and output.

    - `input: optional object { mode }  or null`

      The moderation policy for the response input.

      - `mode: "score" or "block"`

        - `"score"`

        - `"block"`

    - `output: optional object { mode }  or null`

      The moderation policy for the response output.

      - `mode: "score" or "block"`

        - `"score"`

        - `"block"`

- `multi_agent: optional object { enabled, max_concurrent_subagents }  or null`

  Configuration for server-hosted multi-agent execution.

  - `enabled: boolean`

    Whether to enable server-hosted multi-agent execution for this response.

  - `max_concurrent_subagents: optional 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.

- `parallel_tool_calls: optional boolean or null`

  Whether to allow the model to run tool calls in parallel.

- `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

      A text input to the model.

    - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

      An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

    - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

      A file input to the model.

  - `version: optional string or null`

    Optional version of the prompt template.

- `prompt_cache_key: optional string or 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: optional object { comparison_response_id, mode, prewarm, ttl }`

  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`, which is currently the only supported value. See the [prompt caching guide](/api/docs/guides/prompt-caching) for current details.

  - `comparison_response_id: optional string or 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: optional "implicit" or "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: optional boolean`

    Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`.

  - `ttl: optional "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: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

  Configuration options for
  [reasoning models](/api/docs/guides/reasoning).

  - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

    Controls the reasoning execution mode for the request.

    When returned on a response, this is the effective execution mode.

    - `string`

    - `"standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `"standard"`

      - `"pro"`

  - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

- `service_tier: optional BetaServiceTier or 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"`

- `store: optional boolean or null`

  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: optional boolean or null`

  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.

- `stream_options: optional object { include_obfuscation }  or null`

  Options for streaming responses. Only set this when you set `stream: true`.

  - `include_obfuscation: optional 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: optional number or 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.

- `text: optional 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: optional 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 object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

      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: map[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: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `strict: optional boolean or 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 object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

  - `verbosity: optional "low" or "medium" or "high" or 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: optional BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

    Constrains the tools available to the model to a pre-defined set.

    - `mode: "auto" or "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 of map[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 object { type }`

    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" or "web_search_preview" or "computer" or 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 object { name, type }`

    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 object { server_label, type, name }`

    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: optional string or null`

      The name of the tool to call on the server.

  - `BetaToolChoiceCustom object { name, type }`

    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 object { type }`

    - `type: "programmatic_tool_calling"`

      The tool to call. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `BetaToolChoiceApplyPatch object { type }`

    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 object { type }`

    Forces the model to call the shell tool when a tool call is required.

    - `type: "shell"`

      The tool to call. Always `shell`.

      - `"shell"`

- `tools: optional array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

  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.

  - `Function object { name, parameters, strict, 6 more }`

    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: map[unknown] or null`

      A JSON schema object describing the parameters of the function.

    - `strict: boolean or null`

      Whether strict parameter validation is enforced for this function tool.

    - `type: "function"`

      The type of the function tool. Always `function`.

      - `"function"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `async: optional boolean`

    - `defer_loading: optional boolean`

      Whether this function is deferred and loaded via tool search.

    - `description: optional string or null`

      A description of the function. Used by the model to determine whether or not to call the function.

    - `output_schema: optional map[unknown] or null`

      A JSON schema object describing the JSON value encoded in string outputs for this function.

  - `FileSearch object { type, vector_store_ids, filters, 2 more }`

    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 of string`

      The IDs of the vector stores to search.

    - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

      A filter to apply.

      - `ComparisonFilter object { key, type, value }`

        A filter used to compare a specified attribute key to a given value using a defined comparison operation.

        - `key: string`

          The key to compare against the value.

        - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

          The value to compare against the attribute key; supports string, number, or boolean types.

          - `string`

          - `number`

          - `boolean`

          - `array of string or number`

            - `string`

            - `number`

      - `BetaCompoundFilter = unknown`

        Combine multiple filters using `and` or `or`.

    - `max_num_results: optional number`

      The maximum number of results to return. This number should be between 1 and 50 inclusive.

    - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

      Ranking options for search.

      - `hybrid_search: optional object { embedding_weight, text_weight }`

        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: optional "auto" or "default-2024-11-15"`

        The ranker to use for the file search.

        - `"auto"`

        - `"default-2024-11-15"`

      - `score_threshold: optional 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.

  - `Computer object { type }`

    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"`

  - `ComputerUsePreview object { display_height, display_width, environment, type }`

    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" or "mac" or "linux" or 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"`

  - `WebSearch object { type, external_web_access, filters, 2 more }`

    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" or "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: optional 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: optional object { allowed_domains }  or null`

      Filters for the search.

      - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

        Free text input for the city of the user, e.g. `San Francisco`.

      - `country: optional string or null`

        The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

      - `region: optional string or null`

        Free text input for the region of the user, e.g. `California`.

      - `timezone: optional string or null`

        The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `type: optional "approximate"`

        The type of location approximation. Always `approximate`.

        - `"approximate"`

  - `Mcp object { server_label, type, allowed_callers, 9 more }`

    Give the model access to additional tools via remote Model Context Protocol
    (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

      List of allowed tool names or a filter object.

      - `McpAllowedTools = array of string`

        A string array of allowed tool names

      - `McpToolFilter object { read_only, tool_names }`

        A filter object to specify which tools are allowed.

        - `read_only: optional 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: optional array of string`

          List of allowed tool names.

    - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

      Whether this MCP tool is deferred and discovered via tool search.

    - `headers: optional map[string] or null`

      Optional HTTP headers to send to the MCP server. Use for authentication
      or other purposes.

    - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

      Specify which of the MCP server's tools require approval.

      - `McpToolApprovalFilter object { always, never }`

        Specify which of the MCP server's tools require approval. Can be
        `always`, `never`, or a filter object associated with tools
        that require approval.

        - `always: optional object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

        - `never: optional object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `McpToolApprovalSetting = "always" or "never"`

        Specify a single approval policy for all tools. One of `always` or
        `never`. When set to `always`, all tools will require approval. When
        set to `never`, all tools will not require approval.

        - `"always"`

        - `"never"`

    - `server_description: optional string`

      Optional description of the MCP server, used to provide more context.

    - `server_url: optional string`

      The URL for the MCP server. One of `server_url`, `connector_id`, or
      `tunnel_id` must be provided.

    - `tunnel_id: optional 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 object { container, type, allowed_callers }`

    A tool that runs Python code to help generate a response to a prompt.

    - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

      The code interpreter container. Can be a container ID or an object that
      specifies uploaded file IDs to make available to your code, along with an
      optional `memory_limit` setting.

      - `string`

        The container ID.

      - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

        Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

        - `type: "auto"`

          Always `auto`.

          - `"auto"`

        - `file_ids: optional array of string`

          An optional list of uploaded files to make available to your code.

        - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

          The memory limit for the code interpreter container.

          - `"1g"`

          - `"4g"`

          - `"16g"`

          - `"64g"`

        - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

          Network access policy for the container.

          - `BetaContainerNetworkPolicyDisabled object { type }`

          - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

    - `type: "code_interpreter"`

      The type of the code interpreter tool. Always `code_interpreter`.

      - `"code_interpreter"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

  - `ProgrammaticToolCalling object { type }`

    - `type: "programmatic_tool_calling"`

      The type of the tool. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `ImageGeneration object { type, action, background, 9 more }`

    A tool that generates images using the GPT image models.

    - `type: "image_generation"`

      The type of the image generation tool. Always `image_generation`.

      - `"image_generation"`

    - `action: optional "generate" or "edit" or "auto"`

      Whether to generate a new image or edit an existing image. Default: `auto`.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `background: optional "transparent" or "opaque" or "auto"`

      Set the background of the generated image. One of `transparent`, `opaque`,
      or `auto`. `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`.
      Default: `auto`.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

      Optional mask for inpainting. Contains `image_url`
      (string, optional) and `file_id` (string, optional).

      - `file_id: optional string`

        File ID for the mask image.

      - `image_url: optional string`

        Base64-encoded mask image.

    - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

      The image generation model to use. One of `gpt-image-1`,
      `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`, or `chatgpt-image-latest`. Default:
      `gpt-image-1`.

      - `string`

      - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `"gpt-image-1"`

        - `"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"`

    - `moderation: optional "auto" or "low"`

      Moderation level for the generated image. Default: `auto`.

      - `"auto"`

      - `"low"`

    - `output_compression: optional number`

      Compression level for the output image. Default: 100.

    - `output_format: optional "png" or "webp" or "jpeg"`

      The output format of the generated image. One of `png`, `webp`, or
      `jpeg`. Default: `png`.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

    - `partial_images: optional number`

      Number of partial images to generate in streaming mode, from 0 (default value) to 3.

    - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

        - `"auto"`

  - `LocalShell object { type }`

    A tool that allows the model to execute shell commands in a local environment.

    - `type: "local_shell"`

      The type of the local shell tool. Always `local_shell`.

      - `"local_shell"`

  - `Shell object { type, allowed_callers, environment }`

    A tool that allows the model to execute shell commands.

    - `type: "shell"`

      The type of the shell tool. Always `shell`.

      - `"shell"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

      - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

      - `BetaLocalEnvironment object { type, skills }`

      - `BetaContainerReference object { container_id, type }`

  - `Custom object { name, type, allowed_callers, 4 more }`

    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: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `async: optional boolean`

      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

    - `defer_loading: optional boolean`

      Whether this tool should be deferred and discovered via tool search.

    - `description: optional string`

      Optional description of the custom tool, used to provide more context.

    - `format: optional Text { type }  or Grammar { definition, syntax, type }`

      The input format for the custom tool. Default is unconstrained text.

      - `Text object { type }`

        Unconstrained free-form text.

        - `type: "text"`

          Unconstrained text format. Always `text`.

          - `"text"`

      - `Grammar object { definition, syntax, type }`

        A grammar defined by the user.

        - `definition: string`

          The grammar definition.

        - `syntax: "lark" or "regex"`

          The syntax of the grammar definition. One of `lark` or `regex`.

          - `"lark"`

          - `"regex"`

        - `type: "grammar"`

          Grammar format. Always `grammar`.

          - `"grammar"`

  - `Namespace object { description, name, tools, type }`

    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`).

    - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

      The function/custom tools available inside this namespace.

      - `Function object { name, type, allowed_callers, 6 more }`

        - `name: string`

        - `type: "function"`

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this function should be deferred and discovered via tool search.

        - `description: optional string or null`

        - `output_schema: optional map[unknown] or null`

          A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

        - `parameters: optional unknown or null`

        - `strict: optional boolean or 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.

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "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"`

  - `ToolSearch object { type, description, execution, parameters }`

    Hosted or BYOT tool search configuration for deferred tools.

    - `type: "tool_search"`

      The type of the tool. Always `tool_search`.

      - `"tool_search"`

    - `description: optional string or null`

      Description shown to the model for a client-executed tool search tool.

    - `execution: optional "server" or "client"`

      Whether tool search is executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `parameters: optional unknown or null`

      Parameter schema for a client-executed tool search tool.

  - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

    This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `type: "web_search_preview" or "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: optional array of "text" or "image"`

      - `"text"`

      - `"image"`

    - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

        Free text input for the city of the user, e.g. `San Francisco`.

      - `country: optional string or null`

        The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

      - `region: optional string or null`

        Free text input for the region of the user, e.g. `California`.

      - `timezone: optional string or null`

        The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

  - `ApplyPatch object { type, allowed_callers }`

    Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "apply_patch"`

      The type of the tool. Always `apply_patch`.

      - `"apply_patch"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

- `top_logprobs: optional number or 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.

- `top_p: optional number or 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.

- `truncation: optional "auto" or "disabled" or 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.
  - `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: optional string or null`

  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).

### Returns

- `BetaResponse object { id, access_programs, created_at, 34 more }`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: object { cyber }  or null`

    - `cyber: "standard" or "daybreak_blue" or "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.

  - `error: BetaResponseError or null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

      - `detailed_explanation: optional string`

        The public explanation for this block.

      - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

        An optional classification; clients must accept additional values.

        - `string`

        - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target: optional string or null`

        An opaque target for explicitly continuing this review, or null when unavailable.

      - `steer: optional object { message }`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param: optional string or null`

      The request parameter associated with the error, or null if none was recorded.

    - `type: optional string or null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: object { reason }  or null`

    Details about why the response is incomplete.

    - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

      A text input to the model, equivalent to a text input with the
      `developer` role.

    - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      A list of one or many input items to the model, containing
      different content types.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

        - `content: string or BetaResponseInputMessageContentList`

          Text, image, or audio input to the model, used to generate a response.
          Can also contain previous assistant responses.

          - `TextInput = string`

            A text input to the model.

          - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string`

                The content of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string`

                The URL of the file to be sent to the model.

              - `filename: optional string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

        - `role: "user" or "assistant" or "system" or "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

          The content of the output message.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

              - `FileCitation object { file_id, filename, index, type }`

                A citation to a file.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index 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 object { end_index, start_index, title, 2 more }`

                A citation for a web resource used to generate a model response.

                - `end_index: number`

                  The index of the last character of the URL citation in the message.

                - `start_index: number`

                  The index of the first character of the URL citation in the message.

                - `title: string`

                  The title of the web resource.

                - `type: "url_citation"`

                  The type of the URL citation. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the web resource.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                A citation for a container file used to generate a model response.

                - `container_id: string`

                  The ID of the container file.

                - `end_index: number`

                  The index of the last character of the container file citation in the message.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the container file citation in the message.

                - `type: "container_file_citation"`

                  The type of the container file citation. Always `container_file_citation`.

                  - `"container_file_citation"`

              - `FilePath object { file_id, index, type }`

                A path to a file.

                - `file_id: string`

                  The ID of the file.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_path"`

                  The type of the file path. Always `file_path`.

                  - `"file_path"`

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

              - `top_logprobs: array of object { token, bytes, logprob }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `phase: optional "commentary" or "final_answer" or 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"`

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

          - `Click object { button, type, x, 2 more }`

            A click action.

            - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

              The keys being held while clicking.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

            - `keys: array of string or 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 object { path, type, keys }`

            A drag action.

            - `path: array of object { x, y }`

              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: optional array of string or null`

              The keys being held while dragging the mouse.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

            - `keys: array of 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 object { type, x, y, keys }`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"move"`

            - `x: number`

              The x-coordinate to move to.

            - `y: number`

              The y-coordinate to move to.

            - `keys: optional array of string or null`

              The keys being held while moving the mouse.

          - `Screenshot object { type }`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

            - `scroll_x: number`

              The horizontal scroll distance.

            - `scroll_y: number`

              The vertical scroll distance.

            - `type: "scroll"`

              Specifies the event type. For a scroll action, this property is always set to `scroll`.

              - `"scroll"`

            - `x: number`

              The x-coordinate where the scroll occurred.

            - `y: number`

              The y-coordinate where the scroll occurred.

            - `keys: optional array of string or null`

              The keys being held while scrolling.

          - `Type object { text, type }`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait object { type }`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click object { button, type, x, 2 more }`

            A click action.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

          - `Drag object { path, type, keys }`

            A drag action.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

          - `Move object { type, x, y, keys }`

            A mouse move action.

          - `Screenshot object { type }`

            A screenshot action.

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

          - `Type object { text, type }`

            An action to type in text.

          - `Wait object { type }`

            A wait action.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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: optional string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: optional string`

            The URL of the screenshot image.

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              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: optional BetaImageDetail or 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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string or null`

                The base64-encoded data of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string or null`

                The URL of the file to be sent to the model.

              - `filename: optional string or null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "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: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `allowed_domains: array of string`

                      A list of allowed domains when type is `allowlist`.

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                      Optional domain-scoped secrets for allowlisted domains.

                      - `domain: string`

                        The domain associated with the secret.

                      - `name: string`

                        The name of the secret to inject for the domain.

                      - `value: string`

                        The secret value to inject for the domain.

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                  An optional list of skills referenced by id or inline data.

                  - `BetaSkillReference object { skill_id, type, version }`

                    - `skill_id: string`

                      The ID of the referenced skill.

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version: optional string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill object { description, name, source, type }`

                    - `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.

                      - `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 object { type, skills }`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills: optional array of BetaLocalSkill`

                  An optional list of skills.

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `path: string`

                    The path to the directory containing the skill.

              - `BetaContainerReference object { container_id, type }`

                - `container_id: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools loaded inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                  The name of the loaded function tool.

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              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.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

          - `McpProtocolError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError object { content, type }`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

    - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

    - `string`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: array of 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 object { id, content, role, 4 more }`

      An output message from the model.

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional 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 or 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.

  - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" or "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 of map[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 object { type }`

      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" or "web_search_preview" or "computer" or 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 object { name, type }`

      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 object { server_label, type, name }`

      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: optional string or null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom object { name, type }`

      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 object { type }`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch object { type }`

      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 object { type }`

      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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

    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.

    - `Function object { name, parameters, strict, 6 more }`

      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: map[unknown] or null`

        A JSON schema object describing the parameters of the function.

      - `strict: boolean or null`

        Whether strict parameter validation is enforced for this function tool.

      - `type: "function"`

        The type of the function tool. Always `function`.

        - `"function"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

      - `defer_loading: optional boolean`

        Whether this function is deferred and loaded via tool search.

      - `description: optional string or null`

        A description of the function. Used by the model to determine whether or not to call the function.

      - `output_schema: optional map[unknown] or null`

        A JSON schema object describing the JSON value encoded in string outputs for this function.

    - `FileSearch object { type, vector_store_ids, filters, 2 more }`

      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 of string`

        The IDs of the vector stores to search.

      - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

        A filter to apply.

        - `ComparisonFilter object { key, type, value }`

          A filter used to compare a specified attribute key to a given value using a defined comparison operation.

          - `key: string`

            The key to compare against the value.

          - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

            The value to compare against the attribute key; supports string, number, or boolean types.

            - `string`

            - `number`

            - `boolean`

            - `array of string or number`

              - `string`

              - `number`

        - `BetaCompoundFilter = unknown`

          Combine multiple filters using `and` or `or`.

      - `max_num_results: optional number`

        The maximum number of results to return. This number should be between 1 and 50 inclusive.

      - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

        Ranking options for search.

        - `hybrid_search: optional object { embedding_weight, text_weight }`

          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: optional "auto" or "default-2024-11-15"`

          The ranker to use for the file search.

          - `"auto"`

          - `"default-2024-11-15"`

        - `score_threshold: optional 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.

    - `Computer object { type }`

      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"`

    - `ComputerUsePreview object { display_height, display_width, environment, type }`

      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" or "mac" or "linux" or 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"`

    - `WebSearch object { type, external_web_access, filters, 2 more }`

      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" or "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: optional 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: optional object { allowed_domains }  or null`

        Filters for the search.

        - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `type: optional "approximate"`

          The type of location approximation. Always `approximate`.

          - `"approximate"`

    - `Mcp object { server_label, type, allowed_callers, 9 more }`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

        List of allowed tool names or a filter object.

        - `McpAllowedTools = array of string`

          A string array of allowed tool names

        - `McpToolFilter object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

        Whether this MCP tool is deferred and discovered via tool search.

      - `headers: optional map[string] or null`

        Optional HTTP headers to send to the MCP server. Use for authentication
        or other purposes.

      - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

        Specify which of the MCP server's tools require approval.

        - `McpToolApprovalFilter object { always, never }`

          Specify which of the MCP server's tools require approval. Can be
          `always`, `never`, or a filter object associated with tools
          that require approval.

          - `always: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

          - `never: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `McpToolApprovalSetting = "always" or "never"`

          Specify a single approval policy for all tools. One of `always` or
          `never`. When set to `always`, all tools will require approval. When
          set to `never`, all tools will not require approval.

          - `"always"`

          - `"never"`

      - `server_description: optional string`

        Optional description of the MCP server, used to provide more context.

      - `server_url: optional string`

        The URL for the MCP server. One of `server_url`, `connector_id`, or
        `tunnel_id` must be provided.

      - `tunnel_id: optional 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 object { container, type, allowed_callers }`

      A tool that runs Python code to help generate a response to a prompt.

      - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

        The code interpreter container. Can be a container ID or an object that
        specifies uploaded file IDs to make available to your code, along with an
        optional `memory_limit` setting.

        - `string`

          The container ID.

        - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

          Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

          - `type: "auto"`

            Always `auto`.

            - `"auto"`

          - `file_ids: optional array of string`

            An optional list of uploaded files to make available to your code.

          - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

            The memory limit for the code interpreter container.

            - `"1g"`

            - `"4g"`

            - `"16g"`

            - `"64g"`

          - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

            Network access policy for the container.

            - `BetaContainerNetworkPolicyDisabled object { type }`

            - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

      - `type: "code_interpreter"`

        The type of the code interpreter tool. Always `code_interpreter`.

        - `"code_interpreter"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

    - `ProgrammaticToolCalling object { type }`

      - `type: "programmatic_tool_calling"`

        The type of the tool. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `ImageGeneration object { type, action, background, 9 more }`

      A tool that generates images using the GPT image models.

      - `type: "image_generation"`

        The type of the image generation tool. Always `image_generation`.

        - `"image_generation"`

      - `action: optional "generate" or "edit" or "auto"`

        Whether to generate a new image or edit an existing image. Default: `auto`.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `background: optional "transparent" or "opaque" or "auto"`

        Set the background of the generated image. One of `transparent`, `opaque`,
        or `auto`. `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`.
        Default: `auto`.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

        Optional mask for inpainting. Contains `image_url`
        (string, optional) and `file_id` (string, optional).

        - `file_id: optional string`

          File ID for the mask image.

        - `image_url: optional string`

          Base64-encoded mask image.

      - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `string`

        - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `"gpt-image-1"`

          - `"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"`

      - `moderation: optional "auto" or "low"`

        Moderation level for the generated image. Default: `auto`.

        - `"auto"`

        - `"low"`

      - `output_compression: optional number`

        Compression level for the output image. Default: 100.

      - `output_format: optional "png" or "webp" or "jpeg"`

        The output format of the generated image. One of `png`, `webp`, or
        `jpeg`. Default: `png`.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `partial_images: optional number`

        Number of partial images to generate in streaming mode, from 0 (default value) to 3.

      - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

          - `"auto"`

    - `LocalShell object { type }`

      A tool that allows the model to execute shell commands in a local environment.

      - `type: "local_shell"`

        The type of the local shell tool. Always `local_shell`.

        - `"local_shell"`

    - `Shell object { type, allowed_callers, environment }`

      A tool that allows the model to execute shell commands.

      - `type: "shell"`

        The type of the shell tool. Always `shell`.

        - `"shell"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

        - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

    - `Custom object { name, type, allowed_callers, 4 more }`

      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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this tool should be deferred and discovered via tool search.

      - `description: optional string`

        Optional description of the custom tool, used to provide more context.

      - `format: optional Text { type }  or Grammar { definition, syntax, type }`

        The input format for the custom tool. Default is unconstrained text.

        - `Text object { type }`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar object { definition, syntax, type }`

          A grammar defined by the user.

          - `definition: string`

            The grammar definition.

          - `syntax: "lark" or "regex"`

            The syntax of the grammar definition. One of `lark` or `regex`.

            - `"lark"`

            - `"regex"`

          - `type: "grammar"`

            Grammar format. Always `grammar`.

            - `"grammar"`

    - `Namespace object { description, name, tools, type }`

      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`).

      - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

        The function/custom tools available inside this namespace.

        - `Function object { name, type, allowed_callers, 6 more }`

          - `name: string`

          - `type: "function"`

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this function should be deferred and discovered via tool search.

          - `description: optional string or null`

          - `output_schema: optional map[unknown] or null`

            A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

          - `parameters: optional unknown or null`

          - `strict: optional boolean or 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.

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "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"`

    - `ToolSearch object { type, description, execution, parameters }`

      Hosted or BYOT tool search configuration for deferred tools.

      - `type: "tool_search"`

        The type of the tool. Always `tool_search`.

        - `"tool_search"`

      - `description: optional string or null`

        Description shown to the model for a client-executed tool search tool.

      - `execution: optional "server" or "client"`

        Whether tool search is executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `parameters: optional unknown or null`

        Parameter schema for a client-executed tool search tool.

    - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `type: "web_search_preview" or "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: optional array of "text" or "image"`

        - `"text"`

        - `"image"`

      - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

    - `ApplyPatch object { type, allowed_callers }`

      Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "apply_patch"`

        The type of the tool. Always `apply_patch`.

        - `"apply_patch"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

  - `top_p: number or 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.

  - `background: optional boolean or null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at: optional number or null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

  - `conversation: optional object { id }  or 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.

  - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response input.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response output.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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_text: optional string or null`

    SDK-only convenience property that contains the aggregated text output
    from all `output_text` items in the `output` array, if any are present.
    Supported in the Python and JavaScript SDKs.

  - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

    - `version: optional string or null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit object { type }`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound object { type }`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable object { type }`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" or "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

    - `comparison_response_id: optional string or null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `string`

      - `"standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `"standard"`

        - `"pro"`

    - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

  - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

        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: map[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: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `strict: optional boolean or 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 object { type }`

        JSON object response format. An older method of generating JSON responses.
        Using `json_schema` is recommended for models that support it. Note that the
        model will not generate JSON without a system or user message instructing it
        to do so.

        - `type: "json_object"`

          The type of response format being defined. Always `json_object`.

          - `"json_object"`

    - `verbosity: optional "low" or "medium" or "high" or 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"`

  - `top_logprobs: optional number or 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.

  - `truncation: optional "auto" or "disabled" or 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.
    - `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: optional BetaResponseUsage or null`

    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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      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: optional string or null`

    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

```http
curl https://api.openai.com/v1/responses \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '"string"'
```

#### Response

```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,
    "context": null
  },
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "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": {},
  "conversation": {
    "id": "id"
  },
  "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",
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "service_tier": "auto"
}
```

### File input

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "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"
          }
        ]
      }
    ]
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "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?"
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "input": "What is the weather like in Boston today?",
    "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"]
        }
      }
    ],
    "tool_choice": "auto"
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "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"
          }
        ]
      }
    ]
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "input": "How much wood would a woodchuck chuck?",
    "reasoning": {
      "effort": "high"
    }
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "instructions": "You are a helpful assistant.",
    "input": "Hello!",
    "stream": true
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }'
```

#### Response

```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

```http
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "tools": [{ "type": "web_search_preview" }],
    "input": "What was a positive news story from today?"
  }'
```

#### Response

```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

**delete** `/responses/{response_id}?beta=true`

Deletes a model response with the given ID.

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Path Parameters

- `response_id: string`

### Returns

- `id: string`

- `deleted: boolean`

- `object: "response.deleted"`

  - `"response.deleted"`

### Example

```http
curl https://api.openai.com/v1/responses/$RESPONSE_ID \
    -X DELETE \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "response.deleted"
}
```

### Example

```http
curl -X DELETE https://api.openai.com/v1/responses/resp_123 \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "resp_123",
  "object": "response.deleted",
  "deleted": true
}
```

## Get a model response

**get** `/responses/{response_id}?beta=true`

Retrieves a model response with the given ID.

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Path Parameters

- `response_id: string`

### Query Parameters

- `include: optional array of BetaResponseIncludable`

  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: optional 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.

- `starting_after: optional number`

  The sequence number of the event after which to start streaming.

- `stream: optional false`

  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`

### Returns

- `BetaResponse object { id, access_programs, created_at, 34 more }`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: object { cyber }  or null`

    - `cyber: "standard" or "daybreak_blue" or "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.

  - `error: BetaResponseError or null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

      - `detailed_explanation: optional string`

        The public explanation for this block.

      - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

        An optional classification; clients must accept additional values.

        - `string`

        - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target: optional string or null`

        An opaque target for explicitly continuing this review, or null when unavailable.

      - `steer: optional object { message }`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param: optional string or null`

      The request parameter associated with the error, or null if none was recorded.

    - `type: optional string or null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: object { reason }  or null`

    Details about why the response is incomplete.

    - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

      A text input to the model, equivalent to a text input with the
      `developer` role.

    - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      A list of one or many input items to the model, containing
      different content types.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

        - `content: string or BetaResponseInputMessageContentList`

          Text, image, or audio input to the model, used to generate a response.
          Can also contain previous assistant responses.

          - `TextInput = string`

            A text input to the model.

          - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string`

                The content of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string`

                The URL of the file to be sent to the model.

              - `filename: optional string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

        - `role: "user" or "assistant" or "system" or "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

          The content of the output message.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

              - `FileCitation object { file_id, filename, index, type }`

                A citation to a file.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index 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 object { end_index, start_index, title, 2 more }`

                A citation for a web resource used to generate a model response.

                - `end_index: number`

                  The index of the last character of the URL citation in the message.

                - `start_index: number`

                  The index of the first character of the URL citation in the message.

                - `title: string`

                  The title of the web resource.

                - `type: "url_citation"`

                  The type of the URL citation. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the web resource.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                A citation for a container file used to generate a model response.

                - `container_id: string`

                  The ID of the container file.

                - `end_index: number`

                  The index of the last character of the container file citation in the message.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the container file citation in the message.

                - `type: "container_file_citation"`

                  The type of the container file citation. Always `container_file_citation`.

                  - `"container_file_citation"`

              - `FilePath object { file_id, index, type }`

                A path to a file.

                - `file_id: string`

                  The ID of the file.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_path"`

                  The type of the file path. Always `file_path`.

                  - `"file_path"`

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

              - `top_logprobs: array of object { token, bytes, logprob }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `phase: optional "commentary" or "final_answer" or 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"`

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

          - `Click object { button, type, x, 2 more }`

            A click action.

            - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

              The keys being held while clicking.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

            - `keys: array of string or 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 object { path, type, keys }`

            A drag action.

            - `path: array of object { x, y }`

              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: optional array of string or null`

              The keys being held while dragging the mouse.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

            - `keys: array of 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 object { type, x, y, keys }`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"move"`

            - `x: number`

              The x-coordinate to move to.

            - `y: number`

              The y-coordinate to move to.

            - `keys: optional array of string or null`

              The keys being held while moving the mouse.

          - `Screenshot object { type }`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

            - `scroll_x: number`

              The horizontal scroll distance.

            - `scroll_y: number`

              The vertical scroll distance.

            - `type: "scroll"`

              Specifies the event type. For a scroll action, this property is always set to `scroll`.

              - `"scroll"`

            - `x: number`

              The x-coordinate where the scroll occurred.

            - `y: number`

              The y-coordinate where the scroll occurred.

            - `keys: optional array of string or null`

              The keys being held while scrolling.

          - `Type object { text, type }`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait object { type }`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click object { button, type, x, 2 more }`

            A click action.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

          - `Drag object { path, type, keys }`

            A drag action.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

          - `Move object { type, x, y, keys }`

            A mouse move action.

          - `Screenshot object { type }`

            A screenshot action.

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

          - `Type object { text, type }`

            An action to type in text.

          - `Wait object { type }`

            A wait action.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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: optional string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: optional string`

            The URL of the screenshot image.

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              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: optional BetaImageDetail or 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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string or null`

                The base64-encoded data of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string or null`

                The URL of the file to be sent to the model.

              - `filename: optional string or null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "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: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `allowed_domains: array of string`

                      A list of allowed domains when type is `allowlist`.

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                      Optional domain-scoped secrets for allowlisted domains.

                      - `domain: string`

                        The domain associated with the secret.

                      - `name: string`

                        The name of the secret to inject for the domain.

                      - `value: string`

                        The secret value to inject for the domain.

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                  An optional list of skills referenced by id or inline data.

                  - `BetaSkillReference object { skill_id, type, version }`

                    - `skill_id: string`

                      The ID of the referenced skill.

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version: optional string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill object { description, name, source, type }`

                    - `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.

                      - `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 object { type, skills }`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills: optional array of BetaLocalSkill`

                  An optional list of skills.

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `path: string`

                    The path to the directory containing the skill.

              - `BetaContainerReference object { container_id, type }`

                - `container_id: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools loaded inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                  The name of the loaded function tool.

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              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.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

          - `McpProtocolError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError object { content, type }`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

    - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

    - `string`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: array of 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 object { id, content, role, 4 more }`

      An output message from the model.

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional 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 or 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.

  - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" or "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 of map[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 object { type }`

      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" or "web_search_preview" or "computer" or 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 object { name, type }`

      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 object { server_label, type, name }`

      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: optional string or null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom object { name, type }`

      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 object { type }`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch object { type }`

      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 object { type }`

      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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

    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.

    - `Function object { name, parameters, strict, 6 more }`

      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: map[unknown] or null`

        A JSON schema object describing the parameters of the function.

      - `strict: boolean or null`

        Whether strict parameter validation is enforced for this function tool.

      - `type: "function"`

        The type of the function tool. Always `function`.

        - `"function"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

      - `defer_loading: optional boolean`

        Whether this function is deferred and loaded via tool search.

      - `description: optional string or null`

        A description of the function. Used by the model to determine whether or not to call the function.

      - `output_schema: optional map[unknown] or null`

        A JSON schema object describing the JSON value encoded in string outputs for this function.

    - `FileSearch object { type, vector_store_ids, filters, 2 more }`

      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 of string`

        The IDs of the vector stores to search.

      - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

        A filter to apply.

        - `ComparisonFilter object { key, type, value }`

          A filter used to compare a specified attribute key to a given value using a defined comparison operation.

          - `key: string`

            The key to compare against the value.

          - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

            The value to compare against the attribute key; supports string, number, or boolean types.

            - `string`

            - `number`

            - `boolean`

            - `array of string or number`

              - `string`

              - `number`

        - `BetaCompoundFilter = unknown`

          Combine multiple filters using `and` or `or`.

      - `max_num_results: optional number`

        The maximum number of results to return. This number should be between 1 and 50 inclusive.

      - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

        Ranking options for search.

        - `hybrid_search: optional object { embedding_weight, text_weight }`

          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: optional "auto" or "default-2024-11-15"`

          The ranker to use for the file search.

          - `"auto"`

          - `"default-2024-11-15"`

        - `score_threshold: optional 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.

    - `Computer object { type }`

      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"`

    - `ComputerUsePreview object { display_height, display_width, environment, type }`

      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" or "mac" or "linux" or 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"`

    - `WebSearch object { type, external_web_access, filters, 2 more }`

      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" or "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: optional 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: optional object { allowed_domains }  or null`

        Filters for the search.

        - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `type: optional "approximate"`

          The type of location approximation. Always `approximate`.

          - `"approximate"`

    - `Mcp object { server_label, type, allowed_callers, 9 more }`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

        List of allowed tool names or a filter object.

        - `McpAllowedTools = array of string`

          A string array of allowed tool names

        - `McpToolFilter object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

        Whether this MCP tool is deferred and discovered via tool search.

      - `headers: optional map[string] or null`

        Optional HTTP headers to send to the MCP server. Use for authentication
        or other purposes.

      - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

        Specify which of the MCP server's tools require approval.

        - `McpToolApprovalFilter object { always, never }`

          Specify which of the MCP server's tools require approval. Can be
          `always`, `never`, or a filter object associated with tools
          that require approval.

          - `always: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

          - `never: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `McpToolApprovalSetting = "always" or "never"`

          Specify a single approval policy for all tools. One of `always` or
          `never`. When set to `always`, all tools will require approval. When
          set to `never`, all tools will not require approval.

          - `"always"`

          - `"never"`

      - `server_description: optional string`

        Optional description of the MCP server, used to provide more context.

      - `server_url: optional string`

        The URL for the MCP server. One of `server_url`, `connector_id`, or
        `tunnel_id` must be provided.

      - `tunnel_id: optional 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 object { container, type, allowed_callers }`

      A tool that runs Python code to help generate a response to a prompt.

      - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

        The code interpreter container. Can be a container ID or an object that
        specifies uploaded file IDs to make available to your code, along with an
        optional `memory_limit` setting.

        - `string`

          The container ID.

        - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

          Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

          - `type: "auto"`

            Always `auto`.

            - `"auto"`

          - `file_ids: optional array of string`

            An optional list of uploaded files to make available to your code.

          - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

            The memory limit for the code interpreter container.

            - `"1g"`

            - `"4g"`

            - `"16g"`

            - `"64g"`

          - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

            Network access policy for the container.

            - `BetaContainerNetworkPolicyDisabled object { type }`

            - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

      - `type: "code_interpreter"`

        The type of the code interpreter tool. Always `code_interpreter`.

        - `"code_interpreter"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

    - `ProgrammaticToolCalling object { type }`

      - `type: "programmatic_tool_calling"`

        The type of the tool. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `ImageGeneration object { type, action, background, 9 more }`

      A tool that generates images using the GPT image models.

      - `type: "image_generation"`

        The type of the image generation tool. Always `image_generation`.

        - `"image_generation"`

      - `action: optional "generate" or "edit" or "auto"`

        Whether to generate a new image or edit an existing image. Default: `auto`.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `background: optional "transparent" or "opaque" or "auto"`

        Set the background of the generated image. One of `transparent`, `opaque`,
        or `auto`. `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`.
        Default: `auto`.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

        Optional mask for inpainting. Contains `image_url`
        (string, optional) and `file_id` (string, optional).

        - `file_id: optional string`

          File ID for the mask image.

        - `image_url: optional string`

          Base64-encoded mask image.

      - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `string`

        - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `"gpt-image-1"`

          - `"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"`

      - `moderation: optional "auto" or "low"`

        Moderation level for the generated image. Default: `auto`.

        - `"auto"`

        - `"low"`

      - `output_compression: optional number`

        Compression level for the output image. Default: 100.

      - `output_format: optional "png" or "webp" or "jpeg"`

        The output format of the generated image. One of `png`, `webp`, or
        `jpeg`. Default: `png`.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `partial_images: optional number`

        Number of partial images to generate in streaming mode, from 0 (default value) to 3.

      - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

          - `"auto"`

    - `LocalShell object { type }`

      A tool that allows the model to execute shell commands in a local environment.

      - `type: "local_shell"`

        The type of the local shell tool. Always `local_shell`.

        - `"local_shell"`

    - `Shell object { type, allowed_callers, environment }`

      A tool that allows the model to execute shell commands.

      - `type: "shell"`

        The type of the shell tool. Always `shell`.

        - `"shell"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

        - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

    - `Custom object { name, type, allowed_callers, 4 more }`

      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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this tool should be deferred and discovered via tool search.

      - `description: optional string`

        Optional description of the custom tool, used to provide more context.

      - `format: optional Text { type }  or Grammar { definition, syntax, type }`

        The input format for the custom tool. Default is unconstrained text.

        - `Text object { type }`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar object { definition, syntax, type }`

          A grammar defined by the user.

          - `definition: string`

            The grammar definition.

          - `syntax: "lark" or "regex"`

            The syntax of the grammar definition. One of `lark` or `regex`.

            - `"lark"`

            - `"regex"`

          - `type: "grammar"`

            Grammar format. Always `grammar`.

            - `"grammar"`

    - `Namespace object { description, name, tools, type }`

      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`).

      - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

        The function/custom tools available inside this namespace.

        - `Function object { name, type, allowed_callers, 6 more }`

          - `name: string`

          - `type: "function"`

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this function should be deferred and discovered via tool search.

          - `description: optional string or null`

          - `output_schema: optional map[unknown] or null`

            A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

          - `parameters: optional unknown or null`

          - `strict: optional boolean or 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.

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "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"`

    - `ToolSearch object { type, description, execution, parameters }`

      Hosted or BYOT tool search configuration for deferred tools.

      - `type: "tool_search"`

        The type of the tool. Always `tool_search`.

        - `"tool_search"`

      - `description: optional string or null`

        Description shown to the model for a client-executed tool search tool.

      - `execution: optional "server" or "client"`

        Whether tool search is executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `parameters: optional unknown or null`

        Parameter schema for a client-executed tool search tool.

    - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `type: "web_search_preview" or "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: optional array of "text" or "image"`

        - `"text"`

        - `"image"`

      - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

    - `ApplyPatch object { type, allowed_callers }`

      Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "apply_patch"`

        The type of the tool. Always `apply_patch`.

        - `"apply_patch"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

  - `top_p: number or 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.

  - `background: optional boolean or null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at: optional number or null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

  - `conversation: optional object { id }  or 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.

  - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response input.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response output.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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_text: optional string or null`

    SDK-only convenience property that contains the aggregated text output
    from all `output_text` items in the `output` array, if any are present.
    Supported in the Python and JavaScript SDKs.

  - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

    - `version: optional string or null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit object { type }`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound object { type }`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable object { type }`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" or "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

    - `comparison_response_id: optional string or null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `string`

      - `"standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `"standard"`

        - `"pro"`

    - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

  - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

        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: map[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: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `strict: optional boolean or 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 object { type }`

        JSON object response format. An older method of generating JSON responses.
        Using `json_schema` is recommended for models that support it. Note that the
        model will not generate JSON without a system or user message instructing it
        to do so.

        - `type: "json_object"`

          The type of response format being defined. Always `json_object`.

          - `"json_object"`

    - `verbosity: optional "low" or "medium" or "high" or 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"`

  - `top_logprobs: optional number or 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.

  - `truncation: optional "auto" or "disabled" or 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.
    - `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: optional BetaResponseUsage or null`

    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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      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: optional string or null`

    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

```http
curl https://api.openai.com/v1/responses/$RESPONSE_ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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,
    "context": null
  },
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "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": {},
  "conversation": {
    "id": "id"
  },
  "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",
  "prompt_cache_diagnostics": {
    "cache_missed_tokens": 0,
    "reason": "model_changed",
    "type": "cache_miss",
    "comparison_reusable_tokens": 0
  },
  "prompt_cache_options": {
    "mode": "implicit",
    "ttl": "30m",
    "comparison_response_id": "comparison_response_id"
  },
  "service_tier": "auto"
}
```

### Example

```http
curl https://api.openai.com/v1/responses/resp_123 \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```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 Compacted Response

- `BetaCompactedResponse object { id, created_at, object, 2 more }`

  - `id: string`

    The unique identifier for the compacted response.

  - `created_at: number`

    Unix timestamp (in seconds) when the compacted conversation was created.

  - `object: "response.compaction"`

    The object type. Always `response.compaction`.

    - `"response.compaction"`

  - `output: array of Message { id, content, role, 4 more }  or Program { id, call_id, code, 3 more }  or ProgramOutput { id, call_id, result, 3 more }  or 28 more`

    The compacted list of output items.

    - `Message object { id, content, role, 4 more }`

      A message to or from the model.

      - `id: string`

        The unique ID of the message.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        The content of the message

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

          - `text: string`

            The text input to the model.

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

          - `refusal: string`

            The refusal explanation from the model.

          - `type: "refusal"`

            The type of the refusal. Always `refusal`.

            - `"refusal"`

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          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: optional string or null`

            The ID of the file to be sent to the model.

          - `image_url: optional string or null`

            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"input_file"`

          - `detail: optional "auto" or "low" or "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: optional string`

            The content of the file to be sent to the model.

          - `file_id: optional string or null`

            The ID of the file to be sent to the model.

          - `file_url: optional string`

            The URL of the file to be sent to the model.

          - `filename: optional string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `status: "in_progress" or "completed" or "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. Always set to `message`.

        - `"message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCallOutput object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"function_call_output"`

      - `id: optional string`

        The unique ID of the function tool call output. Populated when this item
        is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

  - `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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      A detailed breakdown of the output tokens.

      - `reasoning_tokens: number`

        The number of reasoning tokens.

    - `total_tokens: number`

      The total number of tokens used.

### Beta Computer Action

- `BetaComputerAction = Click { button, type, x, 2 more }  or DoubleClick { keys, type, x, y }  or Drag { path, type, keys }  or 6 more`

  A click action.

  - `Click object { button, type, x, 2 more }`

    A click action.

    - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

      The keys being held while clicking.

  - `DoubleClick object { keys, type, x, y }`

    A double click action.

    - `keys: array of string or 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 object { path, type, keys }`

    A drag action.

    - `path: array of object { x, y }`

      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: optional array of string or null`

      The keys being held while dragging the mouse.

  - `Keypress object { keys, type }`

    A collection of keypresses the model would like to perform.

    - `keys: array of 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 object { type, x, y, keys }`

    A mouse move action.

    - `type: "move"`

      Specifies the event type. For a move action, this property is always set to `move`.

      - `"move"`

    - `x: number`

      The x-coordinate to move to.

    - `y: number`

      The y-coordinate to move to.

    - `keys: optional array of string or null`

      The keys being held while moving the mouse.

  - `Screenshot object { type }`

    A screenshot action.

    - `type: "screenshot"`

      Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

      - `"screenshot"`

  - `Scroll object { scroll_x, scroll_y, type, 3 more }`

    A scroll action.

    - `scroll_x: number`

      The horizontal scroll distance.

    - `scroll_y: number`

      The vertical scroll distance.

    - `type: "scroll"`

      Specifies the event type. For a scroll action, this property is always set to `scroll`.

      - `"scroll"`

    - `x: number`

      The x-coordinate where the scroll occurred.

    - `y: number`

      The y-coordinate where the scroll occurred.

    - `keys: optional array of string or null`

      The keys being held while scrolling.

  - `Type object { text, type }`

    An action to type in text.

    - `text: string`

      The text to type.

    - `type: "type"`

      Specifies the event type. For a type action, this property is always set to `type`.

      - `"type"`

  - `Wait object { type }`

    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 of BetaComputerAction`

  Flattened batched actions for `computer_use`. Each action includes an
  `type` discriminator and action-specific fields.

  - `Click object { button, type, x, 2 more }`

    A click action.

    - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

      The keys being held while clicking.

  - `DoubleClick object { keys, type, x, y }`

    A double click action.

    - `keys: array of string or 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 object { path, type, keys }`

    A drag action.

    - `path: array of object { x, y }`

      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: optional array of string or null`

      The keys being held while dragging the mouse.

  - `Keypress object { keys, type }`

    A collection of keypresses the model would like to perform.

    - `keys: array of 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 object { type, x, y, keys }`

    A mouse move action.

    - `type: "move"`

      Specifies the event type. For a move action, this property is always set to `move`.

      - `"move"`

    - `x: number`

      The x-coordinate to move to.

    - `y: number`

      The y-coordinate to move to.

    - `keys: optional array of string or null`

      The keys being held while moving the mouse.

  - `Screenshot object { type }`

    A screenshot action.

    - `type: "screenshot"`

      Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

      - `"screenshot"`

  - `Scroll object { scroll_x, scroll_y, type, 3 more }`

    A scroll action.

    - `scroll_x: number`

      The horizontal scroll distance.

    - `scroll_y: number`

      The vertical scroll distance.

    - `type: "scroll"`

      Specifies the event type. For a scroll action, this property is always set to `scroll`.

      - `"scroll"`

    - `x: number`

      The x-coordinate where the scroll occurred.

    - `y: number`

      The y-coordinate where the scroll occurred.

    - `keys: optional array of string or null`

      The keys being held while scrolling.

  - `Type object { text, type }`

    An action to type in text.

    - `text: string`

      The text to type.

    - `type: "type"`

      Specifies the event type. For a type action, this property is always set to `type`.

      - `"type"`

  - `Wait object { type }`

    A wait action.

    - `type: "wait"`

      Specifies the event type. For a wait action, this property is always set to `wait`.

      - `"wait"`

### Beta Container Auto

- `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

  - `type: "container_auto"`

    Automatically creates a container for this request

    - `"container_auto"`

  - `file_ids: optional array of string`

    An optional list of uploaded files to make available to your code.

  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

    The memory limit for the container.

    - `"1g"`

    - `"4g"`

    - `"16g"`

    - `"64g"`

  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

    Network access policy for the container.

    - `BetaContainerNetworkPolicyDisabled object { type }`

      - `type: "disabled"`

        Disable outbound network access. Always `disabled`.

        - `"disabled"`

    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

      - `allowed_domains: array of string`

        A list of allowed domains when type is `allowlist`.

      - `type: "allowlist"`

        Allow outbound network access only to specified domains. Always `allowlist`.

        - `"allowlist"`

      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

        Optional domain-scoped secrets for allowlisted domains.

        - `domain: string`

          The domain associated with the secret.

        - `name: string`

          The name of the secret to inject for the domain.

        - `value: string`

          The secret value to inject for the domain.

  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

    An optional list of skills referenced by id or inline data.

    - `BetaSkillReference object { skill_id, type, version }`

      - `skill_id: string`

        The ID of the referenced skill.

      - `type: "skill_reference"`

        References a skill created with the /v1/skills endpoint.

        - `"skill_reference"`

      - `version: optional string`

        Optional skill version. Use a positive integer or 'latest'. Omit for default.

    - `BetaInlineSkill object { description, name, source, type }`

      - `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.

        - `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 object { allowed_domains, type, domain_secrets }`

  - `allowed_domains: array of string`

    A list of allowed domains when type is `allowlist`.

  - `type: "allowlist"`

    Allow outbound network access only to specified domains. Always `allowlist`.

    - `"allowlist"`

  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

    Optional domain-scoped secrets for allowlisted domains.

    - `domain: string`

      The domain associated with the secret.

    - `name: string`

      The name of the secret to inject for the domain.

    - `value: string`

      The secret value to inject for the domain.

### Beta Container Network Policy Disabled

- `BetaContainerNetworkPolicyDisabled object { type }`

  - `type: "disabled"`

    Disable outbound network access. Always `disabled`.

    - `"disabled"`

### Beta Container Network Policy Domain Secret

- `BetaContainerNetworkPolicyDomainSecret object { domain, name, value }`

  - `domain: string`

    The domain associated with the secret.

  - `name: string`

    The name of the secret to inject for the domain.

  - `value: string`

    The secret value to inject for the domain.

### Beta Container Reference

- `BetaContainerReference object { container_id, type }`

  - `container_id: string`

    The ID of the referenced container.

  - `type: "container_reference"`

    References a container created with the /v1/containers endpoint

    - `"container_reference"`

### Beta Easy Input Message

- `BetaEasyInputMessage object { content, role, phase, type }`

  A message input to the model with a role indicating instruction following
  hierarchy. Instructions given with the `developer` or `system` role take
  precedence over instructions given with the `user` role. Messages with the
  `assistant` role are presumed to have been generated by the model in previous
  interactions.

  - `content: string or BetaResponseInputMessageContentList`

    Text, image, or audio input to the model, used to generate a response.
    Can also contain previous assistant responses.

    - `TextInput = string`

      A text input to the model.

    - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

      A list of one or many input items to the model, containing different content
      types.

      - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

        - `text: string`

          The text input to the model.

        - `type: "input_text"`

          The type of the input item. Always `input_text`.

          - `"input_text"`

        - `prompt_cache_breakpoint: optional object { mode }`

          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        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: optional string or null`

          The ID of the file to be sent to the model.

        - `image_url: optional string or null`

          The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

        - `prompt_cache_breakpoint: optional object { mode }`

          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

        - `type: "input_file"`

          The type of the input item. Always `input_file`.

          - `"input_file"`

        - `detail: optional "auto" or "low" or "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: optional string`

          The content of the file to be sent to the model.

        - `file_id: optional string or null`

          The ID of the file to be sent to the model.

        - `file_url: optional string`

          The URL of the file to be sent to the model.

        - `filename: optional string`

          The name of the file to be sent to the model.

        - `prompt_cache_breakpoint: optional object { mode }`

          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

  - `role: "user" or "assistant" or "system" or "developer"`

    The role of the message input. One of `user`, `assistant`, `system`, or
    `developer`.

    - `"user"`

    - `"assistant"`

    - `"system"`

    - `"developer"`

  - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

    The type of the message input. Always `message`.

    - `"message"`

### Beta Image Detail

- `BetaImageDetail = "low" or "high" or "auto" or "original"`

  - `"low"`

  - `"high"`

  - `"auto"`

  - `"original"`

### Beta Inline Skill

- `BetaInlineSkill object { description, name, source, type }`

  - `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.

    - `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 object { data, media_type, type }`

  Inline skill payload

  - `data: string`

    Base64-encoded skill zip bundle.

  - `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 object { type, skills }`

  - `type: "local"`

    Use a local computer environment.

    - `"local"`

  - `skills: optional array of BetaLocalSkill`

    An optional list of skills.

    - `description: string`

      The description of the skill.

    - `name: string`

      The name of the skill.

    - `path: string`

      The path to the directory containing the skill.

### Beta Local Skill

- `BetaLocalSkill object { description, name, path }`

  - `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 { code, message, type }  or McpToolExecutionError { content, type }  or HTTPError { code, message, type }`

  - `McpProtocolError object { code, message, type }`

    - `code: number`

    - `message: string`

    - `type: "mcp_protocol_error"`

      - `"mcp_protocol_error"`

  - `McpToolExecutionError object { content, type }`

    - `content: unknown`

    - `type: "mcp_tool_execution_error"`

      - `"mcp_tool_execution_error"`

  - `HTTPError object { code, message, type }`

    - `code: number`

    - `message: string`

    - `type: "http_error"`

      - `"http_error"`

### Beta Response

- `BetaResponse object { id, access_programs, created_at, 34 more }`

  - `id: string`

    Unique identifier for this Response.

  - `access_programs: object { cyber }  or null`

    - `cyber: "standard" or "daybreak_blue" or "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.

  - `error: BetaResponseError or null`

    An error object returned when the model fails to generate a Response.

    - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

      - `detailed_explanation: optional string`

        The public explanation for this block.

      - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

        An optional classification; clients must accept additional values.

        - `string`

        - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `"potentially_unintended_data_transfer"`

          - `"potentially_unintended_data_access"`

          - `"potentially_unintended_destructive_activity"`

          - `"other"`

      - `review_target: optional string or null`

        An opaque target for explicitly continuing this review, or null when unavailable.

      - `steer: optional object { message }`

        An optional public continuation instruction.

        - `message: string`

          The public continuation instruction.

    - `param: optional string or null`

      The request parameter associated with the error, or null if none was recorded.

    - `type: optional string or null`

      The original error type, or null if it was not recorded.

  - `incomplete_details: object { reason }  or null`

    Details about why the response is incomplete.

    - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

      A text input to the model, equivalent to a text input with the
      `developer` role.

    - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      A list of one or many input items to the model, containing
      different content types.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

        - `content: string or BetaResponseInputMessageContentList`

          Text, image, or audio input to the model, used to generate a response.
          Can also contain previous assistant responses.

          - `TextInput = string`

            A text input to the model.

          - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string`

                The content of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string`

                The URL of the file to be sent to the model.

              - `filename: optional string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

        - `role: "user" or "assistant" or "system" or "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

          The content of the output message.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

              - `FileCitation object { file_id, filename, index, type }`

                A citation to a file.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index 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 object { end_index, start_index, title, 2 more }`

                A citation for a web resource used to generate a model response.

                - `end_index: number`

                  The index of the last character of the URL citation in the message.

                - `start_index: number`

                  The index of the first character of the URL citation in the message.

                - `title: string`

                  The title of the web resource.

                - `type: "url_citation"`

                  The type of the URL citation. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the web resource.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                A citation for a container file used to generate a model response.

                - `container_id: string`

                  The ID of the container file.

                - `end_index: number`

                  The index of the last character of the container file citation in the message.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the container file citation in the message.

                - `type: "container_file_citation"`

                  The type of the container file citation. Always `container_file_citation`.

                  - `"container_file_citation"`

              - `FilePath object { file_id, index, type }`

                A path to a file.

                - `file_id: string`

                  The ID of the file.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_path"`

                  The type of the file path. Always `file_path`.

                  - `"file_path"`

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

              - `top_logprobs: array of object { token, bytes, logprob }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `phase: optional "commentary" or "final_answer" or 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"`

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

          - `Click object { button, type, x, 2 more }`

            A click action.

            - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

              The keys being held while clicking.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

            - `keys: array of string or 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 object { path, type, keys }`

            A drag action.

            - `path: array of object { x, y }`

              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: optional array of string or null`

              The keys being held while dragging the mouse.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

            - `keys: array of 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 object { type, x, y, keys }`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"move"`

            - `x: number`

              The x-coordinate to move to.

            - `y: number`

              The y-coordinate to move to.

            - `keys: optional array of string or null`

              The keys being held while moving the mouse.

          - `Screenshot object { type }`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

            - `scroll_x: number`

              The horizontal scroll distance.

            - `scroll_y: number`

              The vertical scroll distance.

            - `type: "scroll"`

              Specifies the event type. For a scroll action, this property is always set to `scroll`.

              - `"scroll"`

            - `x: number`

              The x-coordinate where the scroll occurred.

            - `y: number`

              The y-coordinate where the scroll occurred.

            - `keys: optional array of string or null`

              The keys being held while scrolling.

          - `Type object { text, type }`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait object { type }`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click object { button, type, x, 2 more }`

            A click action.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

          - `Drag object { path, type, keys }`

            A drag action.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

          - `Move object { type, x, y, keys }`

            A mouse move action.

          - `Screenshot object { type }`

            A screenshot action.

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

          - `Type object { text, type }`

            An action to type in text.

          - `Wait object { type }`

            A wait action.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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: optional string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: optional string`

            The URL of the screenshot image.

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              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: optional BetaImageDetail or 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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string or null`

                The base64-encoded data of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string or null`

                The URL of the file to be sent to the model.

              - `filename: optional string or null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "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: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `allowed_domains: array of string`

                      A list of allowed domains when type is `allowlist`.

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                      Optional domain-scoped secrets for allowlisted domains.

                      - `domain: string`

                        The domain associated with the secret.

                      - `name: string`

                        The name of the secret to inject for the domain.

                      - `value: string`

                        The secret value to inject for the domain.

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                  An optional list of skills referenced by id or inline data.

                  - `BetaSkillReference object { skill_id, type, version }`

                    - `skill_id: string`

                      The ID of the referenced skill.

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version: optional string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill object { description, name, source, type }`

                    - `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.

                      - `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 object { type, skills }`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills: optional array of BetaLocalSkill`

                  An optional list of skills.

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `path: string`

                    The path to the directory containing the skill.

              - `BetaContainerReference object { container_id, type }`

                - `container_id: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools loaded inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                  The name of the loaded function tool.

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              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.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

          - `McpProtocolError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError object { content, type }`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

  - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

    - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

    - `string`

  - `object: "response"`

    The object type of this resource - always set to `response`.

    - `"response"`

  - `output: array of 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 object { id, content, role, 4 more }`

      An output message from the model.

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional 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 or 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.

  - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

      Constrains the tools available to the model to a pre-defined set.

      - `mode: "auto" or "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 of map[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 object { type }`

      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" or "web_search_preview" or "computer" or 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 object { name, type }`

      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 object { server_label, type, name }`

      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: optional string or null`

        The name of the tool to call on the server.

    - `BetaToolChoiceCustom object { name, type }`

      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 object { type }`

      - `type: "programmatic_tool_calling"`

        The tool to call. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `BetaToolChoiceApplyPatch object { type }`

      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 object { type }`

      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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

    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.

    - `Function object { name, parameters, strict, 6 more }`

      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: map[unknown] or null`

        A JSON schema object describing the parameters of the function.

      - `strict: boolean or null`

        Whether strict parameter validation is enforced for this function tool.

      - `type: "function"`

        The type of the function tool. Always `function`.

        - `"function"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

      - `defer_loading: optional boolean`

        Whether this function is deferred and loaded via tool search.

      - `description: optional string or null`

        A description of the function. Used by the model to determine whether or not to call the function.

      - `output_schema: optional map[unknown] or null`

        A JSON schema object describing the JSON value encoded in string outputs for this function.

    - `FileSearch object { type, vector_store_ids, filters, 2 more }`

      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 of string`

        The IDs of the vector stores to search.

      - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

        A filter to apply.

        - `ComparisonFilter object { key, type, value }`

          A filter used to compare a specified attribute key to a given value using a defined comparison operation.

          - `key: string`

            The key to compare against the value.

          - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

            The value to compare against the attribute key; supports string, number, or boolean types.

            - `string`

            - `number`

            - `boolean`

            - `array of string or number`

              - `string`

              - `number`

        - `BetaCompoundFilter = unknown`

          Combine multiple filters using `and` or `or`.

      - `max_num_results: optional number`

        The maximum number of results to return. This number should be between 1 and 50 inclusive.

      - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

        Ranking options for search.

        - `hybrid_search: optional object { embedding_weight, text_weight }`

          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: optional "auto" or "default-2024-11-15"`

          The ranker to use for the file search.

          - `"auto"`

          - `"default-2024-11-15"`

        - `score_threshold: optional 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.

    - `Computer object { type }`

      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"`

    - `ComputerUsePreview object { display_height, display_width, environment, type }`

      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" or "mac" or "linux" or 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"`

    - `WebSearch object { type, external_web_access, filters, 2 more }`

      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" or "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: optional 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: optional object { allowed_domains }  or null`

        Filters for the search.

        - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `type: optional "approximate"`

          The type of location approximation. Always `approximate`.

          - `"approximate"`

    - `Mcp object { server_label, type, allowed_callers, 9 more }`

      Give the model access to additional tools via remote Model Context Protocol
      (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

        List of allowed tool names or a filter object.

        - `McpAllowedTools = array of string`

          A string array of allowed tool names

        - `McpToolFilter object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

        Whether this MCP tool is deferred and discovered via tool search.

      - `headers: optional map[string] or null`

        Optional HTTP headers to send to the MCP server. Use for authentication
        or other purposes.

      - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

        Specify which of the MCP server's tools require approval.

        - `McpToolApprovalFilter object { always, never }`

          Specify which of the MCP server's tools require approval. Can be
          `always`, `never`, or a filter object associated with tools
          that require approval.

          - `always: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

          - `never: optional object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `McpToolApprovalSetting = "always" or "never"`

          Specify a single approval policy for all tools. One of `always` or
          `never`. When set to `always`, all tools will require approval. When
          set to `never`, all tools will not require approval.

          - `"always"`

          - `"never"`

      - `server_description: optional string`

        Optional description of the MCP server, used to provide more context.

      - `server_url: optional string`

        The URL for the MCP server. One of `server_url`, `connector_id`, or
        `tunnel_id` must be provided.

      - `tunnel_id: optional 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 object { container, type, allowed_callers }`

      A tool that runs Python code to help generate a response to a prompt.

      - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

        The code interpreter container. Can be a container ID or an object that
        specifies uploaded file IDs to make available to your code, along with an
        optional `memory_limit` setting.

        - `string`

          The container ID.

        - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

          Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

          - `type: "auto"`

            Always `auto`.

            - `"auto"`

          - `file_ids: optional array of string`

            An optional list of uploaded files to make available to your code.

          - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

            The memory limit for the code interpreter container.

            - `"1g"`

            - `"4g"`

            - `"16g"`

            - `"64g"`

          - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

            Network access policy for the container.

            - `BetaContainerNetworkPolicyDisabled object { type }`

            - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

      - `type: "code_interpreter"`

        The type of the code interpreter tool. Always `code_interpreter`.

        - `"code_interpreter"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

    - `ProgrammaticToolCalling object { type }`

      - `type: "programmatic_tool_calling"`

        The type of the tool. Always `programmatic_tool_calling`.

        - `"programmatic_tool_calling"`

    - `ImageGeneration object { type, action, background, 9 more }`

      A tool that generates images using the GPT image models.

      - `type: "image_generation"`

        The type of the image generation tool. Always `image_generation`.

        - `"image_generation"`

      - `action: optional "generate" or "edit" or "auto"`

        Whether to generate a new image or edit an existing image. Default: `auto`.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `background: optional "transparent" or "opaque" or "auto"`

        Set the background of the generated image. One of `transparent`, `opaque`,
        or `auto`. `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`.
        Default: `auto`.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

        Optional mask for inpainting. Contains `image_url`
        (string, optional) and `file_id` (string, optional).

        - `file_id: optional string`

          File ID for the mask image.

        - `image_url: optional string`

          Base64-encoded mask image.

      - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `string`

        - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `"gpt-image-1"`

          - `"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"`

      - `moderation: optional "auto" or "low"`

        Moderation level for the generated image. Default: `auto`.

        - `"auto"`

        - `"low"`

      - `output_compression: optional number`

        Compression level for the output image. Default: 100.

      - `output_format: optional "png" or "webp" or "jpeg"`

        The output format of the generated image. One of `png`, `webp`, or
        `jpeg`. Default: `png`.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `partial_images: optional number`

        Number of partial images to generate in streaming mode, from 0 (default value) to 3.

      - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

          - `"auto"`

    - `LocalShell object { type }`

      A tool that allows the model to execute shell commands in a local environment.

      - `type: "local_shell"`

        The type of the local shell tool. Always `local_shell`.

        - `"local_shell"`

    - `Shell object { type, allowed_callers, environment }`

      A tool that allows the model to execute shell commands.

      - `type: "shell"`

        The type of the shell tool. Always `shell`.

        - `"shell"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

        - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

    - `Custom object { name, type, allowed_callers, 4 more }`

      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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this tool should be deferred and discovered via tool search.

      - `description: optional string`

        Optional description of the custom tool, used to provide more context.

      - `format: optional Text { type }  or Grammar { definition, syntax, type }`

        The input format for the custom tool. Default is unconstrained text.

        - `Text object { type }`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar object { definition, syntax, type }`

          A grammar defined by the user.

          - `definition: string`

            The grammar definition.

          - `syntax: "lark" or "regex"`

            The syntax of the grammar definition. One of `lark` or `regex`.

            - `"lark"`

            - `"regex"`

          - `type: "grammar"`

            Grammar format. Always `grammar`.

            - `"grammar"`

    - `Namespace object { description, name, tools, type }`

      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`).

      - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

        The function/custom tools available inside this namespace.

        - `Function object { name, type, allowed_callers, 6 more }`

          - `name: string`

          - `type: "function"`

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this function should be deferred and discovered via tool search.

          - `description: optional string or null`

          - `output_schema: optional map[unknown] or null`

            A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

          - `parameters: optional unknown or null`

          - `strict: optional boolean or 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.

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "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"`

    - `ToolSearch object { type, description, execution, parameters }`

      Hosted or BYOT tool search configuration for deferred tools.

      - `type: "tool_search"`

        The type of the tool. Always `tool_search`.

        - `"tool_search"`

      - `description: optional string or null`

        Description shown to the model for a client-executed tool search tool.

      - `execution: optional "server" or "client"`

        Whether tool search is executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `parameters: optional unknown or null`

        Parameter schema for a client-executed tool search tool.

    - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

      This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

      - `type: "web_search_preview" or "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: optional array of "text" or "image"`

        - `"text"`

        - `"image"`

      - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

          Free text input for the city of the user, e.g. `San Francisco`.

        - `country: optional string or null`

          The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

        - `region: optional string or null`

          Free text input for the region of the user, e.g. `California`.

        - `timezone: optional string or null`

          The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

    - `ApplyPatch object { type, allowed_callers }`

      Allows the assistant to create, delete, or update files using unified diffs.

      - `type: "apply_patch"`

        The type of the tool. Always `apply_patch`.

        - `"apply_patch"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

  - `top_p: number or 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.

  - `background: optional boolean or null`

    Whether to run the model response in the background.
    [Learn more](/api/docs/guides/background).

  - `completed_at: optional number or null`

    Unix timestamp (in seconds) of when this Response was completed.
    Only present when the status is `completed`.

  - `conversation: optional object { id }  or 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.

  - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

    Moderation results for the response input and output, if moderated completions were requested.

    - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response input.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

      Moderation for the response output.

      - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

        A moderation result produced for the response input or output.

        - `categories: map[boolean]`

          A dictionary of moderation categories to booleans, True if the input is flagged under this category.

        - `category_applied_input_types: map[array of "text" or "image"]`

          Which modalities of input are reflected by the score for each category.

          - `"text"`

          - `"image"`

        - `category_scores: map[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 object { code, message, type }`

        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_text: optional string or null`

    SDK-only convenience property that contains the aggregated text output
    from all `output_text` items in the `output` array, if any are present.
    Supported in the Python and JavaScript SDKs.

  - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

    - `version: optional string or null`

      Optional version of the prompt template.

  - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

    Prompt cache diagnostics requested for this response.

    - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

      - `cache_missed_tokens: number`

        The estimated number of input tokens affected after the first detected divergence.

      - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

        The raw token count of the reusable prefix in the compared response.

    - `CacheHit object { type }`

      - `type: "cache_hit"`

        - `"cache_hit"`

    - `ComparisonResponseNotFound object { type }`

      - `type: "comparison_response_not_found"`

        - `"comparison_response_not_found"`

    - `Unavailable object { type }`

      - `type: "unavailable"`

        - `"unavailable"`

  - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

    The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

    - `mode: "implicit" or "explicit"`

      Whether implicit prompt-cache breakpoints were enabled.

      - `"implicit"`

      - `"explicit"`

    - `ttl: "30m"`

      The minimum lifetime applied to each cache breakpoint.

      - `"30m"`

    - `comparison_response_id: optional string or null`

      The response ID supplied as the prompt cache diagnostics comparison.

  - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

    Configuration options for
    [reasoning models](/api/docs/guides/reasoning).

    - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `string`

      - `"standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `"standard"`

        - `"pro"`

    - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

  - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

        Default response format. Used to generate text responses.

        - `type: "text"`

          The type of response format being defined. Always `text`.

          - `"text"`

      - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

        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: map[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: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `strict: optional boolean or 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 object { type }`

        JSON object response format. An older method of generating JSON responses.
        Using `json_schema` is recommended for models that support it. Note that the
        model will not generate JSON without a system or user message instructing it
        to do so.

        - `type: "json_object"`

          The type of response format being defined. Always `json_object`.

          - `"json_object"`

    - `verbosity: optional "low" or "medium" or "high" or 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"`

  - `top_logprobs: optional number or 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.

  - `truncation: optional "auto" or "disabled" or 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.
    - `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: optional BetaResponseUsage or null`

    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: object { cache_write_tokens, cached_tokens }`

      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).

    - `output_tokens: number`

      The number of output tokens.

    - `output_tokens_details: object { reasoning_tokens }`

      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: optional string or null`

    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 Audio Delta Event

- `BetaResponseAudioDeltaEvent object { delta, sequence_number, type, agent }`

  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: optional object { agent_name }  or 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 object { sequence_number, type, agent }`

  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: optional object { agent_name }  or 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 object { delta, sequence_number, type, agent }`

  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: optional object { agent_name }  or 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 object { sequence_number, type, agent }`

  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: optional object { agent_name }  or 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 object { delta, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { code, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 Compaction Compacting Event

- `BetaResponseCompactionCompactingEvent object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Completed Event

- `BetaResponseCompletedEvent object { response, sequence_number, type, agent }`

  Emitted when the model response is complete.

  - `response: BetaResponse`

    Properties of the completed response.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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: optional object { agent_name }  or 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 Output Screenshot

- `BetaResponseComputerToolCallOutputScreenshot object { type, file_id, image_url }`

  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: optional string`

    The identifier of an uploaded file that contains the screenshot.

  - `image_url: optional string`

    The URL of the screenshot image.

### Beta Response Container Reference

- `BetaResponseContainerReference object { container_id, type }`

  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 or BetaResponseInputImage or BetaResponseInputFile or 3 more`

  Multi-modal input and output contents.

  - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

    A text input to the model.

    - `text: string`

      The text input to the model.

    - `type: "input_text"`

      The type of the input item. Always `input_text`.

      - `"input_text"`

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

    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: optional string or null`

      The ID of the file to be sent to the model.

    - `image_url: optional string or null`

      The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"input_file"`

    - `detail: optional "auto" or "low" or "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: optional string`

      The content of the file to be sent to the model.

    - `file_id: optional string or null`

      The ID of the file to be sent to the model.

    - `file_url: optional string`

      The URL of the file to be sent to the model.

    - `filename: optional string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseOutputText object { annotations, logprobs, text, type }`

    A text output from the model.

    - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

      The annotations of the text output.

      - `FileCitation object { file_id, filename, index, type }`

        A citation to a file.

        - `file_id: string`

          The ID of the file.

        - `filename: string`

          The filename of the file cited.

        - `index: number`

          The index 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 object { end_index, start_index, title, 2 more }`

        A citation for a web resource used to generate a model response.

        - `end_index: number`

          The index of the last character of the URL citation in the message.

        - `start_index: number`

          The index of the first character of the URL citation in the message.

        - `title: string`

          The title of the web resource.

        - `type: "url_citation"`

          The type of the URL citation. Always `url_citation`.

          - `"url_citation"`

        - `url: string`

          The URL of the web resource.

      - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

        A citation for a container file used to generate a model response.

        - `container_id: string`

          The ID of the container file.

        - `end_index: number`

          The index of the last character of the container file citation in the message.

        - `file_id: string`

          The ID of the file.

        - `filename: string`

          The filename of the container file cited.

        - `start_index: number`

          The index of the first character of the container file citation in the message.

        - `type: "container_file_citation"`

          The type of the container file citation. Always `container_file_citation`.

          - `"container_file_citation"`

      - `FilePath object { file_id, index, type }`

        A path to a file.

        - `file_id: string`

          The ID of the file.

        - `index: number`

          The index of the file in the list of files.

        - `type: "file_path"`

          The type of the file path. Always `file_path`.

          - `"file_path"`

    - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

      - `token: string`

      - `bytes: array of number`

      - `logprob: number`

      - `top_logprobs: array of object { token, bytes, logprob }`

        - `token: string`

        - `bytes: array of number`

        - `logprob: number`

    - `text: string`

      The text output from the model.

    - `type: "output_text"`

      The type of the output text. Always `output_text`.

      - `"output_text"`

  - `BetaResponseOutputRefusal object { refusal, type }`

    A refusal from the model.

    - `refusal: string`

      The refusal explanation from the model.

    - `type: "refusal"`

      The type of the refusal. Always `refusal`.

      - `"refusal"`

  - `ReasoningText object { text, type }`

    Reasoning text from the model.

    - `text: string`

      The reasoning text from the model.

    - `type: "reasoning_text"`

      The type of the reasoning text. Always `reasoning_text`.

      - `"reasoning_text"`

### Beta Response Content Part Added Event

- `BetaResponseContentPartAddedEvent object { content_index, item_id, output_index, 4 more }`

  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 or BetaResponseOutputRefusal or ReasoningText { text, type }`

    The content part that was added.

    - `BetaResponseOutputText object { annotations, logprobs, text, type }`

      A text output from the model.

      - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

        The annotations of the text output.

        - `FileCitation object { file_id, filename, index, type }`

          A citation to a file.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the file cited.

          - `index: number`

            The index 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 object { end_index, start_index, title, 2 more }`

          A citation for a web resource used to generate a model response.

          - `end_index: number`

            The index of the last character of the URL citation in the message.

          - `start_index: number`

            The index of the first character of the URL citation in the message.

          - `title: string`

            The title of the web resource.

          - `type: "url_citation"`

            The type of the URL citation. Always `url_citation`.

            - `"url_citation"`

          - `url: string`

            The URL of the web resource.

        - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

          A citation for a container file used to generate a model response.

          - `container_id: string`

            The ID of the container file.

          - `end_index: number`

            The index of the last character of the container file citation in the message.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the container file cited.

          - `start_index: number`

            The index of the first character of the container file citation in the message.

          - `type: "container_file_citation"`

            The type of the container file citation. Always `container_file_citation`.

            - `"container_file_citation"`

        - `FilePath object { file_id, index, type }`

          A path to a file.

          - `file_id: string`

            The ID of the file.

          - `index: number`

            The index of the file in the list of files.

          - `type: "file_path"`

            The type of the file path. Always `file_path`.

            - `"file_path"`

      - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `token: string`

        - `bytes: array of number`

        - `logprob: number`

        - `top_logprobs: array of object { token, bytes, logprob }`

          - `token: string`

          - `bytes: array of number`

          - `logprob: number`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

        - `"output_text"`

    - `BetaResponseOutputRefusal object { refusal, type }`

      A refusal from the model.

      - `refusal: string`

        The refusal explanation from the model.

      - `type: "refusal"`

        The type of the refusal. Always `refusal`.

        - `"refusal"`

    - `ReasoningText object { text, type }`

      Reasoning text from the model.

      - `text: string`

        The reasoning text from the model.

      - `type: "reasoning_text"`

        The type of the reasoning text. Always `reasoning_text`.

        - `"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: optional object { agent_name }  or 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 object { content_index, item_id, output_index, 4 more }`

  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 or BetaResponseOutputRefusal or ReasoningText { text, type }`

    The content part that is done.

    - `BetaResponseOutputText object { annotations, logprobs, text, type }`

      A text output from the model.

      - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

        The annotations of the text output.

        - `FileCitation object { file_id, filename, index, type }`

          A citation to a file.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the file cited.

          - `index: number`

            The index 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 object { end_index, start_index, title, 2 more }`

          A citation for a web resource used to generate a model response.

          - `end_index: number`

            The index of the last character of the URL citation in the message.

          - `start_index: number`

            The index of the first character of the URL citation in the message.

          - `title: string`

            The title of the web resource.

          - `type: "url_citation"`

            The type of the URL citation. Always `url_citation`.

            - `"url_citation"`

          - `url: string`

            The URL of the web resource.

        - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

          A citation for a container file used to generate a model response.

          - `container_id: string`

            The ID of the container file.

          - `end_index: number`

            The index of the last character of the container file citation in the message.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the container file cited.

          - `start_index: number`

            The index of the first character of the container file citation in the message.

          - `type: "container_file_citation"`

            The type of the container file citation. Always `container_file_citation`.

            - `"container_file_citation"`

        - `FilePath object { file_id, index, type }`

          A path to a file.

          - `file_id: string`

            The ID of the file.

          - `index: number`

            The index of the file in the list of files.

          - `type: "file_path"`

            The type of the file path. Always `file_path`.

            - `"file_path"`

      - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `token: string`

        - `bytes: array of number`

        - `logprob: number`

        - `top_logprobs: array of object { token, bytes, logprob }`

          - `token: string`

          - `bytes: array of number`

          - `logprob: number`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

        - `"output_text"`

    - `BetaResponseOutputRefusal object { refusal, type }`

      A refusal from the model.

      - `refusal: string`

        The refusal explanation from the model.

      - `type: "refusal"`

        The type of the refusal. Always `refusal`.

        - `"refusal"`

    - `ReasoningText object { text, type }`

      Reasoning text from the model.

      - `text: string`

        The reasoning text from the model.

      - `type: "reasoning_text"`

        The type of the reasoning text. Always `reasoning_text`.

        - `"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: optional object { agent_name }  or 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 object { id }`

  The conversation that this response belongs to.

  - `id: string`

    The unique ID of the conversation.

### Beta Response Created Event

- `BetaResponseCreatedEvent object { response, sequence_number, type, agent }`

  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: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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: optional object { agent_name }  or 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 Delta Event

- `BetaResponseCustomToolCallInputDeltaEvent object { delta, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { input, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 Delete Response

- `BetaResponseDeleteResponse object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "response.deleted"`

    - `"response.deleted"`

### Beta Response Error

- `BetaResponseError object { code, message, misalignment, 2 more }`

  An error object returned when the model fails to generate a Response.

  - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

    - `detailed_explanation: optional string`

      The public explanation for this block.

    - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

      An optional classification; clients must accept additional values.

      - `string`

      - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

        An optional classification; clients must accept additional values.

        - `"potentially_unintended_data_transfer"`

        - `"potentially_unintended_data_access"`

        - `"potentially_unintended_destructive_activity"`

        - `"other"`

    - `review_target: optional string or null`

      An opaque target for explicitly continuing this review, or null when unavailable.

    - `steer: optional object { message }`

      An optional public continuation instruction.

      - `message: string`

        The public continuation instruction.

  - `param: optional string or null`

    The request parameter associated with the error, or null if none was recorded.

  - `type: optional string or null`

    The original error type, or null if it was not recorded.

### Beta Response Error Event

- `BetaResponseErrorEvent object { code, message, param, 3 more }`

  Emitted when an error occurs.

  - `code: string or null`

    The error code.

  - `message: string`

    The error message.

  - `param: string or null`

    The error parameter.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "error"`

    The type of the event. Always `error`.

    - `"error"`

  - `agent: optional object { agent_name }  or 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 object { response, sequence_number, type, agent }`

  An event that is emitted when a response fails.

  - `response: BetaResponse`

    The response that failed.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 Format Text Config

- `BetaResponseFormatTextConfig = Text { type }  or BetaResponseFormatTextJSONSchemaConfig or JSONObject { type }`

  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 object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

    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: map[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: optional string`

      A description of what the response format is for, used by the model to
      determine how to respond in the format.

    - `strict: optional boolean or 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 object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

### Beta Response Format Text JSON Schema Config

- `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

  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: map[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: optional string`

    A description of what the response format is for, used by the model to
    determine how to respond in the format.

  - `strict: optional boolean or 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 object { delta, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { arguments, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 Shell Call Output Content

- `BetaResponseFunctionShellCallOutputContent object { outcome, stderr, stdout }`

  Captured stdout and stderr for a portion of a shell tool call output.

  - `outcome: Timeout { type }  or Exit { exit_code, type }`

    The exit or timeout outcome associated with this shell call.

    - `Timeout object { type }`

      Indicates that the shell call exceeded its configured time limit.

      - `type: "timeout"`

        The outcome type. Always `timeout`.

        - `"timeout"`

    - `Exit object { exit_code, type }`

      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.

  - `stdout: string`

    Captured stdout output for the shell call.

### Beta Response Image Gen Call Completed Event

- `BetaResponseImageGenCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, partial_image_b64, 8 more }`

  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: optional object { agent_name }  or null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `background: optional string`

    The background setting that was used.

  - `output_format: optional string`

    The output format that was used.

  - `quality: optional string`

    The image quality that was used.

  - `size: optional string`

    The image size that was used.

### Beta Response In Progress Event

- `BetaResponseInProgressEvent object { response, sequence_number, type, agent }`

  Emitted when the response is in progress.

  - `response: BetaResponse`

    The response that is in progress.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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: optional object { agent_name }  or 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" or "web_search_call.results" or "web_search_call.action.sources" or 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 object { response, sequence_number, type, agent }`

  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: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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: optional object { agent_name }  or 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 object { response_id, sequence_number, type, stream_id }`

  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: optional 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 object { input, response_id, type }`

  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 of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

    Input items to inject into the active response.

    - `BetaEasyInputMessage object { content, role, phase, type }`

      A message input to the model with a role indicating instruction following
      hierarchy. Instructions given with the `developer` or `system` role take
      precedence over instructions given with the `user` role. Messages with the
      `assistant` role are presumed to have been generated by the model in previous
      interactions.

      - `content: string or BetaResponseInputMessageContentList`

        Text, image, or audio input to the model, used to generate a response.
        Can also contain previous assistant responses.

        - `TextInput = string`

          A text input to the model.

        - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `role: "user" or "assistant" or "system" or "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message object { content, role, agent, 2 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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" or "system" or "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: optional "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { call_id, output, type, 4 more }`

      The output of a computer tool call.

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id: optional string or null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "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: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id: optional string or null`

        The unique ID of this agent message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { action, arguments, call_id, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id: optional string or null`

        The unique ID of this multi-agent call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

          Citations associated with the text content.

          - `FileCitation object { file_id, filename, index, type }`

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation object { end_index, start_index, title, 2 more }`

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `start_index: number`

              The index of the first character of the citation in the message.

            - `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.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `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.

            - `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: optional string or null`

        The unique ID of this multi-agent call output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { arguments, type, id, 4 more }`

      - `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: optional string or null`

        The unique ID of this tool search call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ToolSearchOutput object { tools, type, id, 4 more }`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by the tool search output.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools loaded inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

                The name of the loaded function tool.

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id: optional string or null`

        The unique ID of this tool search output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools object { role, tools, type, 2 more }`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        A list of additional tools made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id: optional string or null`

        The unique ID of this additional tools item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { type, id, agent, reasoning }`

      An update to the conversation's response configuration. The configuration
      remains in effect for subsequent responses until it is replaced by another
      configuration update.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id: optional string or null`

        The unique ID of the configuration update item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        Updates to reasoning configuration. Only effort is supported.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { encrypted_content, type, id, agent }`

      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.

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id: optional string or null`

        The ID of the compaction item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { action, call_id, type, 5 more }`

      A tool representing a request to execute one or more shell commands.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

          Ordered shell commands for the execution environment to run.

        - `max_output_length: optional number or null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms: optional number or 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.

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id: optional string or null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput object { call_id, output, type, 5 more }`

      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.

      - `output: array of BetaResponseFunctionShellCallOutputContent`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          The exit or timeout outcome associated with this shell call.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            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.

        - `stdout: string`

          Captured stdout output for the shell call.

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id: optional string or null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length: optional number or null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall object { call_id, operation, status, 4 more }`

      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.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile object { diff, path, type }`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

          - `path: string`

            Path of the file to create relative to the workspace root.

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

          - `path: string`

            Path of the file to update relative to the workspace root.

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" or "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: optional string or null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

      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.

      - `status: "completed" or "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: optional string or null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output: optional string or null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

      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: optional string or null`

        The unique ID of the approval response

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CompactionTrigger object { type, id, agent }`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id: optional string or null`

        The unique ID of this compaction trigger.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference object { id, agent, type }`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type: optional "item_reference" or null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of this 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 item type. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent: optional object { agent_name }  or 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 object { error, input, response_id, 3 more }`

  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: object { code, message }`

    Information about why the input was not committed.

    - `code: "response_already_completed" or "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 of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

    The raw input items that were not committed.

    - `BetaEasyInputMessage object { content, role, phase, type }`

      A message input to the model with a role indicating instruction following
      hierarchy. Instructions given with the `developer` or `system` role take
      precedence over instructions given with the `user` role. Messages with the
      `assistant` role are presumed to have been generated by the model in previous
      interactions.

      - `content: string or BetaResponseInputMessageContentList`

        Text, image, or audio input to the model, used to generate a response.
        Can also contain previous assistant responses.

        - `TextInput = string`

          A text input to the model.

        - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `role: "user" or "assistant" or "system" or "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message object { content, role, agent, 2 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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" or "system" or "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: optional "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { call_id, output, type, 4 more }`

      The output of a computer tool call.

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id: optional string or null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "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: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id: optional string or null`

        The unique ID of this agent message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { action, arguments, call_id, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id: optional string or null`

        The unique ID of this multi-agent call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

          Citations associated with the text content.

          - `FileCitation object { file_id, filename, index, type }`

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation object { end_index, start_index, title, 2 more }`

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `start_index: number`

              The index of the first character of the citation in the message.

            - `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.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `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.

            - `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: optional string or null`

        The unique ID of this multi-agent call output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { arguments, type, id, 4 more }`

      - `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: optional string or null`

        The unique ID of this tool search call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ToolSearchOutput object { tools, type, id, 4 more }`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by the tool search output.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools loaded inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

                The name of the loaded function tool.

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id: optional string or null`

        The unique ID of this tool search output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools object { role, tools, type, 2 more }`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        A list of additional tools made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id: optional string or null`

        The unique ID of this additional tools item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { type, id, agent, reasoning }`

      An update to the conversation's response configuration. The configuration
      remains in effect for subsequent responses until it is replaced by another
      configuration update.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id: optional string or null`

        The unique ID of the configuration update item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        Updates to reasoning configuration. Only effort is supported.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { encrypted_content, type, id, agent }`

      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.

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id: optional string or null`

        The ID of the compaction item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { action, call_id, type, 5 more }`

      A tool representing a request to execute one or more shell commands.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

          Ordered shell commands for the execution environment to run.

        - `max_output_length: optional number or null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms: optional number or 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.

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id: optional string or null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput object { call_id, output, type, 5 more }`

      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.

      - `output: array of BetaResponseFunctionShellCallOutputContent`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          The exit or timeout outcome associated with this shell call.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            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.

        - `stdout: string`

          Captured stdout output for the shell call.

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id: optional string or null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length: optional number or null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall object { call_id, operation, status, 4 more }`

      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.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile object { diff, path, type }`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

          - `path: string`

            Path of the file to create relative to the workspace root.

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

          - `path: string`

            Path of the file to update relative to the workspace root.

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" or "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: optional string or null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

      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.

      - `status: "completed" or "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: optional string or null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output: optional string or null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

      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: optional string or null`

        The unique ID of the approval response

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CompactionTrigger object { type, id, agent }`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id: optional string or null`

        The unique ID of this compaction trigger.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference object { id, agent, type }`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type: optional "item_reference" or null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of this 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 item type. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent: optional object { agent_name }  or 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: optional string`

    The multiplexed WebSocket stream that emitted the event. This field is
    present only when WebSocket multiplexing is enabled separately.

### Beta Response Input Audio

- `BetaResponseInputAudio object { input_audio, type }`

  An audio input to the model.

  - `input_audio: object { data, format }`

    - `data: string`

      Base64-encoded audio data.

    - `format: "mp3" or "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 or BetaResponseInputImage or BetaResponseInputFile`

  A text input to the model.

  - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

    A text input to the model.

    - `text: string`

      The text input to the model.

    - `type: "input_text"`

      The type of the input item. Always `input_text`.

      - `"input_text"`

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

    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: optional string or null`

      The ID of the file to be sent to the model.

    - `image_url: optional string or null`

      The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"input_file"`

    - `detail: optional "auto" or "low" or "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: optional string`

      The content of the file to be sent to the model.

    - `file_id: optional string or null`

      The ID of the file to be sent to the model.

    - `file_url: optional string`

      The URL of the file to be sent to the model.

    - `filename: optional string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

### Beta Response Input File

- `BetaResponseInputFile object { type, detail, file_data, 4 more }`

  A file input to the model.

  - `type: "input_file"`

    The type of the input item. Always `input_file`.

    - `"input_file"`

  - `detail: optional "auto" or "low" or "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: optional string`

    The content of the file to be sent to the model.

  - `file_id: optional string or null`

    The ID of the file to be sent to the model.

  - `file_url: optional string`

    The URL of the file to be sent to the model.

  - `filename: optional string`

    The name of the file to be sent to the model.

  - `prompt_cache_breakpoint: optional object { mode }`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

### Beta Response Input File Content

- `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

  A file input to the model.

  - `type: "input_file"`

    The type of the input item. Always `input_file`.

    - `"input_file"`

  - `detail: optional "auto" or "low" or "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: optional string or null`

    The base64-encoded data of the file to be sent to the model.

  - `file_id: optional string or null`

    The ID of the file to be sent to the model.

  - `file_url: optional string or null`

    The URL of the file to be sent to the model.

  - `filename: optional string or null`

    The name of the file to be sent to the model.

  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl: optional "30m" or "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Image

- `BetaResponseInputImage object { detail, type, file_id, 2 more }`

  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: optional string or null`

    The ID of the file to be sent to the model.

  - `image_url: optional string or null`

    The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

  - `prompt_cache_breakpoint: optional object { mode }`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

### Beta Response Input Image Content

- `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

  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: optional BetaImageDetail or 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: optional string or null`

    The ID of the file to be sent to the model.

  - `image_url: optional string or null`

    The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl: optional "30m" or "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Input Message Content List

- `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

  A list of one or many input items to the model, containing different content
  types.

  - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

    A text input to the model.

    - `text: string`

      The text input to the model.

    - `type: "input_text"`

      The type of the input item. Always `input_text`.

      - `"input_text"`

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

    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: optional string or null`

      The ID of the file to be sent to the model.

    - `image_url: optional string or null`

      The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

  - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

    A file input to the model.

    - `type: "input_file"`

      The type of the input item. Always `input_file`.

      - `"input_file"`

    - `detail: optional "auto" or "low" or "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: optional string`

      The content of the file to be sent to the model.

    - `file_id: optional string or null`

      The ID of the file to be sent to the model.

    - `file_url: optional string`

      The URL of the file to be sent to the model.

    - `filename: optional string`

      The name of the file to be sent to the model.

    - `prompt_cache_breakpoint: optional object { mode }`

      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

      - `mode: "explicit"`

        The breakpoint mode. Always `explicit`.

        - `"explicit"`

### Beta Response Input Message Item

- `BetaResponseInputMessageItem object { id, content, role, 3 more }`

  - `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 object { text, type, prompt_cache_breakpoint }`

      A text input to the model.

      - `text: string`

        The text input to the model.

      - `type: "input_text"`

        The type of the input item. Always `input_text`.

        - `"input_text"`

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

    - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

      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: optional string or null`

        The ID of the file to be sent to the model.

      - `image_url: optional string or null`

        The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

    - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

      A file input to the model.

      - `type: "input_file"`

        The type of the input item. Always `input_file`.

        - `"input_file"`

      - `detail: optional "auto" or "low" or "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: optional string`

        The content of the file to be sent to the model.

      - `file_id: optional string or null`

        The ID of the file to be sent to the model.

      - `file_url: optional string`

        The URL of the file to be sent to the model.

      - `filename: optional string`

        The name of the file to be sent to the model.

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

  - `role: "user" or "system" or "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: optional object { agent_name }  or null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `status: optional "in_progress" or "completed" or "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 object { text, type, prompt_cache_breakpoint }`

  A text input to the model.

  - `text: string`

    The text input to the model.

  - `type: "input_text"`

    The type of the input item. Always `input_text`.

    - `"input_text"`

  - `prompt_cache_breakpoint: optional object { mode }`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

### Beta Response Input Text Content

- `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

  A text input to the model.

  - `text: string`

    The text input to the model.

  - `type: "input_text"`

    The type of the input item. Always `input_text`.

    - `"input_text"`

  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

    - `mode: "explicit"`

      The breakpoint mode. Always `explicit`.

      - `"explicit"`

    - `ttl: optional "30m" or "12h"`

      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

      - `"30m"`

      - `"12h"`

### Beta Response Local Environment

- `BetaResponseLocalEnvironment object { type }`

  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 object { delta, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { arguments, item_id, output_index, 3 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { item_id, output_index, sequence_number, 2 more }`

  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: optional object { agent_name }  or 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 object { data, transcript, type }`

  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 or FileSearchCall { id, queries, status, 3 more }  or FunctionCall { arguments, call_id, name, 7 more }  or 28 more`

  An output message from the model.

  - `BetaResponseOutputMessage object { id, content, role, 4 more }`

    An output message from the model.

    - `id: string`

      The unique ID of the output message.

    - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

      The content of the output message.

      - `BetaResponseOutputText object { annotations, logprobs, text, type }`

        A text output from the model.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

          - `FileCitation object { file_id, filename, index, type }`

            A citation to a file.

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index 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 object { end_index, start_index, title, 2 more }`

            A citation for a web resource used to generate a model response.

            - `end_index: number`

              The index of the last character of the URL citation in the message.

            - `start_index: number`

              The index of the first character of the URL citation in the message.

            - `title: string`

              The title of the web resource.

            - `type: "url_citation"`

              The type of the URL citation. Always `url_citation`.

              - `"url_citation"`

            - `url: string`

              The URL of the web resource.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            A citation for a container file used to generate a model response.

            - `container_id: string`

              The ID of the container file.

            - `end_index: number`

              The index of the last character of the container file citation in the message.

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the container file cited.

            - `start_index: number`

              The index of the first character of the container file citation in the message.

            - `type: "container_file_citation"`

              The type of the container file citation. Always `container_file_citation`.

              - `"container_file_citation"`

          - `FilePath object { file_id, index, type }`

            A path to a file.

            - `file_id: string`

              The ID of the file.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_path"`

              The type of the file path. Always `file_path`.

              - `"file_path"`

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `token: string`

          - `bytes: array of number`

          - `logprob: number`

          - `top_logprobs: array of object { token, bytes, logprob }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

          - `"output_text"`

      - `BetaResponseOutputRefusal object { refusal, type }`

        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" or "completed" or "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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `phase: optional "commentary" or "final_answer" or 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"`

  - `FileSearchCall object { id, queries, status, 3 more }`

    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 of string`

      The queries used to search for files.

    - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

      The results of the file search tool call.

      - `attributes: optional map[string or number or boolean] or 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: optional string`

        The unique ID of the file.

      - `filename: optional string`

        The name of the file.

      - `score: optional number`

        The relevance score of the file - a value between 0 and 1.

      - `text: optional string`

        The text that was retrieved from the file.

  - `FunctionCall object { arguments, call_id, name, 7 more }`

    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: optional string`

      The unique ID of the function tool call.

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `async: optional boolean`

      Whether the function tool call runs asynchronously.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `namespace: optional string`

      The namespace of the function to run.

    - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

    - `id: string`

      The unique ID of the function call tool output.

    - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

      The output from the function call generated by your code.
      Can be a string or an list of output content.

      - `StringOutput = string`

        A string of the output of the function call.

      - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        Text, image, or file output of the function call.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

          - `text: string`

            The text input to the model.

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          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: optional string or null`

            The ID of the file to be sent to the model.

          - `image_url: optional string or null`

            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"input_file"`

          - `detail: optional "auto" or "low" or "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: optional string`

            The content of the file to be sent to the model.

          - `file_id: optional string or null`

            The ID of the file to be sent to the model.

          - `file_url: optional string`

            The URL of the file to be sent to the model.

          - `filename: optional string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

    - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `call_id: optional string`

      The unique ID of the function tool call generated by the model.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `created_by: optional string`

      The identifier of the actor that created the item.

    - `name: optional string`

      The name of the tool that produced the output.

    - `namespace: optional string`

      The namespace of the tool that produced the output.

  - `AgentMessage object { id, author, content, 3 more }`

    - `id: string`

      The unique ID of the agent message.

    - `author: string`

      The sending agent identity.

    - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

      Encrypted content sent between agents.

      - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

        A text input to the model.

      - `BetaResponseOutputText object { annotations, logprobs, text, type }`

        A text output from the model.

      - `Text object { text, type }`

        A text content.

        - `text: string`

        - `type: "text"`

          - `"text"`

      - `SummaryText object { text, type }`

        A summary text from the model.

        - `text: string`

          A summary of the reasoning output from the model so far.

        - `type: "summary_text"`

          The type of the object. Always `summary_text`.

          - `"summary_text"`

      - `ReasoningText object { text, type }`

        Reasoning text from the model.

        - `text: string`

          The reasoning text from the model.

        - `type: "reasoning_text"`

          The type of the reasoning text. Always `reasoning_text`.

          - `"reasoning_text"`

      - `BetaResponseOutputRefusal object { refusal, type }`

        A refusal from the model.

      - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

        An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

      - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

        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 or null`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: string or null`

          The URL of the screenshot image.

        - `type: "computer_screenshot"`

          Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

          - `"computer_screenshot"`

        - `prompt_cache_breakpoint: optional object { mode }`

          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

          - `mode: "explicit"`

            The breakpoint mode. Always `explicit`.

            - `"explicit"`

      - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

        A file input to the model.

      - `EncryptedContent object { encrypted_content, type }`

        Opaque encrypted content that Responses API decrypts inside trusted model execution.

        - `encrypted_content: string`

          Opaque encrypted content.

        - `type: "encrypted_content"`

          The type of the input item. Always `encrypted_content`.

          - `"encrypted_content"`

    - `recipient: string`

      The destination agent identity.

    - `type: "agent_message"`

      The type of the item. Always `agent_message`.

      - `"agent_message"`

    - `agent: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCall object { id, action, arguments, 3 more }`

    - `id: string`

      The unique ID of the multi-agent call item.

    - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

    - `id: string`

      The unique ID of the multi-agent call output item.

    - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

      Text output returned by the multi-agent action.

      - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

        The annotations of the text output.

      - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

    - `type: "multi_agent_call_output"`

      The type of the multi-agent result. Always `multi_agent_call_output`.

      - `"multi_agent_call_output"`

    - `agent: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `WebSearchCall object { id, status, type, 2 more }`

    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.

    - `status: "in_progress" or "searching" or "completed" or 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"`

    - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

      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 object { type, queries, query, sources }`

        Action type "search" - Performs a web search query.

        - `type: "search"`

          The action type.

          - `"search"`

        - `queries: optional array of string`

          The search queries.

        - `query: optional string`

          The search query.

        - `sources: optional array of object { type, url }`

          The sources used in the search.

          - `type: "url"`

            The type of source. Always `url`.

            - `"url"`

          - `url: string`

            The URL of the source.

      - `OpenPage object { type, url }`

        Action type "open_page" - Opens a specific URL from search results.

        - `type: "open_page"`

          The action type.

          - `"open_page"`

        - `url: optional string or null`

          The URL opened by the model.

      - `FindInPage object { pattern, type, url }`

        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: optional string or null`

          The URL of the page searched for the pattern, when available.

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

    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 of object { id, code, message }`

      The pending safety checks for the computer call.

      - `id: string`

        The ID of the pending safety check.

      - `code: optional string or null`

        The type of the pending safety check.

      - `message: optional string or null`

        Details about the pending safety check.

    - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

      A click action.

      - `Click object { button, type, x, 2 more }`

        A click action.

        - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

          The keys being held while clicking.

      - `DoubleClick object { keys, type, x, y }`

        A double click action.

        - `keys: array of string or 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 object { path, type, keys }`

        A drag action.

        - `path: array of object { x, y }`

          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: optional array of string or null`

          The keys being held while dragging the mouse.

      - `Keypress object { keys, type }`

        A collection of keypresses the model would like to perform.

        - `keys: array of 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 object { type, x, y, keys }`

        A mouse move action.

        - `type: "move"`

          Specifies the event type. For a move action, this property is always set to `move`.

          - `"move"`

        - `x: number`

          The x-coordinate to move to.

        - `y: number`

          The y-coordinate to move to.

        - `keys: optional array of string or null`

          The keys being held while moving the mouse.

      - `Screenshot object { type }`

        A screenshot action.

        - `type: "screenshot"`

          Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

          - `"screenshot"`

      - `Scroll object { scroll_x, scroll_y, type, 3 more }`

        A scroll action.

        - `scroll_x: number`

          The horizontal scroll distance.

        - `scroll_y: number`

          The vertical scroll distance.

        - `type: "scroll"`

          Specifies the event type. For a scroll action, this property is always set to `scroll`.

          - `"scroll"`

        - `x: number`

          The x-coordinate where the scroll occurred.

        - `y: number`

          The y-coordinate where the scroll occurred.

        - `keys: optional array of string or null`

          The keys being held while scrolling.

      - `Type object { text, type }`

        An action to type in text.

        - `text: string`

          The text to type.

        - `type: "type"`

          Specifies the event type. For a type action, this property is always set to `type`.

          - `"type"`

      - `Wait object { type }`

        A wait action.

        - `type: "wait"`

          Specifies the event type. For a wait action, this property is always set to `wait`.

          - `"wait"`

    - `actions: optional BetaComputerActionList`

      Flattened batched actions for `computer_use`. Each action includes an
      `type` discriminator and action-specific fields.

      - `Click object { button, type, x, 2 more }`

        A click action.

      - `DoubleClick object { keys, type, x, y }`

        A double click action.

      - `Drag object { path, type, keys }`

        A drag action.

      - `Keypress object { keys, type }`

        A collection of keypresses the model would like to perform.

      - `Move object { type, x, y, keys }`

        A mouse move action.

      - `Screenshot object { type }`

        A screenshot action.

      - `Scroll object { scroll_x, scroll_y, type, 3 more }`

        A scroll action.

      - `Type object { text, type }`

        An action to type in text.

      - `Wait object { type }`

        A wait action.

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ComputerCallOutput object { id, call_id, output, 5 more }`

    - `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: optional string`

        The identifier of an uploaded file that contains the screenshot.

      - `image_url: optional string`

        The URL of the screenshot image.

    - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

      The safety checks reported by the API that have been acknowledged by the
      developer.

      - `id: string`

        The ID of the pending safety check.

      - `code: optional string or null`

        The type of the pending safety check.

      - `message: optional string or null`

        Details about the pending safety check.

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `Reasoning object { id, summary, type, 4 more }`

    A description of the chain of thought used by a reasoning model while generating
    a response. Be sure to include these items in your `input` to the Responses API
    for subsequent turns of a conversation if you are manually
    [managing context](/api/docs/guides/conversation-state).

    - `id: string`

      The unique identifier of the reasoning content.

    - `summary: array of object { text, type }`

      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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `content: optional array of object { text, type }`

      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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

    - `id: string`

      The unique ID of the program item.

    - `call_id: string`

      The stable call ID of the program item.

    - `code: string`

      The JavaScript source executed by programmatic tool calling.

    - `fingerprint: string`

      Opaque program replay fingerprint that must be round-tripped.

    - `type: "program"`

      The type of the item. Always `program`.

      - `"program"`

    - `agent: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ProgramOutput object { id, call_id, result, 3 more }`

    - `id: string`

      The unique ID of the program output item.

    - `call_id: string`

      The call ID of the program item.

    - `result: string`

      The result produced by the program item.

    - `status: "completed" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `ToolSearchCall object { id, arguments, call_id, 5 more }`

    - `id: string`

      The unique ID of the tool search call item.

    - `arguments: unknown`

      Arguments used for the tool search call.

    - `call_id: string or null`

      The unique ID of the tool search call generated by the model.

    - `execution: "server" or "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `ToolSearchOutput object { id, call_id, execution, 5 more }`

    - `id: string`

      The unique ID of the tool search output item.

    - `call_id: string or null`

      The unique ID of the tool search call generated by the model.

    - `execution: "server" or "client"`

      Whether tool search was executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `status: "in_progress" or "completed" or "incomplete"`

      The status of the tool search output item that was recorded.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

    - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      The loaded tool definitions returned by tool search.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

                - `type: "disabled"`

                  Disable outbound network access. Always `disabled`.

                  - `"disabled"`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `allowed_domains: array of string`

                  A list of allowed domains when type is `allowlist`.

                - `type: "allowlist"`

                  Allow outbound network access only to specified domains. Always `allowlist`.

                  - `"allowlist"`

                - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                  Optional domain-scoped secrets for allowlisted domains.

                  - `domain: string`

                    The domain associated with the secret.

                  - `name: string`

                    The name of the secret to inject for the domain.

                  - `value: string`

                    The secret value to inject for the domain.

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `type: "container_auto"`

              Automatically creates a container for this request

              - `"container_auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `skills: optional array of BetaSkillReference or BetaInlineSkill`

              An optional list of skills referenced by id or inline data.

              - `BetaSkillReference object { skill_id, type, version }`

                - `skill_id: string`

                  The ID of the referenced skill.

                - `type: "skill_reference"`

                  References a skill created with the /v1/skills endpoint.

                  - `"skill_reference"`

                - `version: optional string`

                  Optional skill version. Use a positive integer or 'latest'. Omit for default.

              - `BetaInlineSkill object { description, name, source, type }`

                - `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.

                  - `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 object { type, skills }`

            - `type: "local"`

              Use a local computer environment.

              - `"local"`

            - `skills: optional array of BetaLocalSkill`

              An optional list of skills.

              - `description: string`

                The description of the skill.

              - `name: string`

                The name of the skill.

              - `path: string`

                The path to the directory containing the skill.

          - `BetaContainerReference object { container_id, type }`

            - `container_id: string`

              The ID of the referenced container.

            - `type: "container_reference"`

              References a container created with the /v1/containers endpoint

              - `"container_reference"`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `type: "tool_search_output"`

      The type of the item. Always `tool_search_output`.

      - `"tool_search_output"`

    - `agent: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `AdditionalTools object { id, role, tools, 2 more }`

    - `id: string`

      The unique ID of the additional tools item.

    - `role: "unknown" or "user" or "assistant" or 5 more`

      The role that provided the additional tools.

      - `"unknown"`

      - `"user"`

      - `"assistant"`

      - `"system"`

      - `"critic"`

      - `"discriminator"`

      - `"developer"`

      - `"tool"`

    - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      The additional tool definitions made available at this item.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `type: "additional_tools"`

      The type of the item. Always `additional_tools`.

      - `"additional_tools"`

    - `agent: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `Compaction object { id, encrypted_content, type, 2 more }`

    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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `ImageGenerationCall object { id, result, status, 9 more }`

    An image generation request made by the model.

    - `id: string`

      The unique ID of the image generation call.

    - `result: string or null`

      The generated image encoded in base64.

    - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

      The action used for image generation.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background: optional "transparent" or "opaque" or "auto" or null`

      The background setting used for generation.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `error: optional object { code, message, param, 2 more }`

      Details of a moderation failure, when available.

      - `code: string or null`

        The error code.

      - `message: string`

        A description of the error.

      - `param: string or null`

        The related request parameter.

      - `type: string`

        The error type.

      - `moderation_details: optional object { categories, moderation_stage }`

        Public details for a `moderation_blocked` error, when available.

        - `categories: array of string`

          Public moderation categories. New category values may be added over time.

        - `moderation_stage: "input" or "output" or "unknown"`

          The stage where moderation blocked the image generation call.

          - `"input"`

          - `"output"`

          - `"unknown"`

    - `output_format: optional "png" or "webp" or "jpeg" or null`

      The output format used for generation.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

    - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

      The prompt that was used after any model prompt rewriting.

    - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

      The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

      - `string`

      - `"1024x1024" or "1024x1536" or "1536x1024"`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

  - `CodeInterpreterCall object { id, code, container_id, 4 more }`

    A tool call to run code.

    - `id: string`

      The unique ID of the code interpreter tool call.

    - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

      The outputs generated by the code interpreter, such as logs or images.
      Can be null if no outputs are available.

      - `Logs object { logs, type }`

        The logs output from the code interpreter.

        - `logs: string`

          The logs output from the code interpreter.

        - `type: "logs"`

          The type of the output. Always `logs`.

          - `"logs"`

      - `Image object { type, url }`

        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.

    - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `LocalShellCall object { id, action, call_id, 3 more }`

    A tool call to run a command on the local shell.

    - `id: string`

      The unique ID of the local shell call.

    - `action: object { command, env, type, 3 more }`

      Execute a shell command on the server.

      - `command: array of string`

        The command to run.

      - `env: map[string]`

        Environment variables to set for the command.

      - `type: "exec"`

        The type of the local shell action. Always `exec`.

        - `"exec"`

      - `timeout_ms: optional number or null`

        Optional timeout in milliseconds for the command.

      - `user: optional string or null`

        Optional user to run the command as.

      - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `LocalShellCallOutput object { id, output, type, 2 more }`

    The output of a local shell tool call.

    - `id: string`

      The unique ID of the local shell tool call generated by the model.

    - `output: string`

      A JSON string of the output of the local shell tool call.

    - `type: "local_shell_call_output"`

      The type of the local shell tool call output. Always `local_shell_call_output`.

      - `"local_shell_call_output"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `status: optional "in_progress" or "completed" or "incomplete" or null`

      The status of the item. One of `in_progress`, `completed`, or `incomplete`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

  - `ShellCall object { id, action, call_id, 6 more }`

    A tool call that executes one or more shell commands in a managed environment.

    - `id: string`

      The unique ID of the shell tool call. Populated when this item is returned via API.

    - `action: object { commands, max_output_length, timeout_ms }`

      The shell commands and limits that describe how to run the tool call.

      - `commands: array of string`

      - `max_output_length: number or null`

        Optional maximum number of characters to return from each command.

      - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

      Represents the use of a local environment to perform shell actions.

      - `BetaResponseLocalEnvironment object { type }`

        Represents the use of a local environment to perform shell actions.

        - `type: "local"`

          The environment type. Always `local`.

          - `"local"`

      - `BetaResponseContainerReference object { container_id, type }`

        Represents a container created with /v1/containers.

        - `container_id: string`

        - `type: "container_reference"`

          The environment type. Always `container_reference`.

          - `"container_reference"`

    - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by: optional string`

      The ID of the entity that created this tool call.

  - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

    The output of a shell tool call that was emitted.

    - `id: string`

      The unique ID of the shell call output. Populated when this item is returned via API.

    - `call_id: string`

      The unique ID of the shell tool call generated by the model.

    - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

      An array of shell call output contents

      - `outcome: Timeout { type }  or Exit { exit_code, type }`

        Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

        - `Timeout object { type }`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit object { exit_code, type }`

          Indicates that the shell commands finished and returned an exit code.

          - `exit_code: number`

            Exit code from the shell process.

          - `type: "exit"`

            The outcome type. Always `exit`.

            - `"exit"`

      - `stderr: string`

        The standard error output that was captured.

      - `stdout: string`

        The standard output that was captured.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `ApplyPatchCall object { id, call_id, operation, 5 more }`

    A tool call that applies file diffs by creating, deleting, or updating files.

    - `id: string`

      The unique ID of the apply patch tool call. Populated when this item is returned via API.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

    - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

      One of the create_file, delete_file, or update_file operations applied via apply_patch.

      - `CreateFile object { diff, path, type }`

        Instruction describing how to create a file via the apply_patch tool.

        - `diff: string`

          Diff to apply.

        - `path: string`

          Path of the file to create.

        - `type: "create_file"`

          Create a new file with the provided diff.

          - `"create_file"`

      - `DeleteFile object { path, type }`

        Instruction describing how to delete a file via the apply_patch tool.

        - `path: string`

          Path of the file to delete.

        - `type: "delete_file"`

          Delete the specified file.

          - `"delete_file"`

      - `UpdateFile object { diff, path, type }`

        Instruction describing how to update a file via the apply_patch tool.

        - `diff: string`

          Diff to apply.

        - `path: string`

          Path of the file to update.

        - `type: "update_file"`

          Update an existing file with the provided diff.

          - `"update_file"`

    - `status: "in_progress" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by: optional string`

      The ID of the entity that created this tool call.

  - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

    The output emitted by an apply patch tool call.

    - `id: string`

      The unique ID of the apply patch tool call output. Populated when this item is returned via API.

    - `call_id: string`

      The unique ID of the apply patch tool call generated by the model.

    - `status: "completed" or "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: optional object { agent_name }`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `created_by: optional string`

      The ID of the entity that created this tool call output.

    - `output: optional string or null`

      Optional textual output returned by the apply patch tool.

  - `McpCall object { id, arguments, name, 7 more }`

    An invocation of a tool on an MCP server.

    - `id: string`

      The unique ID of the tool call.

    - `arguments: string`

      A JSON string of the arguments passed to the tool.

    - `name: string`

      The name of the tool that was run.

    - `server_label: string`

      The label of the MCP server running the tool.

    - `type: "mcp_call"`

      The type of the item. Always `mcp_call`.

      - `"mcp_call"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

      The error from the tool call, if any.

      - `McpProtocolError object { code, message, type }`

        - `code: number`

        - `message: string`

        - `type: "mcp_protocol_error"`

          - `"mcp_protocol_error"`

      - `McpToolExecutionError object { content, type }`

        - `content: unknown`

        - `type: "mcp_tool_execution_error"`

          - `"mcp_tool_execution_error"`

      - `HTTPError object { code, message, type }`

        - `code: number`

        - `message: string`

        - `type: "http_error"`

          - `"http_error"`

    - `output: optional string or null`

      The output from the tool call.

    - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

      The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

      - `"in_progress"`

      - `"completed"`

      - `"incomplete"`

      - `"calling"`

      - `"failed"`

  - `McpListTools object { id, server_label, tools, 3 more }`

    A list of tools available on an MCP server.

    - `id: string`

      The unique ID of the list.

    - `server_label: string`

      The label of the MCP server.

    - `tools: array of object { input_schema, name, annotations, description }`

      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: optional unknown or null`

        Additional annotations about the tool.

      - `description: optional string or null`

        The description of the tool.

    - `type: "mcp_list_tools"`

      The type of the item. Always `mcp_list_tools`.

      - `"mcp_list_tools"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `error: optional string or null`

      Error message if the server could not list tools.

  - `McpApprovalRequest object { id, arguments, name, 3 more }`

    A request for human approval of a tool invocation.

    - `id: string`

      The unique ID of the approval request.

    - `arguments: string`

      A JSON string of arguments for the tool.

    - `name: string`

      The name of the tool to run.

    - `server_label: string`

      The label of the MCP server making the request.

    - `type: "mcp_approval_request"`

      The type of the item. Always `mcp_approval_request`.

      - `"mcp_approval_request"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

    A response to an MCP approval request.

    - `id: string`

      The unique ID of the approval response

    - `approval_request_id: string`

      The ID of the approval request being answered.

    - `approve: boolean`

      Whether the request was approved.

    - `type: "mcp_approval_response"`

      The type of the item. Always `mcp_approval_response`.

      - `"mcp_approval_response"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `reason: optional string or null`

      Optional reason for the decision.

  - `CustomToolCall object { call_id, input, name, 6 more }`

    A call to a custom tool created by the model.

    - `call_id: string`

      An identifier used to map this custom tool call to a tool call output.

    - `input: string`

      The input for the custom tool call generated by the model.

    - `name: string`

      The name of the custom tool being called.

    - `type: "custom_tool_call"`

      The type of the custom tool call. Always `custom_tool_call`.

      - `"custom_tool_call"`

    - `id: optional string`

      The unique ID of the custom tool call in the OpenAI platform.

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `async: optional boolean`

      Whether the custom tool call runs asynchronously.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          - `"program"`

    - `namespace: optional string`

      The namespace of the custom tool being called.

  - `CustomToolCallOutput object { id, call_id, output, 5 more }`

    - `id: string`

      The unique ID of the custom tool call output item.

    - `call_id: string`

      The call ID, used to map this custom tool call output to a custom tool call.

    - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

      The output from the custom tool call generated by your code.
      Can be a string or an list of output content.

      - `StringOutput = string`

        A string of the output of the custom tool call.

      - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        Text, image, or file output of the custom tool call.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

    - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

      The type of the custom tool call output. Always `custom_tool_call_output`.

      - `"custom_tool_call_output"`

    - `agent: optional object { agent_name }  or null`

      The agent that produced this item.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

      The execution context that produced this tool call.

      - `Direct object { type }`

        - `type: "direct"`

          The caller type. Always `direct`.

          - `"direct"`

      - `Program object { caller_id, type }`

        - `caller_id: string`

          The call ID of the program item that produced this tool call.

        - `type: "program"`

          The caller type. Always `program`.

          - `"program"`

    - `created_by: optional string`

      The identifier of the actor that created the item.

### Beta Response Output Item Added Event

- `BetaResponseOutputItemAddedEvent object { item, output_index, sequence_number, 2 more }`

  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 object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional 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: optional object { agent_name }  or 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 object { item, output_index, sequence_number, 2 more }`

  Emitted when an output item is marked done.

  - `item: BetaResponseOutputItem`

    The output item that was marked done.

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

  - `output_index: number`

    The index of the output item that was marked done.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.output_item.done"`

    The type of the event. Always `response.output_item.done`.

    - `"response.output_item.done"`

  - `agent: optional object { agent_name }  or 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 Message

- `BetaResponseOutputMessage object { id, content, role, 4 more }`

  An output message from the model.

  - `id: string`

    The unique ID of the output message.

  - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

    The content of the output message.

    - `BetaResponseOutputText object { annotations, logprobs, text, type }`

      A text output from the model.

      - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

        The annotations of the text output.

        - `FileCitation object { file_id, filename, index, type }`

          A citation to a file.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the file cited.

          - `index: number`

            The index 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 object { end_index, start_index, title, 2 more }`

          A citation for a web resource used to generate a model response.

          - `end_index: number`

            The index of the last character of the URL citation in the message.

          - `start_index: number`

            The index of the first character of the URL citation in the message.

          - `title: string`

            The title of the web resource.

          - `type: "url_citation"`

            The type of the URL citation. Always `url_citation`.

            - `"url_citation"`

          - `url: string`

            The URL of the web resource.

        - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

          A citation for a container file used to generate a model response.

          - `container_id: string`

            The ID of the container file.

          - `end_index: number`

            The index of the last character of the container file citation in the message.

          - `file_id: string`

            The ID of the file.

          - `filename: string`

            The filename of the container file cited.

          - `start_index: number`

            The index of the first character of the container file citation in the message.

          - `type: "container_file_citation"`

            The type of the container file citation. Always `container_file_citation`.

            - `"container_file_citation"`

        - `FilePath object { file_id, index, type }`

          A path to a file.

          - `file_id: string`

            The ID of the file.

          - `index: number`

            The index of the file in the list of files.

          - `type: "file_path"`

            The type of the file path. Always `file_path`.

            - `"file_path"`

      - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `token: string`

        - `bytes: array of number`

        - `logprob: number`

        - `top_logprobs: array of object { token, bytes, logprob }`

          - `token: string`

          - `bytes: array of number`

          - `logprob: number`

      - `text: string`

        The text output from the model.

      - `type: "output_text"`

        The type of the output text. Always `output_text`.

        - `"output_text"`

    - `BetaResponseOutputRefusal object { refusal, type }`

      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" or "completed" or "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: optional object { agent_name }  or null`

    The agent that produced this item.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `phase: optional "commentary" or "final_answer" or 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"`

### Beta Response Output Refusal

- `BetaResponseOutputRefusal object { refusal, type }`

  A refusal from the model.

  - `refusal: string`

    The refusal explanation from the model.

  - `type: "refusal"`

    The type of the refusal. Always `refusal`.

    - `"refusal"`

### Beta Response Output Text

- `BetaResponseOutputText object { annotations, logprobs, text, type }`

  A text output from the model.

  - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

    The annotations of the text output.

    - `FileCitation object { file_id, filename, index, type }`

      A citation to a file.

      - `file_id: string`

        The ID of the file.

      - `filename: string`

        The filename of the file cited.

      - `index: number`

        The index 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 object { end_index, start_index, title, 2 more }`

      A citation for a web resource used to generate a model response.

      - `end_index: number`

        The index of the last character of the URL citation in the message.

      - `start_index: number`

        The index of the first character of the URL citation in the message.

      - `title: string`

        The title of the web resource.

      - `type: "url_citation"`

        The type of the URL citation. Always `url_citation`.

        - `"url_citation"`

      - `url: string`

        The URL of the web resource.

    - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

      A citation for a container file used to generate a model response.

      - `container_id: string`

        The ID of the container file.

      - `end_index: number`

        The index of the last character of the container file citation in the message.

      - `file_id: string`

        The ID of the file.

      - `filename: string`

        The filename of the container file cited.

      - `start_index: number`

        The index of the first character of the container file citation in the message.

      - `type: "container_file_citation"`

        The type of the container file citation. Always `container_file_citation`.

        - `"container_file_citation"`

    - `FilePath object { file_id, index, type }`

      A path to a file.

      - `file_id: string`

        The ID of the file.

      - `index: number`

        The index of the file in the list of files.

      - `type: "file_path"`

        The type of the file path. Always `file_path`.

        - `"file_path"`

  - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

    - `token: string`

    - `bytes: array of number`

    - `logprob: number`

    - `top_logprobs: array of object { token, bytes, logprob }`

      - `token: string`

      - `bytes: array of number`

      - `logprob: number`

  - `text: string`

    The text output from the model.

  - `type: "output_text"`

    The type of the output text. Always `output_text`.

    - `"output_text"`

### Beta Response Output Text Annotation Added Event

- `BetaResponseOutputTextAnnotationAddedEvent object { annotation, annotation_index, content_index, 5 more }`

  Emitted when an annotation is added to output text content.

  - `annotation: FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }  or null`

    The annotation object being added. (See annotation schema for details.)

    - `FileCitation object { file_id, filename, index, type }`

      A citation to a file.

      - `file_id: string`

        The ID of the file.

      - `filename: string`

        The filename of the file cited.

      - `index: number`

        The index 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 object { end_index, start_index, title, 2 more }`

      A citation for a web resource used to generate a model response.

      - `end_index: number`

        The index of the last character of the URL citation in the message.

      - `start_index: number`

        The index of the first character of the URL citation in the message.

      - `title: string`

        The title of the web resource.

      - `type: "url_citation"`

        The type of the URL citation. Always `url_citation`.

        - `"url_citation"`

      - `url: string`

        The URL of the web resource.

    - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

      A citation for a container file used to generate a model response.

      - `container_id: string`

        The ID of the container file.

      - `end_index: number`

        The index of the last character of the container file citation in the message.

      - `file_id: string`

        The ID of the file.

      - `filename: string`

        The filename of the container file cited.

      - `start_index: number`

        The index of the first character of the container file citation in the message.

      - `type: "container_file_citation"`

        The type of the container file citation. Always `container_file_citation`.

        - `"container_file_citation"`

    - `FilePath object { file_id, index, type }`

      A path to a file.

      - `file_id: string`

        The ID of the file.

      - `index: number`

        The index of the file in the list of files.

      - `type: "file_path"`

        The type of the file path. Always `file_path`.

        - `"file_path"`

  - `annotation_index: number`

    The index of the annotation within the content part.

  - `content_index: number`

    The index of the content part within the output item.

  - `item_id: string`

    The unique identifier of the item to which the annotation is being added.

  - `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.output_text.annotation.added"`

    The type of the event. Always 'response.output_text.annotation.added'.

    - `"response.output_text.annotation.added"`

  - `agent: optional object { agent_name }  or 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 Prompt

- `BetaResponsePrompt object { id, variables, version }`

  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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

      A text input to the model.

      - `text: string`

        The text input to the model.

      - `type: "input_text"`

        The type of the input item. Always `input_text`.

        - `"input_text"`

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

    - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

      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: optional string or null`

        The ID of the file to be sent to the model.

      - `image_url: optional string or null`

        The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

    - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

      A file input to the model.

      - `type: "input_file"`

        The type of the input item. Always `input_file`.

        - `"input_file"`

      - `detail: optional "auto" or "low" or "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: optional string`

        The content of the file to be sent to the model.

      - `file_id: optional string or null`

        The ID of the file to be sent to the model.

      - `file_url: optional string`

        The URL of the file to be sent to the model.

      - `filename: optional string`

        The name of the file to be sent to the model.

      - `prompt_cache_breakpoint: optional object { mode }`

        Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

        - `mode: "explicit"`

          The breakpoint mode. Always `explicit`.

          - `"explicit"`

  - `version: optional string or null`

    Optional version of the prompt template.

### Beta Response Queued Event

- `BetaResponseQueuedEvent object { response, sequence_number, type, agent }`

  Emitted when a response is queued and waiting to be processed.

  - `response: BetaResponse`

    The full response object that is queued.

    - `id: string`

      Unique identifier for this Response.

    - `access_programs: object { cyber }  or null`

      - `cyber: "standard" or "daybreak_blue" or "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.

    - `error: BetaResponseError or null`

      An error object returned when the model fails to generate a Response.

      - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

      - `param: optional string or null`

        The request parameter associated with the error, or null if none was recorded.

      - `type: optional string or null`

        The original error type, or null if it was not recorded.

    - `incomplete_details: object { reason }  or null`

      Details about why the response is incomplete.

      - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

        A text input to the model, equivalent to a text input with the
        `developer` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `object: "response"`

      The object type of this resource - always set to `response`.

      - `"response"`

    - `output: array of 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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

        - `id: string`

          The unique ID of the function call tool output.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the function call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the function call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the function call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

        - `name: optional string`

          The name of the tool that produced the output.

        - `namespace: optional string`

          The namespace of the tool that produced the output.

      - `AgentMessage object { id, author, content, 3 more }`

        - `id: string`

          The unique ID of the agent message.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

          Encrypted content sent between agents.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

          - `Text object { text, type }`

            A text content.

            - `text: string`

            - `type: "text"`

              - `"text"`

          - `SummaryText object { text, type }`

            A summary text from the model.

            - `text: string`

              A summary of the reasoning output from the model so far.

            - `type: "summary_text"`

              The type of the object. Always `summary_text`.

              - `"summary_text"`

          - `ReasoningText object { text, type }`

            Reasoning text from the model.

            - `text: string`

              The reasoning text from the model.

            - `type: "reasoning_text"`

              The type of the reasoning text. Always `reasoning_text`.

              - `"reasoning_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            A refusal from the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

            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 or null`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: string or null`

              The URL of the screenshot image.

            - `type: "computer_screenshot"`

              Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

              - `"computer_screenshot"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The type of the item. Always `agent_message`.

          - `"agent_message"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { id, action, arguments, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

        - `id: string`

          The unique ID of the multi-agent call output item.

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

          Text output returned by the multi-agent action.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

        - `type: "multi_agent_call_output"`

          The type of the multi-agent result. Always `multi_agent_call_output`.

          - `"multi_agent_call_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

        - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

          The safety checks reported by the API that have been acknowledged by the
          developer.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of the program item.

        - `call_id: string`

          The stable call ID of the program item.

        - `code: string`

          The JavaScript source executed by programmatic tool calling.

        - `fingerprint: string`

          Opaque program replay fingerprint that must be round-tripped.

        - `type: "program"`

          The type of the item. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of the program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

        - `id: string`

          The unique ID of the tool search call item.

        - `arguments: unknown`

          Arguments used for the tool search call.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

        - `id: string`

          The unique ID of the tool search output item.

        - `call_id: string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: "in_progress" or "completed" or "incomplete"`

          The status of the tool search output item that was recorded.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by tool search.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The type of the item. Always `tool_search_output`.

          - `"tool_search_output"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `AdditionalTools object { id, role, tools, 2 more }`

        - `id: string`

          The unique ID of the additional tools item.

        - `role: "unknown" or "user" or "assistant" or 5 more`

          The role that provided the additional tools.

          - `"unknown"`

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"critic"`

          - `"discriminator"`

          - `"developer"`

          - `"tool"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The additional tool definitions made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The type of the item. Always `additional_tools`.

          - `"additional_tools"`

        - `agent: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `Compaction object { id, encrypted_content, type, 2 more }`

        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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

        - `id: string`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

          - `max_output_length: number or null`

            Optional maximum number of characters to return from each command.

          - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

          Represents the use of a local environment to perform shell actions.

          - `BetaResponseLocalEnvironment object { type }`

            Represents the use of a local environment to perform shell actions.

            - `type: "local"`

              The environment type. Always `local`.

              - `"local"`

          - `BetaResponseContainerReference object { container_id, type }`

            Represents a container created with /v1/containers.

            - `container_id: string`

            - `type: "container_reference"`

              The environment type. Always `container_reference`.

              - `"container_reference"`

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

        - `id: string`

          The unique ID of the shell call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the shell tool call generated by the model.

        - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

          An array of shell call output contents

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              Indicates that the shell commands finished and returned an exit code.

              - `exit_code: number`

                Exit code from the shell process.

              - `type: "exit"`

                The outcome type. Always `exit`.

                - `"exit"`

          - `stderr: string`

            The standard error output that was captured.

          - `stdout: string`

            The standard output that was captured.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

        - `id: string`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          One of the create_file, delete_file, or update_file operations applied via apply_patch.

          - `CreateFile object { diff, path, type }`

            Instruction describing how to create a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to create.

            - `type: "create_file"`

              Create a new file with the provided diff.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction describing how to delete a file via the apply_patch tool.

            - `path: string`

              Path of the file to delete.

            - `type: "delete_file"`

              Delete the specified file.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction describing how to update a file via the apply_patch tool.

            - `diff: string`

              Diff to apply.

            - `path: string`

              Path of the file to update.

            - `type: "update_file"`

              Update an existing file with the provided diff.

              - `"update_file"`

        - `status: "in_progress" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

        - `id: string`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `call_id: string`

          The unique ID of the apply patch tool call generated by the model.

        - `status: "completed" or "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: optional object { agent_name }`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `created_by: optional string`

          The ID of the entity that created this tool call output.

        - `output: optional string or null`

          Optional textual output returned by the apply patch tool.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

        - `id: string`

          The unique ID of the approval response

        - `approval_request_id: string`

          The ID of the approval request being answered.

        - `approve: boolean`

          Whether the request was approved.

        - `type: "mcp_approval_response"`

          The type of the item. Always `mcp_approval_response`.

          - `"mcp_approval_response"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

        - `id: string`

          The unique ID of the custom tool call output item.

        - `call_id: string`

          The call ID, used to map this custom tool call output to a custom tool call.

        - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

          The type of the custom tool call output. Always `custom_tool_call_output`.

          - `"custom_tool_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `created_by: optional 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 or 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.

    - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_p: number or 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.

    - `background: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `completed_at: optional number or null`

      Unix timestamp (in seconds) of when this Response was completed.
      Only present when the status is `completed`.

    - `conversation: optional object { id }  or 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.

    - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

      Moderation results for the response input and output, if moderated completions were requested.

      - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response input.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

        Moderation for the response output.

        - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

          A moderation result produced for the response input or output.

          - `categories: map[boolean]`

            A dictionary of moderation categories to booleans, True if the input is flagged under this category.

          - `category_applied_input_types: map[array of "text" or "image"]`

            Which modalities of input are reflected by the score for each category.

            - `"text"`

            - `"image"`

          - `category_scores: map[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 object { code, message, type }`

          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_text: optional string or null`

      SDK-only convenience property that contains the aggregated text output
      from all `output_text` items in the `output` array, if any are present.
      Supported in the Python and JavaScript SDKs.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

      Prompt cache diagnostics requested for this response.

      - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

        - `cache_missed_tokens: number`

          The estimated number of input tokens affected after the first detected divergence.

        - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

          The raw token count of the reusable prefix in the compared response.

      - `CacheHit object { type }`

        - `type: "cache_hit"`

          - `"cache_hit"`

      - `ComparisonResponseNotFound object { type }`

        - `type: "comparison_response_not_found"`

          - `"comparison_response_not_found"`

      - `Unavailable object { type }`

        - `type: "unavailable"`

          - `"unavailable"`

    - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

      The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

      - `mode: "implicit" or "explicit"`

        Whether implicit prompt-cache breakpoints were enabled.

        - `"implicit"`

        - `"explicit"`

      - `ttl: "30m"`

        The minimum lifetime applied to each cache breakpoint.

        - `"30m"`

      - `comparison_response_id: optional string or null`

        The response ID supplied as the prompt cache diagnostics comparison.

    - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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"`

    - `top_logprobs: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional BetaResponseUsage or null`

      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: object { cache_write_tokens, cached_tokens }`

        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).

      - `output_tokens: number`

        The number of output tokens.

      - `output_tokens_details: object { reasoning_tokens }`

        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: optional string or null`

      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.queued"`

    The type of the event. Always 'response.queued'.

    - `"response.queued"`

  - `agent: optional object { agent_name }  or 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 Reasoning Summary Part Added Event

- `BetaResponseReasoningSummaryPartAddedEvent object { item_id, output_index, part, 4 more }`

  Emitted when a new reasoning summary part is added.

  - `item_id: string`

    The ID of the item this summary part is associated with.

  - `output_index: number`

    The index of the output item this summary part is associated with.

  - `part: object { text, type }`

    The summary part that was added.

    - `text: string`

      The text of the summary part.

    - `type: "summary_text"`

      The type of the summary part. Always `summary_text`.

      - `"summary_text"`

  - `sequence_number: number`

    The sequence number of this event.

  - `summary_index: number`

    The index of the summary part within the reasoning summary.

  - `type: "response.reasoning_summary_part.added"`

    The type of the event. Always `response.reasoning_summary_part.added`.

    - `"response.reasoning_summary_part.added"`

  - `agent: optional object { agent_name }  or 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 Reasoning Summary Part Done Event

- `BetaResponseReasoningSummaryPartDoneEvent object { item_id, output_index, part, 5 more }`

  Emitted when a reasoning summary part is completed.

  - `item_id: string`

    The ID of the item this summary part is associated with.

  - `output_index: number`

    The index of the output item this summary part is associated with.

  - `part: object { text, type }`

    The completed summary part.

    - `text: string`

      The text of the summary part.

    - `type: "summary_text"`

      The type of the summary part. Always `summary_text`.

      - `"summary_text"`

  - `sequence_number: number`

    The sequence number of this event.

  - `summary_index: number`

    The index of the summary part within the reasoning summary.

  - `type: "response.reasoning_summary_part.done"`

    The type of the event. Always `response.reasoning_summary_part.done`.

    - `"response.reasoning_summary_part.done"`

  - `agent: optional object { agent_name }  or null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `status: optional "incomplete"`

    The completion status of the summary part. Omitted when the part completed
    normally and set to `incomplete` when generation was interrupted.

    - `"incomplete"`

### Beta Response Reasoning Summary Text Delta Event

- `BetaResponseReasoningSummaryTextDeltaEvent object { delta, item_id, output_index, 4 more }`

  Emitted when a delta is added to a reasoning summary text.

  - `delta: string`

    The text delta that was added to the summary.

  - `item_id: string`

    The ID of the item this summary text delta is associated with.

  - `output_index: number`

    The index of the output item this summary text delta is associated with.

  - `sequence_number: number`

    The sequence number of this event.

  - `summary_index: number`

    The index of the summary part within the reasoning summary.

  - `type: "response.reasoning_summary_text.delta"`

    The type of the event. Always `response.reasoning_summary_text.delta`.

    - `"response.reasoning_summary_text.delta"`

  - `agent: optional object { agent_name }  or 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 Reasoning Summary Text Done Event

- `BetaResponseReasoningSummaryTextDoneEvent object { item_id, output_index, sequence_number, 4 more }`

  Emitted when a reasoning summary text is completed.

  - `item_id: string`

    The ID of the item this summary text is associated with.

  - `output_index: number`

    The index of the output item this summary text is associated with.

  - `sequence_number: number`

    The sequence number of this event.

  - `summary_index: number`

    The index of the summary part within the reasoning summary.

  - `text: string`

    The full text of the completed reasoning summary.

  - `type: "response.reasoning_summary_text.done"`

    The type of the event. Always `response.reasoning_summary_text.done`.

    - `"response.reasoning_summary_text.done"`

  - `agent: optional object { agent_name }  or 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 Reasoning Text Delta Event

- `BetaResponseReasoningTextDeltaEvent object { content_index, delta, item_id, 4 more }`

  Emitted when a delta is added to a reasoning text.

  - `content_index: number`

    The index of the reasoning content part this delta is associated with.

  - `delta: string`

    The text delta that was added to the reasoning content.

  - `item_id: string`

    The ID of the item this reasoning text delta is associated with.

  - `output_index: number`

    The index of the output item this reasoning text delta is associated with.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.reasoning_text.delta"`

    The type of the event. Always `response.reasoning_text.delta`.

    - `"response.reasoning_text.delta"`

  - `agent: optional object { agent_name }  or 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 Reasoning Text Done Event

- `BetaResponseReasoningTextDoneEvent object { content_index, item_id, output_index, 4 more }`

  Emitted when a reasoning text is completed.

  - `content_index: number`

    The index of the reasoning content part.

  - `item_id: string`

    The ID of the item this reasoning text is associated with.

  - `output_index: number`

    The index of the output item this reasoning text is associated with.

  - `sequence_number: number`

    The sequence number of this event.

  - `text: string`

    The full text of the completed reasoning content.

  - `type: "response.reasoning_text.done"`

    The type of the event. Always `response.reasoning_text.done`.

    - `"response.reasoning_text.done"`

  - `agent: optional object { agent_name }  or 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 Refusal Delta Event

- `BetaResponseRefusalDeltaEvent object { content_index, delta, item_id, 4 more }`

  Emitted when there is a partial refusal text.

  - `content_index: number`

    The index of the content part that the refusal text is added to.

  - `delta: string`

    The refusal text that is added.

  - `item_id: string`

    The ID of the output item that the refusal text is added to.

  - `output_index: number`

    The index of the output item that the refusal text is added to.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.refusal.delta"`

    The type of the event. Always `response.refusal.delta`.

    - `"response.refusal.delta"`

  - `agent: optional object { agent_name }  or 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 Refusal Done Event

- `BetaResponseRefusalDoneEvent object { content_index, item_id, output_index, 4 more }`

  Emitted when refusal text is finalized.

  - `content_index: number`

    The index of the content part that the refusal text is finalized.

  - `item_id: string`

    The ID of the output item that the refusal text is finalized.

  - `output_index: number`

    The index of the output item that the refusal text is finalized.

  - `refusal: string`

    The refusal text that is finalized.

  - `sequence_number: number`

    The sequence number of this event.

  - `type: "response.refusal.done"`

    The type of the event. Always `response.refusal.done`.

    - `"response.refusal.done"`

  - `agent: optional object { agent_name }  or 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 Shell Call Command Added Event

- `BetaResponseShellCallCommandAddedEvent object { command, command_index, output_index, 3 more }`

  A streaming event that indicated a shell command was added to a tool call.

  - `command: string`

    The shell command that was added.

  - `command_index: number`

    The index of the shell command that was added.

  - `output_index: number`

    The index of the output item that was updated.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.shell_call_command.added"`

    The type of the event, always `response.shell_call_command.added`.

    - `"response.shell_call_command.added"`

  - `agent: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Shell Call Command Delta Event

- `BetaResponseShellCallCommandDeltaEvent object { command_index, delta, output_index, 4 more }`

  A streaming event that indicated a shell command was incrementally updated.

  - `command_index: number`

    The index of the shell command that was updated.

  - `delta: string`

    The shell command delta that was appended.

  - `output_index: number`

    The index of the output item that was updated.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.shell_call_command.delta"`

    The type of the event, always `response.shell_call_command.delta`.

    - `"response.shell_call_command.delta"`

  - `agent: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

  - `obfuscation: optional string`

    An obfuscation string that was added to pad the event payload.

### Beta Response Shell Call Command Done Event

- `BetaResponseShellCallCommandDoneEvent object { command, command_index, output_index, 3 more }`

  A streaming event that indicated a shell command was completed.

  - `command: string`

    The final shell command that was emitted.

  - `command_index: number`

    The index of the shell command that was completed.

  - `output_index: number`

    The index of the output item that was updated.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.shell_call_command.done"`

    The type of the event, always `response.shell_call_command.done`.

    - `"response.shell_call_command.done"`

  - `agent: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Shell Call Output Content Delta Event

- `BetaResponseShellCallOutputContentDeltaEvent object { command_index, delta, item_id, 4 more }`

  A streaming event that indicated shell call output was incrementally added.

  - `command_index: number`

    The index of the shell command that produced output.

  - `delta: object { stderr, stdout }`

    The stdout/stderr delta that was emitted.

    - `stderr: optional string`

      The stderr delta that was emitted.

    - `stdout: optional string`

      The stdout delta that was emitted.

  - `item_id: string`

    The ID of the output item that was updated.

  - `output_index: number`

    The index of the output item that was updated.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.shell_call_output_content.delta"`

    The type of the event, always `response.shell_call_output_content.delta`.

    - `"response.shell_call_output_content.delta"`

  - `agent: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Shell Call Output Content Done Event

- `BetaResponseShellCallOutputContentDoneEvent object { command_index, item_id, output, 4 more }`

  A streaming event that indicated shell call output was completed.

  - `command_index: number`

    The index of the shell command that produced output.

  - `item_id: string`

    The ID of the output item that was updated.

  - `output: array of object { outcome, stderr, stdout, created_by }`

    The output contents emitted for the shell command.

    - `outcome: Timeout { type }  or Exit { exit_code, type }`

      Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

      - `Timeout object { type }`

        Indicates that the shell call exceeded its configured time limit.

        - `type: "timeout"`

          The outcome type. Always `timeout`.

          - `"timeout"`

      - `Exit object { exit_code, type }`

        Indicates that the shell commands finished and returned an exit code.

        - `exit_code: number`

          Exit code from the shell process.

        - `type: "exit"`

          The outcome type. Always `exit`.

          - `"exit"`

    - `stderr: string`

      The standard error output that was captured.

    - `stdout: string`

      The standard output that was captured.

    - `created_by: optional string`

      The identifier of the actor that created the item.

  - `output_index: number`

    The index of the output item that was updated.

  - `sequence_number: number`

    The sequence number of the event that was emitted.

  - `type: "response.shell_call_output_content.done"`

    The type of the event, always `response.shell_call_output_content.done`.

    - `"response.shell_call_output_content.done"`

  - `agent: optional object { agent_name }`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Response Status

- `BetaResponseStatus = "completed" or "failed" or "in_progress" or 3 more`

  The status of the response generation. One of `completed`, `failed`,
  `in_progress`, `cancelled`, `queued`, or `incomplete`.

  - `"completed"`

  - `"failed"`

  - `"in_progress"`

  - `"cancelled"`

  - `"queued"`

  - `"incomplete"`

### Beta Response Steer Accepted Event

- `BetaResponseSteerAcceptedEvent object { sequence_number, steer, type, stream_id }`

  Emitted when steering input has been validated and queued. Acceptance means
  the server owns the input, not that it has been applied. The successor's
  `response.created` event is the commit point. If accepted input cannot be
  committed, `response.steer.failed` returns it with the same steering ID.

  When the response stops for client-owned tool output or approval, the input
  remains queued and `response.steer.pending` is emitted after
  `response.completed`. Fill the pending event's `required_input` stubs with
  saved results and send one matching explicit `response.create` per parent.
  Do not resend accepted input while it is still queued.

  - `sequence_number: number`

    The sequence number for this event.

  - `steer: object { id, previous_response_id }`

    The accepted steering submission.

    - `id: string`

      The ID assigned to the steering submission.

    - `previous_response_id: string`

      The ID of the response being steered.

  - `type: "response.steer.accepted"`

    The event discriminator. Always `response.steer.accepted`.

    - `"response.steer.accepted"`

  - `stream_id: optional string`

    The WebSocket lane that emitted this event. This field is present when
    the target response's `response.create` event supplied a `stream_id`.

### Beta Response Steer Error Code

- `BetaResponseSteerErrorCode = "response_not_found" or "invalid_input" or "steering_not_supported" or 4 more or string`

  A machine-readable steering error code. Clients should handle unknown
  values because additional codes may be introduced. Known values include:

  - `response_not_found`: The target response is not available on this connection.
  - `invalid_input`: The event or input failed validation.
  - `steering_not_supported`: The model or response execution mode does not support steering.
  - `too_many_pending_steers`: Too much steering input is pending for the response.
  - `response_already_completed`: The response completed and is no longer accepting steering input.
  - `response_not_active`: The response is no longer accepting steering input.
  - `successor_creation_failed`: The successor response could not be created.

  - `"response_not_found" or "invalid_input" or "steering_not_supported" or 4 more`

    A machine-readable steering error code. Clients should handle unknown
    values because additional codes may be introduced. Known values include:

    - `response_not_found`: The target response is not available on this connection.
    - `invalid_input`: The event or input failed validation.
    - `steering_not_supported`: The model or response execution mode does not support steering.
    - `too_many_pending_steers`: Too much steering input is pending for the response.
    - `response_already_completed`: The response completed and is no longer accepting steering input.
    - `response_not_active`: The response is no longer accepting steering input.
    - `successor_creation_failed`: The successor response could not be created.

    - `"response_not_found"`

    - `"invalid_input"`

    - `"steering_not_supported"`

    - `"too_many_pending_steers"`

    - `"response_already_completed"`

    - `"response_not_active"`

    - `"successor_creation_failed"`

  - `string`

### Beta Response Steer Event

- `BetaResponseSteerEvent object { input, previous_response_id, type }`

  Queues user input to steer a response on this WebSocket connection. Input
  can contain text, images, and files. Steering is supported only for
  single-agent responses on models and execution modes that support steering.
  Responses bound to a conversation or using automatic compaction do not
  support steering.

  A `response.steer.accepted` event acknowledges that the server owns the
  queued input, not that it has been applied. The successor's `response.created`
  event is the commit point. Input that cannot be committed is returned in
  `response.steer.failed`.

  Steering may cause the active response to finish at a safe output boundary
  with `response.incomplete` and `incomplete_details.reason` set to `steered`,
  followed automatically by a successor `response.created`. Normal completion
  can also be followed by an automatic successor. Automatic successors inherit
  the previous response's settings and continue from it with the queued input.

  If the response stops for client-owned tool output or approval, accepted
  steering input remains queued and `response.steer.pending` is emitted after
  `response.completed`. Fill the `required_input` stubs from that event with
  saved tool results or approval decisions, and send one explicit
  `response.create` per parent with the same `previous_response_id` and
  WebSocket lane. Do not rerun tools or resend accepted steering input. The
  queued input is prepended in submission order to that request's input, and
  the explicit request retains its own settings.

  This event accepts only `type`, `previous_response_id`, and `input`. Do not
  send `stream_id`; the target response determines the WebSocket lane.

  - `input: BetaResponseSteerInput`

    Input to queue for a continuation of the response. Uses the same string or
    input-item shape as `response.create.input`, with a non-empty array when
    supplying input items.

    Steering accepts only messages with the `user` role. Each message may
    contain only `type`, `role`, and `content`, with `content` as a string or an
    array of `input_text`, `input_image`, and `input_file` parts. The optional
    `type` must be `message`. Other roles, tool outputs, and item types are not
    supported for steering.

    - `TextInput = string`

      A text input, equivalent to a message with the `user` role.

    - `ResponseSteerInputItemList = array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

      A non-empty list of message inputs to queue for the response.

      - `Message object { content, role, type, 3 more }`

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent or string`

          The message content, as an array of content parts.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              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: optional BetaImageDetail or 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: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string or null`

                The base64-encoded data of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string or null`

                The URL of the file to be sent to the model.

              - `filename: optional string or null`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

                - `ttl: optional "30m" or "12h"`

                  The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                  - `"30m"`

                  - `"12h"`

          - `string`

            The message content, as a single string.

        - `role: "user"`

          The message role. Always `user`.

          - `"user"`

        - `type: "message"`

          The item type. Always `message`.

          - `"message"`

        - `id: optional string or null`

          The unique ID of this message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional string or null`

          The status of the message item.

      - `FunctionCallOutput object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

  - `previous_response_id: string`

    The ID of the response to steer on this WebSocket connection.

  - `type: "response.steer"`

    The event discriminator. Always `response.steer`.

    - `"response.steer"`

### Beta Response Steer Failed Event

- `BetaResponseSteerFailedEvent object { error, sequence_number, steer, 2 more }`

  Emitted when steering input is rejected or cannot be committed to a
  successor response. Returns the original, uncommitted input so the client
  can carry it into `response.create` when appropriate. Invalid input must
  be corrected before retrying.

  Failures after acceptance include the same steering ID. Failures before an
  ID is allocated omit `steer.id`. A lost connection or missing acknowledgement
  leaves the outcome unknown; it is not proof that the input was rejected.

  - `error: object { code, message, type }`

    Information about why the input could not be committed.

    - `code: BetaResponseSteerErrorCode`

      A machine-readable steering error code. Clients should handle unknown
      values because additional codes may be introduced. Known values include:

      - `response_not_found`: The target response is not available on this connection.
      - `invalid_input`: The event or input failed validation.
      - `steering_not_supported`: The model or response execution mode does not support steering.
      - `too_many_pending_steers`: Too much steering input is pending for the response.
      - `response_already_completed`: The response completed and is no longer accepting steering input.
      - `response_not_active`: The response is no longer accepting steering input.
      - `successor_creation_failed`: The successor response could not be created.

      - `"response_not_found" or "invalid_input" or "steering_not_supported" or 4 more`

        A machine-readable steering error code. Clients should handle unknown
        values because additional codes may be introduced. Known values include:

        - `response_not_found`: The target response is not available on this connection.
        - `invalid_input`: The event or input failed validation.
        - `steering_not_supported`: The model or response execution mode does not support steering.
        - `too_many_pending_steers`: Too much steering input is pending for the response.
        - `response_already_completed`: The response completed and is no longer accepting steering input.
        - `response_not_active`: The response is no longer accepting steering input.
        - `successor_creation_failed`: The successor response could not be created.

        - `"response_not_found"`

        - `"invalid_input"`

        - `"steering_not_supported"`

        - `"too_many_pending_steers"`

        - `"response_already_completed"`

        - `"response_not_active"`

        - `"successor_creation_failed"`

      - `string`

    - `message: string`

      A human-readable description of the error.

    - `type: "invalid_request_error"`

      The error type. Always `invalid_request_error`.

      - `"invalid_request_error"`

  - `sequence_number: number`

    The sequence number for this event.

  - `steer: object { input, previous_response_id, id }`

    The steering submission that could not be committed.

    - `input: BetaResponseSteerInput`

      Input to queue for a continuation of the response. Uses the same string or
      input-item shape as `response.create.input`, with a non-empty array when
      supplying input items.

      Steering accepts only messages with the `user` role. Each message may
      contain only `type`, `role`, and `content`, with `content` as a string or an
      array of `input_text`, `input_image`, and `input_file` parts. The optional
      `type` must be `message`. Other roles, tool outputs, and item types are not
      supported for steering.

      - `TextInput = string`

        A text input, equivalent to a message with the `user` role.

      - `ResponseSteerInputItemList = array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

        A non-empty list of message inputs to queue for the response.

        - `Message object { content, role, type, 3 more }`

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent or string`

            The message content, as an array of content parts.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

            - `string`

              The message content, as a single string.

          - `role: "user"`

            The message role. Always `user`.

            - `"user"`

          - `type: "message"`

            The item type. Always `message`.

            - `"message"`

          - `id: optional string or null`

            The unique ID of this message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional string or null`

            The status of the message item.

        - `FunctionCallOutput object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

    - `previous_response_id: string`

      The ID of the response that was targeted for steering.

    - `id: optional string`

      The ID assigned to the steering submission, if one was allocated.

  - `type: "response.steer.failed"`

    The event discriminator. Always `response.steer.failed`.

    - `"response.steer.failed"`

  - `stream_id: optional string`

    The WebSocket lane that emitted this event, when the target response is
    available and its `response.create` event supplied a `stream_id`.

### Beta Response Steer Input

- `BetaResponseSteerInput = string or array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

  Input to queue for a continuation of the response. Uses the same string or
  input-item shape as `response.create.input`, with a non-empty array when
  supplying input items.

  Steering accepts only messages with the `user` role. Each message may
  contain only `type`, `role`, and `content`, with `content` as a string or an
  array of `input_text`, `input_image`, and `input_file` parts. The optional
  `type` must be `message`. Other roles, tool outputs, and item types are not
  supported for steering.

  - `TextInput = string`

    A text input, equivalent to a message with the `user` role.

  - `ResponseSteerInputItemList = array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

    A non-empty list of message inputs to queue for the response.

    - `Message object { content, role, type, 3 more }`

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent or string`

        The message content, as an array of content parts.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

        - `string`

          The message content, as a single string.

      - `role: "user"`

        The message role. Always `user`.

        - `"user"`

      - `type: "message"`

        The item type. Always `message`.

        - `"message"`

      - `id: optional string or null`

        The unique ID of this message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional string or null`

        The status of the message item.

    - `FunctionCallOutput object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `type: "function_call_output"`

        The type of the function tool call output. Always `function_call_output`.

        - `"function_call_output"`

      - `id: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        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 Steer Pending Event

- `BetaResponseSteerPendingEvent object { reason, required_input, sequence_number, 3 more }`

  Emitted when accepted steering input remains queued after the target
  response completes. The server still owns the input. Do not resend it.
  The successor's `response.created` event is the commit point.

  When `reason` is `waiting_for_required_input`, this event follows
  `response.completed` while the response waits for the tool results or
  approval decisions identified by `required_input`. Copy those stubs, fill
  their result fields using the ordinary `response.create` input schemas,
  and submit one continuation per parent with the same `previous_response_id`
  and WebSocket lane. Use saved results without rerunning tools. The queued
  steering input is prepended in submission order to the continuation's
  input. That explicit request retains its own settings.

  This notification is emitted at most once per steering submission. Multiple
  submissions for the same parent can report the same required inputs; they
  do not each require a separate continuation.

  - `reason: BetaResponseSteerPendingReason`

    An extensible enum describing why accepted steering input is still queued.
    Clients should handle unknown values because additional reasons may be
    introduced. Known values include:

    - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

    - `"waiting_for_required_input"`

      An extensible enum describing why accepted steering input is still queued.
      Clients should handle unknown values because additional reasons may be
      introduced. Known values include:

      - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

      - `"waiting_for_required_input"`

    - `string`

  - `required_input: array of BetaResponseSteerRequiredInput`

    Input stubs identifying outstanding client-owned tool results or
    approval decisions. Each stub contains identifying fields only; the
    client supplies the result before including it in `response.create`.

    - `FunctionCallOutput object { call_id, name, type }`

      Supply `output` using the function tool call output input schema.

      - `call_id: string`

      - `name: string`

      - `type: "function_call_output"`

        - `"function_call_output"`

    - `CustomToolCallOutput object { call_id, type }`

      Supply `output` using the custom tool call output input schema. The
      original custom tool call supplies the tool's name.

      - `call_id: string`

      - `type: "custom_tool_call_output"`

        - `"custom_tool_call_output"`

    - `ComputerCallOutput object { call_id, type }`

      Supply `output` using the computer tool call output input schema,
      including any required `acknowledged_safety_checks`.

      - `call_id: string`

      - `type: "computer_call_output"`

        - `"computer_call_output"`

    - `ShellCallOutput object { call_id, type }`

      Supply `output` using the shell tool call output input schema. Each
      output entry includes `stdout`, `stderr`, and `outcome`.

      - `call_id: string`

      - `type: "shell_call_output"`

        - `"shell_call_output"`

    - `ApplyPatchCallOutput object { call_id, type }`

      Supply `status` and optional `output` using the apply patch tool call
      output input schema.

      - `call_id: string`

      - `type: "apply_patch_call_output"`

        - `"apply_patch_call_output"`

    - `ToolSearchOutput object { call_id, execution, type }`

      Supply `tools` using the tool search output input schema, retaining
      `execution: "client"`.

      - `call_id: string`

      - `execution: "client"`

        - `"client"`

      - `type: "tool_search_output"`

        - `"tool_search_output"`

    - `McpApprovalResponse object { approval_request_id, type }`

      Supply `approve` using the MCP approval response input schema. An
      optional `reason` can be supplied when denying the request. The original
      approval request identifies the tool and server.

      - `approval_request_id: string`

      - `type: "mcp_approval_response"`

        - `"mcp_approval_response"`

  - `sequence_number: number`

    The sequence number for this event.

  - `steer: object { id, previous_response_id }`

    The steering submission that remains queued.

    - `id: string`

      The ID assigned to the steering submission.

    - `previous_response_id: string`

      The ID of the response being steered.

  - `type: "response.steer.pending"`

    The event discriminator. Always `response.steer.pending`.

    - `"response.steer.pending"`

  - `stream_id: optional string`

    The WebSocket lane that emitted this event. This field is present when
    the target response's `response.create` event supplied a `stream_id`.

### Beta Response Steer Pending Reason

- `BetaResponseSteerPendingReason = "waiting_for_required_input" or string`

  An extensible enum describing why accepted steering input is still queued.
  Clients should handle unknown values because additional reasons may be
  introduced. Known values include:

  - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

  - `"waiting_for_required_input"`

    An extensible enum describing why accepted steering input is still queued.
    Clients should handle unknown values because additional reasons may be
    introduced. Known values include:

    - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

    - `"waiting_for_required_input"`

  - `string`

### Beta Response Steer Required Input

- `BetaResponseSteerRequiredInput = FunctionCallOutput { call_id, name, type }  or CustomToolCallOutput { call_id, type }  or ComputerCallOutput { call_id, type }  or 4 more`

  An input stub identifying an outstanding client-owned tool result or
  approval decision. Copy the stub and fill the result fields using the
  corresponding `response.create` input schema. Use saved results without
  rerunning the tool. The server does not supply results, approval decisions,
  or safety acknowledgements in these stubs.

  - `FunctionCallOutput object { call_id, name, type }`

    Supply `output` using the function tool call output input schema.

    - `call_id: string`

    - `name: string`

    - `type: "function_call_output"`

      - `"function_call_output"`

  - `CustomToolCallOutput object { call_id, type }`

    Supply `output` using the custom tool call output input schema. The
    original custom tool call supplies the tool's name.

    - `call_id: string`

    - `type: "custom_tool_call_output"`

      - `"custom_tool_call_output"`

  - `ComputerCallOutput object { call_id, type }`

    Supply `output` using the computer tool call output input schema,
    including any required `acknowledged_safety_checks`.

    - `call_id: string`

    - `type: "computer_call_output"`

      - `"computer_call_output"`

  - `ShellCallOutput object { call_id, type }`

    Supply `output` using the shell tool call output input schema. Each
    output entry includes `stdout`, `stderr`, and `outcome`.

    - `call_id: string`

    - `type: "shell_call_output"`

      - `"shell_call_output"`

  - `ApplyPatchCallOutput object { call_id, type }`

    Supply `status` and optional `output` using the apply patch tool call
    output input schema.

    - `call_id: string`

    - `type: "apply_patch_call_output"`

      - `"apply_patch_call_output"`

  - `ToolSearchOutput object { call_id, execution, type }`

    Supply `tools` using the tool search output input schema, retaining
    `execution: "client"`.

    - `call_id: string`

    - `execution: "client"`

      - `"client"`

    - `type: "tool_search_output"`

      - `"tool_search_output"`

  - `McpApprovalResponse object { approval_request_id, type }`

    Supply `approve` using the MCP approval response input schema. An
    optional `reason` can be supplied when denying the request. The original
    approval request identifies the tool and server.

    - `approval_request_id: string`

    - `type: "mcp_approval_response"`

      - `"mcp_approval_response"`

### Beta Response Stream Event

- `BetaResponseStreamEvent = BetaResponseAudioDeltaEvent or BetaResponseAudioDoneEvent or BetaResponseAudioTranscriptDeltaEvent or 56 more`

  Event emitted while a response is streamed.

  - `BetaResponseAudioDeltaEvent object { delta, sequence_number, type, agent }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseAudioDoneEvent object { sequence_number, type, agent }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseAudioTranscriptDeltaEvent object { delta, sequence_number, type, agent }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseAudioTranscriptDoneEvent object { sequence_number, type, agent }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCodeInterpreterCallCodeDeltaEvent object { delta, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCodeInterpreterCallCodeDoneEvent object { code, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCodeInterpreterCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCodeInterpreterCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCodeInterpreterCallInterpretingEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCompactionCompactingEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCompletedEvent object { response, sequence_number, type, agent }`

    Emitted when the model response is complete.

    - `response: BetaResponse`

      Properties of the completed response.

      - `id: string`

        Unique identifier for this Response.

      - `access_programs: object { cyber }  or null`

        - `cyber: "standard" or "daybreak_blue" or "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.

      - `error: BetaResponseError or null`

        An error object returned when the model fails to generate a Response.

        - `code: "server_error" or "rate_limit_exceeded" or "invalid_prompt" or 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: optional object { detailed_explanation, error_type, review_target, steer }`

          - `detailed_explanation: optional string`

            The public explanation for this block.

          - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `string`

            - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

              An optional classification; clients must accept additional values.

              - `"potentially_unintended_data_transfer"`

              - `"potentially_unintended_data_access"`

              - `"potentially_unintended_destructive_activity"`

              - `"other"`

          - `review_target: optional string or null`

            An opaque target for explicitly continuing this review, or null when unavailable.

          - `steer: optional object { message }`

            An optional public continuation instruction.

            - `message: string`

              The public continuation instruction.

        - `param: optional string or null`

          The request parameter associated with the error, or null if none was recorded.

        - `type: optional string or null`

          The original error type, or null if it was not recorded.

      - `incomplete_details: object { reason }  or null`

        Details about why the response is incomplete.

        - `reason: optional "max_output_tokens" or "max_messages" or "content_filter" or "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 or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or 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`

          A text input to the model, equivalent to a text input with the
          `developer` role.

        - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

          A list of one or many input items to the model, containing
          different content types.

          - `BetaEasyInputMessage object { content, role, phase, type }`

            A message input to the model with a role indicating instruction following
            hierarchy. Instructions given with the `developer` or `system` role take
            precedence over instructions given with the `user` role. Messages with the
            `assistant` role are presumed to have been generated by the model in previous
            interactions.

            - `content: string or BetaResponseInputMessageContentList`

              Text, image, or audio input to the model, used to generate a response.
              Can also contain previous assistant responses.

              - `TextInput = string`

                A text input to the model.

              - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

                A list of one or many input items to the model, containing different content
                types.

                - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                  A text input to the model.

                  - `text: string`

                    The text input to the model.

                  - `type: "input_text"`

                    The type of the input item. Always `input_text`.

                    - `"input_text"`

                  - `prompt_cache_breakpoint: optional object { mode }`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                  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: optional string or null`

                    The ID of the file to be sent to the model.

                  - `image_url: optional string or null`

                    The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                  - `prompt_cache_breakpoint: optional object { mode }`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                  A file input to the model.

                  - `type: "input_file"`

                    The type of the input item. Always `input_file`.

                    - `"input_file"`

                  - `detail: optional "auto" or "low" or "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: optional string`

                    The content of the file to be sent to the model.

                  - `file_id: optional string or null`

                    The ID of the file to be sent to the model.

                  - `file_url: optional string`

                    The URL of the file to be sent to the model.

                  - `filename: optional string`

                    The name of the file to be sent to the model.

                  - `prompt_cache_breakpoint: optional object { mode }`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

            - `role: "user" or "assistant" or "system" or "developer"`

              The role of the message input. One of `user`, `assistant`, `system`, or
              `developer`.

              - `"user"`

              - `"assistant"`

              - `"system"`

              - `"developer"`

            - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

              The type of the message input. Always `message`.

              - `"message"`

          - `Message object { content, role, agent, 2 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.

            - `content: BetaResponseInputMessageContentList`

              A list of one or many input items to the model, containing different content
              types.

            - `role: "user" or "system" or "developer"`

              The role of the message input. One of `user`, `system`, or `developer`.

              - `"user"`

              - `"system"`

              - `"developer"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `status: optional "in_progress" or "completed" or "incomplete"`

              The status of item. One of `in_progress`, `completed`, or
              `incomplete`. Populated when items are returned via API.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

            - `type: optional "message"`

              The type of the message input. Always set to `message`.

              - `"message"`

          - `BetaResponseOutputMessage object { id, content, role, 4 more }`

            An output message from the model.

            - `id: string`

              The unique ID of the output message.

            - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

              The content of the output message.

              - `BetaResponseOutputText object { annotations, logprobs, text, type }`

                A text output from the model.

                - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                  The annotations of the text output.

                  - `FileCitation object { file_id, filename, index, type }`

                    A citation to a file.

                    - `file_id: string`

                      The ID of the file.

                    - `filename: string`

                      The filename of the file cited.

                    - `index: number`

                      The index 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 object { end_index, start_index, title, 2 more }`

                    A citation for a web resource used to generate a model response.

                    - `end_index: number`

                      The index of the last character of the URL citation in the message.

                    - `start_index: number`

                      The index of the first character of the URL citation in the message.

                    - `title: string`

                      The title of the web resource.

                    - `type: "url_citation"`

                      The type of the URL citation. Always `url_citation`.

                      - `"url_citation"`

                    - `url: string`

                      The URL of the web resource.

                  - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                    A citation for a container file used to generate a model response.

                    - `container_id: string`

                      The ID of the container file.

                    - `end_index: number`

                      The index of the last character of the container file citation in the message.

                    - `file_id: string`

                      The ID of the file.

                    - `filename: string`

                      The filename of the container file cited.

                    - `start_index: number`

                      The index of the first character of the container file citation in the message.

                    - `type: "container_file_citation"`

                      The type of the container file citation. Always `container_file_citation`.

                      - `"container_file_citation"`

                  - `FilePath object { file_id, index, type }`

                    A path to a file.

                    - `file_id: string`

                      The ID of the file.

                    - `index: number`

                      The index of the file in the list of files.

                    - `type: "file_path"`

                      The type of the file path. Always `file_path`.

                      - `"file_path"`

                - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

                  - `top_logprobs: array of object { token, bytes, logprob }`

                    - `token: string`

                    - `bytes: array of number`

                    - `logprob: number`

                - `text: string`

                  The text output from the model.

                - `type: "output_text"`

                  The type of the output text. Always `output_text`.

                  - `"output_text"`

              - `BetaResponseOutputRefusal object { refusal, type }`

                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" or "completed" or "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: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `phase: optional "commentary" or "final_answer" or 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"`

          - `FileSearchCall object { id, queries, status, 3 more }`

            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 of string`

              The queries used to search for files.

            - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

              The results of the file search tool call.

              - `attributes: optional map[string or number or boolean] or 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: optional string`

                The unique ID of the file.

              - `filename: optional string`

                The name of the file.

              - `score: optional number`

                The relevance score of the file - a value between 0 and 1.

              - `text: optional string`

                The text that was retrieved from the file.

          - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

            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 of object { id, code, message }`

              The pending safety checks for the computer call.

              - `id: string`

                The ID of the pending safety check.

              - `code: optional string or null`

                The type of the pending safety check.

              - `message: optional string or null`

                Details about the pending safety check.

            - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

              A click action.

              - `Click object { button, type, x, 2 more }`

                A click action.

                - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                  The keys being held while clicking.

              - `DoubleClick object { keys, type, x, y }`

                A double click action.

                - `keys: array of string or 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 object { path, type, keys }`

                A drag action.

                - `path: array of object { x, y }`

                  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: optional array of string or null`

                  The keys being held while dragging the mouse.

              - `Keypress object { keys, type }`

                A collection of keypresses the model would like to perform.

                - `keys: array of 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 object { type, x, y, keys }`

                A mouse move action.

                - `type: "move"`

                  Specifies the event type. For a move action, this property is always set to `move`.

                  - `"move"`

                - `x: number`

                  The x-coordinate to move to.

                - `y: number`

                  The y-coordinate to move to.

                - `keys: optional array of string or null`

                  The keys being held while moving the mouse.

              - `Screenshot object { type }`

                A screenshot action.

                - `type: "screenshot"`

                  Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                  - `"screenshot"`

              - `Scroll object { scroll_x, scroll_y, type, 3 more }`

                A scroll action.

                - `scroll_x: number`

                  The horizontal scroll distance.

                - `scroll_y: number`

                  The vertical scroll distance.

                - `type: "scroll"`

                  Specifies the event type. For a scroll action, this property is always set to `scroll`.

                  - `"scroll"`

                - `x: number`

                  The x-coordinate where the scroll occurred.

                - `y: number`

                  The y-coordinate where the scroll occurred.

                - `keys: optional array of string or null`

                  The keys being held while scrolling.

              - `Type object { text, type }`

                An action to type in text.

                - `text: string`

                  The text to type.

                - `type: "type"`

                  Specifies the event type. For a type action, this property is always set to `type`.

                  - `"type"`

              - `Wait object { type }`

                A wait action.

                - `type: "wait"`

                  Specifies the event type. For a wait action, this property is always set to `wait`.

                  - `"wait"`

            - `actions: optional BetaComputerActionList`

              Flattened batched actions for `computer_use`. Each action includes an
              `type` discriminator and action-specific fields.

              - `Click object { button, type, x, 2 more }`

                A click action.

              - `DoubleClick object { keys, type, x, y }`

                A double click action.

              - `Drag object { path, type, keys }`

                A drag action.

              - `Keypress object { keys, type }`

                A collection of keypresses the model would like to perform.

              - `Move object { type, x, y, keys }`

                A mouse move action.

              - `Screenshot object { type }`

                A screenshot action.

              - `Scroll object { scroll_x, scroll_y, type, 3 more }`

                A scroll action.

              - `Type object { text, type }`

                An action to type in text.

              - `Wait object { type }`

                A wait action.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ComputerCallOutput object { call_id, output, type, 4 more }`

            The output of a computer tool call.

            - `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: optional string`

                The identifier of an uploaded file that contains the screenshot.

              - `image_url: optional string`

                The URL of the screenshot image.

            - `type: "computer_call_output"`

              The type of the computer tool call output. Always `computer_call_output`.

              - `"computer_call_output"`

            - `id: optional string or null`

              The ID of the computer tool call output.

            - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

                The type of the pending safety check.

              - `message: optional string or null`

                Details about the pending safety check.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

          - `WebSearchCall object { id, status, type, 2 more }`

            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.

            - `status: "in_progress" or "searching" or "completed" or 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"`

            - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

              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 object { type, queries, query, sources }`

                Action type "search" - Performs a web search query.

                - `type: "search"`

                  The action type.

                  - `"search"`

                - `queries: optional array of string`

                  The search queries.

                - `query: optional string`

                  The search query.

                - `sources: optional array of object { type, url }`

                  The sources used in the search.

                  - `type: "url"`

                    The type of source. Always `url`.

                    - `"url"`

                  - `url: string`

                    The URL of the source.

              - `OpenPage object { type, url }`

                Action type "open_page" - Opens a specific URL from search results.

                - `type: "open_page"`

                  The action type.

                  - `"open_page"`

                - `url: optional string or null`

                  The URL opened by the model.

              - `FindInPage object { pattern, type, url }`

                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: optional string or null`

                  The URL of the page searched for the pattern, when available.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `FunctionCall object { arguments, call_id, name, 7 more }`

            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: optional string`

              The unique ID of the function tool call.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `async: optional boolean`

              Whether the function tool call runs asynchronously.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  - `"program"`

            - `namespace: optional string`

              The namespace of the function to run.

            - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

            The output of a function tool call.

            - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              Text, image, or file output of the function tool call.

              - `string`

                A JSON string of the output of the function tool call.

              - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

                An array of content outputs (text, image, file) for the function tool call.

                - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                  A text input to the model.

                  - `text: string`

                    The text input to the model.

                  - `type: "input_text"`

                    The type of the input item. Always `input_text`.

                    - `"input_text"`

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "12h"`

                      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                      - `"30m"`

                      - `"12h"`

                - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                  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: optional BetaImageDetail or 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: optional string or null`

                    The ID of the file to be sent to the model.

                  - `image_url: optional string or null`

                    The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "12h"`

                      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                      - `"30m"`

                      - `"12h"`

                - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                  A file input to the model.

                  - `type: "input_file"`

                    The type of the input item. Always `input_file`.

                    - `"input_file"`

                  - `detail: optional "auto" or "low" or "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: optional string or null`

                    The base64-encoded data of the file to be sent to the model.

                  - `file_id: optional string or null`

                    The ID of the file to be sent to the model.

                  - `file_url: optional string or null`

                    The URL of the file to be sent to the model.

                  - `filename: optional string or null`

                    The name of the file to be sent to the model.

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "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: optional string or null`

              The unique ID of the function tool call output. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `call_id: optional string or null`

              The unique ID of the function tool call generated by the model.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

            - `name: optional string or null`

              The name of the tool that produced the output.

            - `namespace: optional string or null`

              The namespace of the tool that produced the output.

            - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

            A message routed between agents.

            - `author: string`

              The sending agent identity.

            - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

              Plaintext, image, or encrypted content sent between agents.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `EncryptedContent object { encrypted_content, type }`

                Opaque encrypted content that Responses API decrypts inside trusted model execution.

                - `encrypted_content: string`

                  Opaque encrypted content.

                - `type: "encrypted_content"`

                  The type of the input item. Always `encrypted_content`.

                  - `"encrypted_content"`

            - `recipient: string`

              The destination agent identity.

            - `type: "agent_message"`

              The item type. Always `agent_message`.

              - `"agent_message"`

            - `id: optional string or null`

              The unique ID of this agent message item.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `MultiAgentCall object { action, arguments, call_id, 3 more }`

            - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

            - `type: "multi_agent_call"`

              The item type. Always `multi_agent_call`.

              - `"multi_agent_call"`

            - `id: optional string or null`

              The unique ID of this multi-agent call.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

            - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

              Text output returned by the multi-agent action.

              - `text: string`

                The text content.

              - `type: "output_text"`

                The content type. Always `output_text`.

                - `"output_text"`

              - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

                Citations associated with the text content.

                - `FileCitation object { file_id, filename, index, type }`

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_citation"`

                    The citation type. Always `file_citation`.

                    - `"file_citation"`

                - `URLCitation object { end_index, start_index, title, 2 more }`

                  - `end_index: number`

                    The index of the last character of the citation in the message.

                  - `start_index: number`

                    The index of the first character of the citation in the message.

                  - `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.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  - `container_id: string`

                    The ID of the container.

                  - `end_index: number`

                    The index of the last character of the citation in the message.

                  - `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.

                  - `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: optional string or null`

              The unique ID of this multi-agent call output.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ToolSearchCall object { arguments, type, id, 4 more }`

            - `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: optional string or null`

              The unique ID of this tool search call.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `call_id: optional string or null`

              The unique ID of the tool search call generated by the model.

            - `execution: optional "server" or "client"`

              Whether tool search was executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the tool search call.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `ToolSearchOutput object { tools, type, id, 4 more }`

            - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

              The loaded tool definitions returned by the tool search output.

              - `Function object { name, parameters, strict, 6 more }`

                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: map[unknown] or null`

                  A JSON schema object describing the parameters of the function.

                - `strict: boolean or null`

                  Whether strict parameter validation is enforced for this function tool.

                - `type: "function"`

                  The type of the function tool. Always `function`.

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                - `defer_loading: optional boolean`

                  Whether this function is deferred and loaded via tool search.

                - `description: optional string or null`

                  A description of the function. Used by the model to determine whether or not to call the function.

                - `output_schema: optional map[unknown] or null`

                  A JSON schema object describing the JSON value encoded in string outputs for this function.

              - `FileSearch object { type, vector_store_ids, filters, 2 more }`

                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 of string`

                  The IDs of the vector stores to search.

                - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                  A filter to apply.

                  - `ComparisonFilter object { key, type, value }`

                    A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                    - `key: string`

                      The key to compare against the value.

                    - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                      The value to compare against the attribute key; supports string, number, or boolean types.

                      - `string`

                      - `number`

                      - `boolean`

                      - `array of string or number`

                        - `string`

                        - `number`

                  - `BetaCompoundFilter = unknown`

                    Combine multiple filters using `and` or `or`.

                - `max_num_results: optional number`

                  The maximum number of results to return. This number should be between 1 and 50 inclusive.

                - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                  Ranking options for search.

                  - `hybrid_search: optional object { embedding_weight, text_weight }`

                    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: optional "auto" or "default-2024-11-15"`

                    The ranker to use for the file search.

                    - `"auto"`

                    - `"default-2024-11-15"`

                  - `score_threshold: optional 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.

              - `Computer object { type }`

                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"`

              - `ComputerUsePreview object { display_height, display_width, environment, type }`

                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" or "mac" or "linux" or 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"`

              - `WebSearch object { type, external_web_access, filters, 2 more }`

                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" or "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: optional 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: optional object { allowed_domains }  or null`

                  Filters for the search.

                  - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                    Free text input for the city of the user, e.g. `San Francisco`.

                  - `country: optional string or null`

                    The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                  - `region: optional string or null`

                    Free text input for the region of the user, e.g. `California`.

                  - `timezone: optional string or null`

                    The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                  - `type: optional "approximate"`

                    The type of location approximation. Always `approximate`.

                    - `"approximate"`

              - `Mcp object { server_label, type, allowed_callers, 9 more }`

                Give the model access to additional tools via remote Model Context Protocol
                (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                  List of allowed tool names or a filter object.

                  - `McpAllowedTools = array of string`

                    A string array of allowed tool names

                  - `McpToolFilter object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                  Whether this MCP tool is deferred and discovered via tool search.

                - `headers: optional map[string] or null`

                  Optional HTTP headers to send to the MCP server. Use for authentication
                  or other purposes.

                - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                  Specify which of the MCP server's tools require approval.

                  - `McpToolApprovalFilter object { always, never }`

                    Specify which of the MCP server's tools require approval. Can be
                    `always`, `never`, or a filter object associated with tools
                    that require approval.

                    - `always: optional object { read_only, tool_names }`

                      A filter object to specify which tools are allowed.

                      - `read_only: optional 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: optional array of string`

                        List of allowed tool names.

                    - `never: optional object { read_only, tool_names }`

                      A filter object to specify which tools are allowed.

                      - `read_only: optional 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: optional array of string`

                        List of allowed tool names.

                  - `McpToolApprovalSetting = "always" or "never"`

                    Specify a single approval policy for all tools. One of `always` or
                    `never`. When set to `always`, all tools will require approval. When
                    set to `never`, all tools will not require approval.

                    - `"always"`

                    - `"never"`

                - `server_description: optional string`

                  Optional description of the MCP server, used to provide more context.

                - `server_url: optional string`

                  The URL for the MCP server. One of `server_url`, `connector_id`, or
                  `tunnel_id` must be provided.

                - `tunnel_id: optional 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 object { container, type, allowed_callers }`

                A tool that runs Python code to help generate a response to a prompt.

                - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                  The code interpreter container. Can be a container ID or an object that
                  specifies uploaded file IDs to make available to your code, along with an
                  optional `memory_limit` setting.

                  - `string`

                    The container ID.

                  - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                    Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                    - `type: "auto"`

                      Always `auto`.

                      - `"auto"`

                    - `file_ids: optional array of string`

                      An optional list of uploaded files to make available to your code.

                    - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                      The memory limit for the code interpreter container.

                      - `"1g"`

                      - `"4g"`

                      - `"16g"`

                      - `"64g"`

                    - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                      Network access policy for the container.

                      - `BetaContainerNetworkPolicyDisabled object { type }`

                        - `type: "disabled"`

                          Disable outbound network access. Always `disabled`.

                          - `"disabled"`

                      - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                        - `allowed_domains: array of string`

                          A list of allowed domains when type is `allowlist`.

                        - `type: "allowlist"`

                          Allow outbound network access only to specified domains. Always `allowlist`.

                          - `"allowlist"`

                        - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                          Optional domain-scoped secrets for allowlisted domains.

                          - `domain: string`

                            The domain associated with the secret.

                          - `name: string`

                            The name of the secret to inject for the domain.

                          - `value: string`

                            The secret value to inject for the domain.

                - `type: "code_interpreter"`

                  The type of the code interpreter tool. Always `code_interpreter`.

                  - `"code_interpreter"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

              - `ProgrammaticToolCalling object { type }`

                - `type: "programmatic_tool_calling"`

                  The type of the tool. Always `programmatic_tool_calling`.

                  - `"programmatic_tool_calling"`

              - `ImageGeneration object { type, action, background, 9 more }`

                A tool that generates images using the GPT image models.

                - `type: "image_generation"`

                  The type of the image generation tool. Always `image_generation`.

                  - `"image_generation"`

                - `action: optional "generate" or "edit" or "auto"`

                  Whether to generate a new image or edit an existing image. Default: `auto`.

                  - `"generate"`

                  - `"edit"`

                  - `"auto"`

                - `background: optional "transparent" or "opaque" or "auto"`

                  Set the background of the generated image. One of `transparent`, `opaque`,
                  or `auto`. `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`.
                  Default: `auto`.

                  - `"transparent"`

                  - `"opaque"`

                  - `"auto"`

                - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                  Optional mask for inpainting. Contains `image_url`
                  (string, optional) and `file_id` (string, optional).

                  - `file_id: optional string`

                    File ID for the mask image.

                  - `image_url: optional string`

                    Base64-encoded mask image.

                - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `string`

                  - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                    The image generation model to use. One of `gpt-image-1`,
                    `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`, or `chatgpt-image-latest`. Default:
                    `gpt-image-1`.

                    - `"gpt-image-1"`

                    - `"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"`

                - `moderation: optional "auto" or "low"`

                  Moderation level for the generated image. Default: `auto`.

                  - `"auto"`

                  - `"low"`

                - `output_compression: optional number`

                  Compression level for the output image. Default: 100.

                - `output_format: optional "png" or "webp" or "jpeg"`

                  The output format of the generated image. One of `png`, `webp`, or
                  `jpeg`. Default: `png`.

                  - `"png"`

                  - `"webp"`

                  - `"jpeg"`

                - `partial_images: optional number`

                  Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                    - `"1024x1024"`

                    - `"1024x1536"`

                    - `"1536x1024"`

                    - `"auto"`

              - `LocalShell object { type }`

                A tool that allows the model to execute shell commands in a local environment.

                - `type: "local_shell"`

                  The type of the local shell tool. Always `local_shell`.

                  - `"local_shell"`

              - `Shell object { type, allowed_callers, environment }`

                A tool that allows the model to execute shell commands.

                - `type: "shell"`

                  The type of the shell tool. Always `shell`.

                  - `"shell"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                  - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                    - `type: "container_auto"`

                      Automatically creates a container for this request

                      - `"container_auto"`

                    - `file_ids: optional array of string`

                      An optional list of uploaded files to make available to your code.

                    - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                      The memory limit for the container.

                      - `"1g"`

                      - `"4g"`

                      - `"16g"`

                      - `"64g"`

                    - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                      Network access policy for the container.

                      - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                      An optional list of skills referenced by id or inline data.

                      - `BetaSkillReference object { skill_id, type, version }`

                        - `skill_id: string`

                          The ID of the referenced skill.

                        - `type: "skill_reference"`

                          References a skill created with the /v1/skills endpoint.

                          - `"skill_reference"`

                        - `version: optional string`

                          Optional skill version. Use a positive integer or 'latest'. Omit for default.

                      - `BetaInlineSkill object { description, name, source, type }`

                        - `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.

                          - `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 object { type, skills }`

                    - `type: "local"`

                      Use a local computer environment.

                      - `"local"`

                    - `skills: optional array of BetaLocalSkill`

                      An optional list of skills.

                      - `description: string`

                        The description of the skill.

                      - `name: string`

                        The name of the skill.

                      - `path: string`

                        The path to the directory containing the skill.

                  - `BetaContainerReference object { container_id, type }`

                    - `container_id: string`

                      The ID of the referenced container.

                    - `type: "container_reference"`

                      References a container created with the /v1/containers endpoint

                      - `"container_reference"`

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "regex"`

                      The syntax of the grammar definition. One of `lark` or `regex`.

                      - `"lark"`

                      - `"regex"`

                    - `type: "grammar"`

                      Grammar format. Always `grammar`.

                      - `"grammar"`

              - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

                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`).

                - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                  The function/custom tools loaded inside this namespace.

                  - `Function object { name, type, allowed_callers, 6 more }`

                    - `name: string`

                      The name of the loaded function tool.

                    - `type: "function"`

                      - `"function"`

                    - `allowed_callers: optional array of "direct" or "programmatic" or null`

                      The tool invocation context(s).

                      - `"direct"`

                      - `"programmatic"`

                    - `async: optional boolean`

                      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                    - `defer_loading: optional boolean`

                      Whether this function should be deferred and discovered via tool search.

                    - `description: optional string or null`

                    - `output_schema: optional map[unknown] or null`

                      A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                    - `parameters: optional unknown or null`

                    - `strict: optional boolean or 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.

                  - `Custom object { name, type, allowed_callers, 4 more }`

                    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: optional array of "direct" or "programmatic" or null`

                      The tool invocation context(s).

                      - `"direct"`

                      - `"programmatic"`

                    - `async: optional boolean`

                      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                    - `defer_loading: optional boolean`

                      Whether this tool should be deferred and discovered via tool search.

                    - `description: optional string`

                      Optional description of the custom tool, used to provide more context.

                    - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                      The input format for the custom tool. Default is unconstrained text.

                      - `Text object { type }`

                        Unconstrained free-form text.

                        - `type: "text"`

                          Unconstrained text format. Always `text`.

                          - `"text"`

                      - `Grammar object { definition, syntax, type }`

                        A grammar defined by the user.

                        - `definition: string`

                          The grammar definition.

                        - `syntax: "lark" or "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"`

              - `ToolSearch object { type, description, execution, parameters }`

                Hosted or BYOT tool search configuration for deferred tools.

                - `type: "tool_search"`

                  The type of the tool. Always `tool_search`.

                  - `"tool_search"`

                - `description: optional string or null`

                  Description shown to the model for a client-executed tool search tool.

                - `execution: optional "server" or "client"`

                  Whether tool search is executed by the server or by the client.

                  - `"server"`

                  - `"client"`

                - `parameters: optional unknown or null`

                  Parameter schema for a client-executed tool search tool.

              - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

                This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

                - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                  - `"text"`

                  - `"image"`

                - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                    Free text input for the city of the user, e.g. `San Francisco`.

                  - `country: optional string or null`

                    The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                  - `region: optional string or null`

                    Free text input for the region of the user, e.g. `California`.

                  - `timezone: optional string or null`

                    The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `ApplyPatch object { type, allowed_callers }`

                Allows the assistant to create, delete, or update files using unified diffs.

                - `type: "apply_patch"`

                  The type of the tool. Always `apply_patch`.

                  - `"apply_patch"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

            - `type: "tool_search_output"`

              The item type. Always `tool_search_output`.

              - `"tool_search_output"`

            - `id: optional string or null`

              The unique ID of this tool search output.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `call_id: optional string or null`

              The unique ID of the tool search call generated by the model.

            - `execution: optional "server" or "client"`

              Whether tool search was executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the tool search output.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `AdditionalTools object { role, tools, type, 2 more }`

            - `role: "developer"`

              The role that provided the additional tools. Only `developer` is supported.

              - `"developer"`

            - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

              A list of additional tools made available at this item.

              - `Function object { name, parameters, strict, 6 more }`

                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: map[unknown] or null`

                  A JSON schema object describing the parameters of the function.

                - `strict: boolean or null`

                  Whether strict parameter validation is enforced for this function tool.

                - `type: "function"`

                  The type of the function tool. Always `function`.

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                - `defer_loading: optional boolean`

                  Whether this function is deferred and loaded via tool search.

                - `description: optional string or null`

                  A description of the function. Used by the model to determine whether or not to call the function.

                - `output_schema: optional map[unknown] or null`

                  A JSON schema object describing the JSON value encoded in string outputs for this function.

              - `FileSearch object { type, vector_store_ids, filters, 2 more }`

                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 of string`

                  The IDs of the vector stores to search.

                - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                  A filter to apply.

                  - `ComparisonFilter object { key, type, value }`

                    A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                    - `key: string`

                      The key to compare against the value.

                    - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                      The value to compare against the attribute key; supports string, number, or boolean types.

                      - `string`

                      - `number`

                      - `boolean`

                      - `array of string or number`

                        - `string`

                        - `number`

                  - `BetaCompoundFilter = unknown`

                    Combine multiple filters using `and` or `or`.

                - `max_num_results: optional number`

                  The maximum number of results to return. This number should be between 1 and 50 inclusive.

                - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                  Ranking options for search.

                  - `hybrid_search: optional object { embedding_weight, text_weight }`

                    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: optional "auto" or "default-2024-11-15"`

                    The ranker to use for the file search.

                    - `"auto"`

                    - `"default-2024-11-15"`

                  - `score_threshold: optional 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.

              - `Computer object { type }`

                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"`

              - `ComputerUsePreview object { display_height, display_width, environment, type }`

                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" or "mac" or "linux" or 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"`

              - `WebSearch object { type, external_web_access, filters, 2 more }`

                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" or "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: optional 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: optional object { allowed_domains }  or null`

                  Filters for the search.

                  - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                    Free text input for the city of the user, e.g. `San Francisco`.

                  - `country: optional string or null`

                    The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                  - `region: optional string or null`

                    Free text input for the region of the user, e.g. `California`.

                  - `timezone: optional string or null`

                    The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                  - `type: optional "approximate"`

                    The type of location approximation. Always `approximate`.

                    - `"approximate"`

              - `Mcp object { server_label, type, allowed_callers, 9 more }`

                Give the model access to additional tools via remote Model Context Protocol
                (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                  List of allowed tool names or a filter object.

                  - `McpAllowedTools = array of string`

                    A string array of allowed tool names

                  - `McpToolFilter object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                  Whether this MCP tool is deferred and discovered via tool search.

                - `headers: optional map[string] or null`

                  Optional HTTP headers to send to the MCP server. Use for authentication
                  or other purposes.

                - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                  Specify which of the MCP server's tools require approval.

                  - `McpToolApprovalFilter object { always, never }`

                    Specify which of the MCP server's tools require approval. Can be
                    `always`, `never`, or a filter object associated with tools
                    that require approval.

                    - `always: optional object { read_only, tool_names }`

                      A filter object to specify which tools are allowed.

                      - `read_only: optional 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: optional array of string`

                        List of allowed tool names.

                    - `never: optional object { read_only, tool_names }`

                      A filter object to specify which tools are allowed.

                      - `read_only: optional 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: optional array of string`

                        List of allowed tool names.

                  - `McpToolApprovalSetting = "always" or "never"`

                    Specify a single approval policy for all tools. One of `always` or
                    `never`. When set to `always`, all tools will require approval. When
                    set to `never`, all tools will not require approval.

                    - `"always"`

                    - `"never"`

                - `server_description: optional string`

                  Optional description of the MCP server, used to provide more context.

                - `server_url: optional string`

                  The URL for the MCP server. One of `server_url`, `connector_id`, or
                  `tunnel_id` must be provided.

                - `tunnel_id: optional 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 object { container, type, allowed_callers }`

                A tool that runs Python code to help generate a response to a prompt.

                - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                  The code interpreter container. Can be a container ID or an object that
                  specifies uploaded file IDs to make available to your code, along with an
                  optional `memory_limit` setting.

                  - `string`

                    The container ID.

                  - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                    Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                    - `type: "auto"`

                      Always `auto`.

                      - `"auto"`

                    - `file_ids: optional array of string`

                      An optional list of uploaded files to make available to your code.

                    - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                      The memory limit for the code interpreter container.

                      - `"1g"`

                      - `"4g"`

                      - `"16g"`

                      - `"64g"`

                    - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                      Network access policy for the container.

                      - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `type: "code_interpreter"`

                  The type of the code interpreter tool. Always `code_interpreter`.

                  - `"code_interpreter"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

              - `ProgrammaticToolCalling object { type }`

                - `type: "programmatic_tool_calling"`

                  The type of the tool. Always `programmatic_tool_calling`.

                  - `"programmatic_tool_calling"`

              - `ImageGeneration object { type, action, background, 9 more }`

                A tool that generates images using the GPT image models.

                - `type: "image_generation"`

                  The type of the image generation tool. Always `image_generation`.

                  - `"image_generation"`

                - `action: optional "generate" or "edit" or "auto"`

                  Whether to generate a new image or edit an existing image. Default: `auto`.

                  - `"generate"`

                  - `"edit"`

                  - `"auto"`

                - `background: optional "transparent" or "opaque" or "auto"`

                  Set the background of the generated image. One of `transparent`, `opaque`,
                  or `auto`. `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`.
                  Default: `auto`.

                  - `"transparent"`

                  - `"opaque"`

                  - `"auto"`

                - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                  Optional mask for inpainting. Contains `image_url`
                  (string, optional) and `file_id` (string, optional).

                  - `file_id: optional string`

                    File ID for the mask image.

                  - `image_url: optional string`

                    Base64-encoded mask image.

                - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `string`

                  - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                    The image generation model to use. One of `gpt-image-1`,
                    `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`, or `chatgpt-image-latest`. Default:
                    `gpt-image-1`.

                    - `"gpt-image-1"`

                    - `"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"`

                - `moderation: optional "auto" or "low"`

                  Moderation level for the generated image. Default: `auto`.

                  - `"auto"`

                  - `"low"`

                - `output_compression: optional number`

                  Compression level for the output image. Default: 100.

                - `output_format: optional "png" or "webp" or "jpeg"`

                  The output format of the generated image. One of `png`, `webp`, or
                  `jpeg`. Default: `png`.

                  - `"png"`

                  - `"webp"`

                  - `"jpeg"`

                - `partial_images: optional number`

                  Number of partial images to generate in streaming mode, from 0 (default value) to 3.

                - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                    - `"1024x1024"`

                    - `"1024x1536"`

                    - `"1536x1024"`

                    - `"auto"`

              - `LocalShell object { type }`

                A tool that allows the model to execute shell commands in a local environment.

                - `type: "local_shell"`

                  The type of the local shell tool. Always `local_shell`.

                  - `"local_shell"`

              - `Shell object { type, allowed_callers, environment }`

                A tool that allows the model to execute shell commands.

                - `type: "shell"`

                  The type of the shell tool. Always `shell`.

                  - `"shell"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                  - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `BetaLocalEnvironment object { type, skills }`

                  - `BetaContainerReference object { container_id, type }`

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "regex"`

                      The syntax of the grammar definition. One of `lark` or `regex`.

                      - `"lark"`

                      - `"regex"`

                    - `type: "grammar"`

                      Grammar format. Always `grammar`.

                      - `"grammar"`

              - `Namespace object { description, name, tools, type }`

                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`).

                - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                  The function/custom tools available inside this namespace.

                  - `Function object { name, type, allowed_callers, 6 more }`

                    - `name: string`

                    - `type: "function"`

                      - `"function"`

                    - `allowed_callers: optional array of "direct" or "programmatic" or null`

                      The tool invocation context(s).

                      - `"direct"`

                      - `"programmatic"`

                    - `async: optional boolean`

                      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                    - `defer_loading: optional boolean`

                      Whether this function should be deferred and discovered via tool search.

                    - `description: optional string or null`

                    - `output_schema: optional map[unknown] or null`

                      A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                    - `parameters: optional unknown or null`

                    - `strict: optional boolean or 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.

                  - `Custom object { name, type, allowed_callers, 4 more }`

                    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: optional array of "direct" or "programmatic" or null`

                      The tool invocation context(s).

                      - `"direct"`

                      - `"programmatic"`

                    - `async: optional boolean`

                      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                    - `defer_loading: optional boolean`

                      Whether this tool should be deferred and discovered via tool search.

                    - `description: optional string`

                      Optional description of the custom tool, used to provide more context.

                    - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                      The input format for the custom tool. Default is unconstrained text.

                      - `Text object { type }`

                        Unconstrained free-form text.

                        - `type: "text"`

                          Unconstrained text format. Always `text`.

                          - `"text"`

                      - `Grammar object { definition, syntax, type }`

                        A grammar defined by the user.

                        - `definition: string`

                          The grammar definition.

                        - `syntax: "lark" or "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"`

              - `ToolSearch object { type, description, execution, parameters }`

                Hosted or BYOT tool search configuration for deferred tools.

                - `type: "tool_search"`

                  The type of the tool. Always `tool_search`.

                  - `"tool_search"`

                - `description: optional string or null`

                  Description shown to the model for a client-executed tool search tool.

                - `execution: optional "server" or "client"`

                  Whether tool search is executed by the server or by the client.

                  - `"server"`

                  - `"client"`

                - `parameters: optional unknown or null`

                  Parameter schema for a client-executed tool search tool.

              - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

                This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

                - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                  - `"text"`

                  - `"image"`

                - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                    Free text input for the city of the user, e.g. `San Francisco`.

                  - `country: optional string or null`

                    The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                  - `region: optional string or null`

                    Free text input for the region of the user, e.g. `California`.

                  - `timezone: optional string or null`

                    The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `ApplyPatch object { type, allowed_callers }`

                Allows the assistant to create, delete, or update files using unified diffs.

                - `type: "apply_patch"`

                  The type of the tool. Always `apply_patch`.

                  - `"apply_patch"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

            - `type: "additional_tools"`

              The item type. Always `additional_tools`.

              - `"additional_tools"`

            - `id: optional string or null`

              The unique ID of this additional tools item.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ConfigurationUpdate object { type, id, agent, reasoning }`

            An update to the conversation's response configuration. The configuration
            remains in effect for subsequent responses until it is replaced by another
            configuration update.

            - `type: "configuration_update"`

              The item type. Always `configuration_update`.

              - `"configuration_update"`

            - `id: optional string or null`

              The unique ID of the configuration update item.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `reasoning: optional object { effort }`

              Updates to reasoning configuration. Only effort is supported.

              - `effort: optional "none" or "minimal" or "low" or 4 more or null`

                The reasoning effort to use for subsequent responses until another
                configuration update replaces it.

                - `"none"`

                - `"minimal"`

                - `"low"`

                - `"medium"`

                - `"high"`

                - `"xhigh"`

                - `"max"`

          - `Reasoning object { id, summary, type, 4 more }`

            A description of the chain of thought used by a reasoning model while generating
            a response. Be sure to include these items in your `input` to the Responses API
            for subsequent turns of a conversation if you are manually
            [managing context](/api/docs/guides/conversation-state).

            - `id: string`

              The unique identifier of the reasoning content.

            - `summary: array of object { text, type }`

              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: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `content: optional array of object { text, type }`

              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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

              The status of the item. One of `in_progress`, `completed`, or
              `incomplete`. Populated when items are returned via API.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `Compaction object { encrypted_content, type, id, agent }`

            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.

            - `type: "compaction"`

              The type of the item. Always `compaction`.

              - `"compaction"`

            - `id: optional string or null`

              The ID of the compaction item.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ImageGenerationCall object { id, result, status, 9 more }`

            An image generation request made by the model.

            - `id: string`

              The unique ID of the image generation call.

            - `result: string or null`

              The generated image encoded in base64.

            - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

              The action used for image generation.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `background: optional "transparent" or "opaque" or "auto" or null`

              The background setting used for generation.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `error: optional object { code, message, param, 2 more }`

              Details of a moderation failure, when available.

              - `code: string or null`

                The error code.

              - `message: string`

                A description of the error.

              - `param: string or null`

                The related request parameter.

              - `type: string`

                The error type.

              - `moderation_details: optional object { categories, moderation_stage }`

                Public details for a `moderation_blocked` error, when available.

                - `categories: array of string`

                  Public moderation categories. New category values may be added over time.

                - `moderation_stage: "input" or "output" or "unknown"`

                  The stage where moderation blocked the image generation call.

                  - `"input"`

                  - `"output"`

                  - `"unknown"`

            - `output_format: optional "png" or "webp" or "jpeg" or null`

              The output format used for generation.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

              The prompt that was used after any model prompt rewriting.

            - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `string`

              - `"1024x1024" or "1024x1536" or "1536x1024"`

                The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

          - `CodeInterpreterCall object { id, code, container_id, 4 more }`

            A tool call to run code.

            - `id: string`

              The unique ID of the code interpreter tool call.

            - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

              The outputs generated by the code interpreter, such as logs or images.
              Can be null if no outputs are available.

              - `Logs object { logs, type }`

                The logs output from the code interpreter.

                - `logs: string`

                  The logs output from the code interpreter.

                - `type: "logs"`

                  The type of the output. Always `logs`.

                  - `"logs"`

              - `Image object { type, url }`

                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.

            - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `LocalShellCall object { id, action, call_id, 3 more }`

            A tool call to run a command on the local shell.

            - `id: string`

              The unique ID of the local shell call.

            - `action: object { command, env, type, 3 more }`

              Execute a shell command on the server.

              - `command: array of string`

                The command to run.

              - `env: map[string]`

                Environment variables to set for the command.

              - `type: "exec"`

                The type of the local shell action. Always `exec`.

                - `"exec"`

              - `timeout_ms: optional number or null`

                Optional timeout in milliseconds for the command.

              - `user: optional string or null`

                Optional user to run the command as.

              - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `LocalShellCallOutput object { id, output, type, 2 more }`

            The output of a local shell tool call.

            - `id: string`

              The unique ID of the local shell tool call generated by the model.

            - `output: string`

              A JSON string of the output of the local shell tool call.

            - `type: "local_shell_call_output"`

              The type of the local shell tool call output. Always `local_shell_call_output`.

              - `"local_shell_call_output"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the item. One of `in_progress`, `completed`, or `incomplete`.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `ShellCall object { action, call_id, type, 5 more }`

            A tool representing a request to execute one or more shell commands.

            - `action: object { commands, max_output_length, timeout_ms }`

              The shell commands and limits that describe how to run the tool call.

              - `commands: array of string`

                Ordered shell commands for the execution environment to run.

              - `max_output_length: optional number or null`

                Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

              - `timeout_ms: optional number or 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.

            - `type: "shell_call"`

              The type of the item. Always `shell_call`.

              - `"shell_call"`

            - `id: optional string or null`

              The unique ID of the shell tool call. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

            - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

              The environment to execute the shell commands in.

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `ShellCallOutput object { call_id, output, type, 5 more }`

            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.

            - `output: array of BetaResponseFunctionShellCallOutputContent`

              Captured chunks of stdout and stderr output, along with their associated outcomes.

              - `outcome: Timeout { type }  or Exit { exit_code, type }`

                The exit or timeout outcome associated with this shell call.

                - `Timeout object { type }`

                  Indicates that the shell call exceeded its configured time limit.

                  - `type: "timeout"`

                    The outcome type. Always `timeout`.

                    - `"timeout"`

                - `Exit object { exit_code, type }`

                  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.

              - `stdout: string`

                Captured stdout output for the shell call.

            - `type: "shell_call_output"`

              The type of the item. Always `shell_call_output`.

              - `"shell_call_output"`

            - `id: optional string or null`

              The unique ID of the shell tool call output. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

            - `max_output_length: optional number or null`

              The maximum number of UTF-8 characters captured for this shell call's combined output.

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the shell call output.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

          - `ApplyPatchCall object { call_id, operation, status, 4 more }`

            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.

            - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

              The specific create, delete, or update instruction for the apply_patch tool call.

              - `CreateFile object { diff, path, type }`

                Instruction for creating a new file via the apply_patch tool.

                - `diff: string`

                  Unified diff content to apply when creating the file.

                - `path: string`

                  Path of the file to create relative to the workspace root.

                - `type: "create_file"`

                  The operation type. Always `create_file`.

                  - `"create_file"`

              - `DeleteFile object { path, type }`

                Instruction for deleting an existing file via the apply_patch tool.

                - `path: string`

                  Path of the file to delete relative to the workspace root.

                - `type: "delete_file"`

                  The operation type. Always `delete_file`.

                  - `"delete_file"`

              - `UpdateFile object { diff, path, type }`

                Instruction for updating an existing file via the apply_patch tool.

                - `diff: string`

                  Unified diff content to apply to the existing file.

                - `path: string`

                  Path of the file to update relative to the workspace root.

                - `type: "update_file"`

                  The operation type. Always `update_file`.

                  - `"update_file"`

            - `status: "in_progress" or "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: optional string or null`

              The unique ID of the apply patch tool call. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

          - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

            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.

            - `status: "completed" or "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: optional string or null`

              The unique ID of the apply patch tool call output. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

            - `output: optional string or null`

              Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

          - `McpListTools object { id, server_label, tools, 3 more }`

            A list of tools available on an MCP server.

            - `id: string`

              The unique ID of the list.

            - `server_label: string`

              The label of the MCP server.

            - `tools: array of object { input_schema, name, annotations, description }`

              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: optional unknown or null`

                Additional annotations about the tool.

              - `description: optional string or null`

                The description of the tool.

            - `type: "mcp_list_tools"`

              The type of the item. Always `mcp_list_tools`.

              - `"mcp_list_tools"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `error: optional string or null`

              Error message if the server could not list tools.

          - `McpApprovalRequest object { id, arguments, name, 3 more }`

            A request for human approval of a tool invocation.

            - `id: string`

              The unique ID of the approval request.

            - `arguments: string`

              A JSON string of arguments for the tool.

            - `name: string`

              The name of the tool to run.

            - `server_label: string`

              The label of the MCP server making the request.

            - `type: "mcp_approval_request"`

              The type of the item. Always `mcp_approval_request`.

              - `"mcp_approval_request"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

            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: optional string or null`

              The unique ID of the approval response

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `reason: optional string or null`

              Optional reason for the decision.

          - `McpCall object { id, arguments, name, 7 more }`

            An invocation of a tool on an MCP server.

            - `id: string`

              The unique ID of the tool call.

            - `arguments: string`

              A JSON string of the arguments passed to the tool.

            - `name: string`

              The name of the tool that was run.

            - `server_label: string`

              The label of the MCP server running the tool.

            - `type: "mcp_call"`

              The type of the item. Always `mcp_call`.

              - `"mcp_call"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

              The error from the tool call, if any.

              - `McpProtocolError object { code, message, type }`

                - `code: number`

                - `message: string`

                - `type: "mcp_protocol_error"`

                  - `"mcp_protocol_error"`

              - `McpToolExecutionError object { content, type }`

                - `content: unknown`

                - `type: "mcp_tool_execution_error"`

                  - `"mcp_tool_execution_error"`

              - `HTTPError object { code, message, type }`

                - `code: number`

                - `message: string`

                - `type: "http_error"`

                  - `"http_error"`

            - `output: optional string or null`

              The output from the tool call.

            - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

              The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

              - `"calling"`

              - `"failed"`

          - `CustomToolCallOutput object { call_id, output, type, 3 more }`

            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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              The output from the custom tool call generated by your code.
              Can be a string or an list of output content.

              - `StringOutput = string`

                A string of the output of the custom tool call.

              - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

                Text, image, or file output of the custom tool call.

                - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                  A text input to the model.

                - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                  An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

                - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                  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: optional string`

              The unique ID of the custom tool call output in the OpenAI platform.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

          - `CustomToolCall object { call_id, input, name, 6 more }`

            A call to a custom tool created by the model.

            - `call_id: string`

              An identifier used to map this custom tool call to a tool call output.

            - `input: string`

              The input for the custom tool call generated by the model.

            - `name: string`

              The name of the custom tool being called.

            - `type: "custom_tool_call"`

              The type of the custom tool call. Always `custom_tool_call`.

              - `"custom_tool_call"`

            - `id: optional string`

              The unique ID of the custom tool call in the OpenAI platform.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `async: optional boolean`

              Whether the custom tool call runs asynchronously.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  - `"program"`

            - `namespace: optional string`

              The namespace of the custom tool being called.

          - `CompactionTrigger object { type, id, agent }`

            Compacts the current context. Must be the final input item.

            - `type: "compaction_trigger"`

              The type of the item. Always `compaction_trigger`.

              - `"compaction_trigger"`

            - `id: optional string or null`

              The unique ID of this compaction trigger.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ItemReference object { id, agent, type }`

            An internal identifier for an item to reference.

            - `id: string`

              The ID of the item to reference.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `type: optional "item_reference" or null`

              The type of item to reference. Always `item_reference`.

              - `"item_reference"`

          - `Program object { id, call_id, code, 3 more }`

            - `id: string`

              The unique ID of this 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 item type. Always `program`.

              - `"program"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

          - `ProgramOutput object { id, call_id, result, 3 more }`

            - `id: string`

              The unique ID of this program output item.

            - `call_id: string`

              The call ID of the program item.

            - `result: string`

              The result produced by the program item.

            - `status: "completed" or "incomplete"`

              The terminal status of the program output.

              - `"completed"`

              - `"incomplete"`

            - `type: "program_output"`

              The item type. Always `program_output`.

              - `"program_output"`

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

      - `metadata: map[string] or 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" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

        - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

        - `string`

      - `object: "response"`

        The object type of this resource - always set to `response`.

        - `"response"`

      - `output: array of 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 object { id, content, role, 4 more }`

          An output message from the model.

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { id, output, status, 7 more }`

          - `id: string`

            The unique ID of the function call tool output.

          - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the function call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the function call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the function call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

          - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `created_by: optional string`

            The identifier of the actor that created the item.

          - `name: optional string`

            The name of the tool that produced the output.

          - `namespace: optional string`

            The namespace of the tool that produced the output.

        - `AgentMessage object { id, author, content, 3 more }`

          - `id: string`

            The unique ID of the agent message.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

            Encrypted content sent between agents.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

            - `Text object { text, type }`

              A text content.

              - `text: string`

              - `type: "text"`

                - `"text"`

            - `SummaryText object { text, type }`

              A summary text from the model.

              - `text: string`

                A summary of the reasoning output from the model so far.

              - `type: "summary_text"`

                The type of the object. Always `summary_text`.

                - `"summary_text"`

            - `ReasoningText object { text, type }`

              Reasoning text from the model.

              - `text: string`

                The reasoning text from the model.

              - `type: "reasoning_text"`

                The type of the reasoning text. Always `reasoning_text`.

                - `"reasoning_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              A refusal from the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

              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 or null`

                The identifier of an uploaded file that contains the screenshot.

              - `image_url: string or null`

                The URL of the screenshot image.

              - `type: "computer_screenshot"`

                Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

                - `"computer_screenshot"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The type of the item. Always `agent_message`.

            - `"agent_message"`

          - `agent: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { id, action, arguments, 3 more }`

          - `id: string`

            The unique ID of the multi-agent call item.

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

          - `id: string`

            The unique ID of the multi-agent call output item.

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

            Text output returned by the multi-agent action.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

          - `type: "multi_agent_call_output"`

            The type of the multi-agent result. Always `multi_agent_call_output`.

            - `"multi_agent_call_output"`

          - `agent: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { id, call_id, output, 5 more }`

          - `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" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

            The safety checks reported by the API that have been acknowledged by the
            developer.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of the program item.

          - `call_id: string`

            The stable call ID of the program item.

          - `code: string`

            The JavaScript source executed by programmatic tool calling.

          - `fingerprint: string`

            Opaque program replay fingerprint that must be round-tripped.

          - `type: "program"`

            The type of the item. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of the program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { id, arguments, call_id, 5 more }`

          - `id: string`

            The unique ID of the tool search call item.

          - `arguments: unknown`

            Arguments used for the tool search call.

          - `call_id: string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `ToolSearchOutput object { id, call_id, execution, 5 more }`

          - `id: string`

            The unique ID of the tool search output item.

          - `call_id: string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: "in_progress" or "completed" or "incomplete"`

            The status of the tool search output item that was recorded.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by tool search.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The type of the item. Always `tool_search_output`.

            - `"tool_search_output"`

          - `agent: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `AdditionalTools object { id, role, tools, 2 more }`

          - `id: string`

            The unique ID of the additional tools item.

          - `role: "unknown" or "user" or "assistant" or 5 more`

            The role that provided the additional tools.

            - `"unknown"`

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"critic"`

            - `"discriminator"`

            - `"developer"`

            - `"tool"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The additional tool definitions made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The type of the item. Always `additional_tools`.

            - `"additional_tools"`

          - `agent: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `Compaction object { id, encrypted_content, type, 2 more }`

          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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { id, action, call_id, 6 more }`

          A tool call that executes one or more shell commands in a managed environment.

          - `id: string`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

            - `max_output_length: number or null`

              Optional maximum number of characters to return from each command.

            - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

            Represents the use of a local environment to perform shell actions.

            - `BetaResponseLocalEnvironment object { type }`

              Represents the use of a local environment to perform shell actions.

              - `type: "local"`

                The environment type. Always `local`.

                - `"local"`

            - `BetaResponseContainerReference object { container_id, type }`

              Represents a container created with /v1/containers.

              - `container_id: string`

              - `type: "container_reference"`

                The environment type. Always `container_reference`.

                - `"container_reference"`

          - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `created_by: optional string`

            The ID of the entity that created this tool call.

        - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

          The output of a shell tool call that was emitted.

          - `id: string`

            The unique ID of the shell call output. Populated when this item is returned via API.

          - `call_id: string`

            The unique ID of the shell tool call generated by the model.

          - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

            An array of shell call output contents

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                Indicates that the shell commands finished and returned an exit code.

                - `exit_code: number`

                  Exit code from the shell process.

                - `type: "exit"`

                  The outcome type. Always `exit`.

                  - `"exit"`

            - `stderr: string`

              The standard error output that was captured.

            - `stdout: string`

              The standard output that was captured.

            - `created_by: optional string`

              The identifier of the actor that created the item.

          - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `created_by: optional string`

            The identifier of the actor that created the item.

        - `ApplyPatchCall object { id, call_id, operation, 5 more }`

          A tool call that applies file diffs by creating, deleting, or updating files.

          - `id: string`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            One of the create_file, delete_file, or update_file operations applied via apply_patch.

            - `CreateFile object { diff, path, type }`

              Instruction describing how to create a file via the apply_patch tool.

              - `diff: string`

                Diff to apply.

              - `path: string`

                Path of the file to create.

              - `type: "create_file"`

                Create a new file with the provided diff.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction describing how to delete a file via the apply_patch tool.

              - `path: string`

                Path of the file to delete.

              - `type: "delete_file"`

                Delete the specified file.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction describing how to update a file via the apply_patch tool.

              - `diff: string`

                Diff to apply.

              - `path: string`

                Path of the file to update.

              - `type: "update_file"`

                Update an existing file with the provided diff.

                - `"update_file"`

          - `status: "in_progress" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `created_by: optional string`

            The ID of the entity that created this tool call.

        - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

          The output emitted by an apply patch tool call.

          - `id: string`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `call_id: string`

            The unique ID of the apply patch tool call generated by the model.

          - `status: "completed" or "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: optional object { agent_name }`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `created_by: optional string`

            The ID of the entity that created this tool call output.

          - `output: optional string or null`

            Optional textual output returned by the apply patch tool.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

          A response to an MCP approval request.

          - `id: string`

            The unique ID of the approval response

          - `approval_request_id: string`

            The ID of the approval request being answered.

          - `approve: boolean`

            Whether the request was approved.

          - `type: "mcp_approval_response"`

            The type of the item. Always `mcp_approval_response`.

            - `"mcp_approval_response"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CustomToolCallOutput object { id, call_id, output, 5 more }`

          - `id: string`

            The unique ID of the custom tool call output item.

          - `call_id: string`

            The call ID, used to map this custom tool call output to a custom tool call.

          - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

          - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

            The type of the custom tool call output. Always `custom_tool_call_output`.

            - `"custom_tool_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `created_by: optional 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 or 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.

      - `tool_choice: BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

          Constrains the tools available to the model to a pre-defined set.

          - `mode: "auto" or "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 of map[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 object { type }`

          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" or "web_search_preview" or "computer" or 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 object { name, type }`

          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 object { server_label, type, name }`

          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: optional string or null`

            The name of the tool to call on the server.

        - `BetaToolChoiceCustom object { name, type }`

          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 object { type }`

          - `type: "programmatic_tool_calling"`

            The tool to call. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `BetaToolChoiceApplyPatch object { type }`

          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 object { type }`

          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 of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        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.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `top_p: number or 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.

      - `background: optional boolean or null`

        Whether to run the model response in the background.
        [Learn more](/api/docs/guides/background).

      - `completed_at: optional number or null`

        Unix timestamp (in seconds) of when this Response was completed.
        Only present when the status is `completed`.

      - `conversation: optional object { id }  or 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.

      - `max_output_tokens: optional number or 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: optional number or 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: optional object { input, output }  or null`

        Moderation results for the response input and output, if moderated completions were requested.

        - `input: ModerationResult { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

          Moderation for the response input.

          - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

            A moderation result produced for the response input or output.

            - `categories: map[boolean]`

              A dictionary of moderation categories to booleans, True if the input is flagged under this category.

            - `category_applied_input_types: map[array of "text" or "image"]`

              Which modalities of input are reflected by the score for each category.

              - `"text"`

              - `"image"`

            - `category_scores: map[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 object { code, message, type }`

            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 { categories, category_applied_input_types, category_scores, 3 more }  or Error { code, message, type }`

          Moderation for the response output.

          - `ModerationResult object { categories, category_applied_input_types, category_scores, 3 more }`

            A moderation result produced for the response input or output.

            - `categories: map[boolean]`

              A dictionary of moderation categories to booleans, True if the input is flagged under this category.

            - `category_applied_input_types: map[array of "text" or "image"]`

              Which modalities of input are reflected by the score for each category.

              - `"text"`

              - `"image"`

            - `category_scores: map[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 object { code, message, type }`

            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_text: optional string or null`

        SDK-only convenience property that contains the aggregated text output
        from all `output_text` items in the `output` array, if any are present.
        Supported in the Python and JavaScript SDKs.

      - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

        - `version: optional string or null`

          Optional version of the prompt template.

      - `prompt_cache_diagnostics: optional CacheMiss { cache_missed_tokens, reason, type, comparison_reusable_tokens }  or CacheHit { type }  or ComparisonResponseNotFound { type }  or Unavailable { type }`

        Prompt cache diagnostics requested for this response.

        - `CacheMiss object { cache_missed_tokens, reason, type, comparison_reusable_tokens }`

          - `cache_missed_tokens: number`

            The estimated number of input tokens affected after the first detected divergence.

          - `reason: "model_changed" or "prompt_cache_key_changed" or "tools_changed" or 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: optional number`

            The raw token count of the reusable prefix in the compared response.

        - `CacheHit object { type }`

          - `type: "cache_hit"`

            - `"cache_hit"`

        - `ComparisonResponseNotFound object { type }`

          - `type: "comparison_response_not_found"`

            - `"comparison_response_not_found"`

        - `Unavailable object { type }`

          - `type: "unavailable"`

            - `"unavailable"`

      - `prompt_cache_key: optional string or 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: optional object { mode, ttl, comparison_response_id }`

        The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models.

        - `mode: "implicit" or "explicit"`

          Whether implicit prompt-cache breakpoints were enabled.

          - `"implicit"`

          - `"explicit"`

        - `ttl: "30m"`

          The minimum lifetime applied to each cache breakpoint.

          - `"30m"`

        - `comparison_response_id: optional string or null`

          The response ID supplied as the prompt cache diagnostics comparison.

      - `prompt_cache_retention: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

        Configuration options for
        [reasoning models](/api/docs/guides/reasoning).

        - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `string`

          - `"standard" or "pro"`

            Controls the reasoning execution mode for the request.

            When returned on a response, this is the effective execution mode.

            - `"standard"`

            - `"pro"`

        - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

      - `service_tier: optional BetaServiceTier or 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: optional 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: optional 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: optional 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 object { type }`

            Default response format. Used to generate text responses.

            - `type: "text"`

              The type of response format being defined. Always `text`.

              - `"text"`

          - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

            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: map[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: optional string`

              A description of what the response format is for, used by the model to
              determine how to respond in the format.

            - `strict: optional boolean or 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 object { type }`

            JSON object response format. An older method of generating JSON responses.
            Using `json_schema` is recommended for models that support it. Note that the
            model will not generate JSON without a system or user message instructing it
            to do so.

            - `type: "json_object"`

              The type of response format being defined. Always `json_object`.

              - `"json_object"`

        - `verbosity: optional "low" or "medium" or "high" or 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"`

      - `top_logprobs: optional number or 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.

      - `truncation: optional "auto" or "disabled" or 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.
        - `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: optional BetaResponseUsage or null`

        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: object { cache_write_tokens, cached_tokens }`

          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).

        - `output_tokens: number`

          The number of output tokens.

        - `output_tokens_details: object { reasoning_tokens }`

          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: optional string or null`

        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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseContentPartAddedEvent object { content_index, item_id, output_index, 4 more }`

    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 or BetaResponseOutputRefusal or ReasoningText { text, type }`

      The content part that was added.

      - `BetaResponseOutputText object { annotations, logprobs, text, type }`

        A text output from the model.

      - `BetaResponseOutputRefusal object { refusal, type }`

        A refusal from the model.

      - `ReasoningText object { text, type }`

        Reasoning text from the model.

        - `text: string`

          The reasoning text from the model.

        - `type: "reasoning_text"`

          The type of the reasoning text. Always `reasoning_text`.

          - `"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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseContentPartDoneEvent object { content_index, item_id, output_index, 4 more }`

    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 or BetaResponseOutputRefusal or ReasoningText { text, type }`

      The content part that is done.

      - `BetaResponseOutputText object { annotations, logprobs, text, type }`

        A text output from the model.

      - `BetaResponseOutputRefusal object { refusal, type }`

        A refusal from the model.

      - `ReasoningText object { text, type }`

        Reasoning text from the model.

        - `text: string`

          The reasoning text from the model.

        - `type: "reasoning_text"`

          The type of the reasoning text. Always `reasoning_text`.

          - `"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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCreatedEvent object { response, sequence_number, type, agent }`

    An event that is emitted when a response is created.

    - `response: BetaResponse`

      The response that was created.

    - `sequence_number: number`

      The sequence number for this event.

    - `type: "response.created"`

      The type of the event. Always `response.created`.

      - `"response.created"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseErrorEvent object { code, message, param, 3 more }`

    Emitted when an error occurs.

    - `code: string or null`

      The error code.

    - `message: string`

      The error message.

    - `param: string or null`

      The error parameter.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "error"`

      The type of the event. Always `error`.

      - `"error"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFileSearchCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFileSearchCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFileSearchCallSearchingEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionCallArgumentsDeltaEvent object { delta, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFunctionCallArgumentsDoneEvent object { arguments, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseShellCallCommandAddedEvent object { command, command_index, output_index, 3 more }`

    A streaming event that indicated a shell command was added to a tool call.

    - `command: string`

      The shell command that was added.

    - `command_index: number`

      The index of the shell command that was added.

    - `output_index: number`

      The index of the output item that was updated.

    - `sequence_number: number`

      The sequence number of the event that was emitted.

    - `type: "response.shell_call_command.added"`

      The type of the event, always `response.shell_call_command.added`.

      - `"response.shell_call_command.added"`

    - `agent: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseShellCallCommandDeltaEvent object { command_index, delta, output_index, 4 more }`

    A streaming event that indicated a shell command was incrementally updated.

    - `command_index: number`

      The index of the shell command that was updated.

    - `delta: string`

      The shell command delta that was appended.

    - `output_index: number`

      The index of the output item that was updated.

    - `sequence_number: number`

      The sequence number of the event that was emitted.

    - `type: "response.shell_call_command.delta"`

      The type of the event, always `response.shell_call_command.delta`.

      - `"response.shell_call_command.delta"`

    - `agent: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `obfuscation: optional string`

      An obfuscation string that was added to pad the event payload.

  - `BetaResponseShellCallCommandDoneEvent object { command, command_index, output_index, 3 more }`

    A streaming event that indicated a shell command was completed.

    - `command: string`

      The final shell command that was emitted.

    - `command_index: number`

      The index of the shell command that was completed.

    - `output_index: number`

      The index of the output item that was updated.

    - `sequence_number: number`

      The sequence number of the event that was emitted.

    - `type: "response.shell_call_command.done"`

      The type of the event, always `response.shell_call_command.done`.

      - `"response.shell_call_command.done"`

    - `agent: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseShellCallOutputContentDeltaEvent object { command_index, delta, item_id, 4 more }`

    A streaming event that indicated shell call output was incrementally added.

    - `command_index: number`

      The index of the shell command that produced output.

    - `delta: object { stderr, stdout }`

      The stdout/stderr delta that was emitted.

      - `stderr: optional string`

        The stderr delta that was emitted.

      - `stdout: optional string`

        The stdout delta that was emitted.

    - `item_id: string`

      The ID of the output item that was updated.

    - `output_index: number`

      The index of the output item that was updated.

    - `sequence_number: number`

      The sequence number of the event that was emitted.

    - `type: "response.shell_call_output_content.delta"`

      The type of the event, always `response.shell_call_output_content.delta`.

      - `"response.shell_call_output_content.delta"`

    - `agent: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseShellCallOutputContentDoneEvent object { command_index, item_id, output, 4 more }`

    A streaming event that indicated shell call output was completed.

    - `command_index: number`

      The index of the shell command that produced output.

    - `item_id: string`

      The ID of the output item that was updated.

    - `output: array of object { outcome, stderr, stdout, created_by }`

      The output contents emitted for the shell command.

      - `outcome: Timeout { type }  or Exit { exit_code, type }`

        Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

        - `Timeout object { type }`

          Indicates that the shell call exceeded its configured time limit.

          - `type: "timeout"`

            The outcome type. Always `timeout`.

            - `"timeout"`

        - `Exit object { exit_code, type }`

          Indicates that the shell commands finished and returned an exit code.

          - `exit_code: number`

            Exit code from the shell process.

          - `type: "exit"`

            The outcome type. Always `exit`.

            - `"exit"`

      - `stderr: string`

        The standard error output that was captured.

      - `stdout: string`

        The standard output that was captured.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `output_index: number`

      The index of the output item that was updated.

    - `sequence_number: number`

      The sequence number of the event that was emitted.

    - `type: "response.shell_call_output_content.done"`

      The type of the event, always `response.shell_call_output_content.done`.

      - `"response.shell_call_output_content.done"`

    - `agent: optional object { agent_name }`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseInProgressEvent object { response, sequence_number, type, agent }`

    Emitted when the response is in progress.

    - `response: BetaResponse`

      The response that is in progress.

    - `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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseFailedEvent object { response, sequence_number, type, agent }`

    An event that is emitted when a response fails.

    - `response: BetaResponse`

      The response that failed.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.failed"`

      The type of the event. Always `response.failed`.

      - `"response.failed"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseIncompleteEvent object { response, sequence_number, type, agent }`

    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.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.incomplete"`

      The type of the event. Always `response.incomplete`.

      - `"response.incomplete"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseOutputItemAddedEvent object { item, output_index, sequence_number, 2 more }`

    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 object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        The results of a file search tool call. See the
        [file search guide](/api/docs/guides/tools-file-search) for more information.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        A tool call to run a function. See the
        [function calling guide](/api/docs/guides/function-calling) for more information.

      - `FunctionCallOutput object { id, output, status, 7 more }`

      - `AgentMessage object { id, author, content, 3 more }`

      - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `WebSearchCall object { id, status, type, 2 more }`

        The results of a web search tool call. See the
        [web search guide](/api/docs/guides/tools-web-search) for more information.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        A tool call to a computer use tool. See the
        [computer use guide](/api/docs/guides/tools-computer-use) for more information.

      - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

      - `Program object { id, call_id, code, 3 more }`

      - `ProgramOutput object { id, call_id, result, 3 more }`

      - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `AdditionalTools object { id, role, tools, 2 more }`

      - `Compaction object { id, encrypted_content, type, 2 more }`

        A compaction item generated by the [`v1/responses/compact` API](/api/reference/resources/responses/methods/compact).

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

      - `ShellCall object { id, action, call_id, 6 more }`

        A tool call that executes one or more shell commands in a managed environment.

      - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

        The output of a shell tool call that was emitted.

      - `ApplyPatchCall object { id, call_id, operation, 5 more }`

        A tool call that applies file diffs by creating, deleting, or updating files.

      - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

        The output emitted by an apply patch tool call.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

      - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

        A response to an MCP approval request.

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

      - `CustomToolCallOutput object { id, call_id, output, 5 more }`

    - `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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseOutputItemDoneEvent object { item, output_index, sequence_number, 2 more }`

    Emitted when an output item is marked done.

    - `item: BetaResponseOutputItem`

      The output item that was marked done.

    - `output_index: number`

      The index of the output item that was marked done.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.output_item.done"`

      The type of the event. Always `response.output_item.done`.

      - `"response.output_item.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseReasoningSummaryPartAddedEvent object { item_id, output_index, part, 4 more }`

    Emitted when a new reasoning summary part is added.

    - `item_id: string`

      The ID of the item this summary part is associated with.

    - `output_index: number`

      The index of the output item this summary part is associated with.

    - `part: object { text, type }`

      The summary part that was added.

      - `text: string`

        The text of the summary part.

      - `type: "summary_text"`

        The type of the summary part. Always `summary_text`.

        - `"summary_text"`

    - `sequence_number: number`

      The sequence number of this event.

    - `summary_index: number`

      The index of the summary part within the reasoning summary.

    - `type: "response.reasoning_summary_part.added"`

      The type of the event. Always `response.reasoning_summary_part.added`.

      - `"response.reasoning_summary_part.added"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseReasoningSummaryPartDoneEvent object { item_id, output_index, part, 5 more }`

    Emitted when a reasoning summary part is completed.

    - `item_id: string`

      The ID of the item this summary part is associated with.

    - `output_index: number`

      The index of the output item this summary part is associated with.

    - `part: object { text, type }`

      The completed summary part.

      - `text: string`

        The text of the summary part.

      - `type: "summary_text"`

        The type of the summary part. Always `summary_text`.

        - `"summary_text"`

    - `sequence_number: number`

      The sequence number of this event.

    - `summary_index: number`

      The index of the summary part within the reasoning summary.

    - `type: "response.reasoning_summary_part.done"`

      The type of the event. Always `response.reasoning_summary_part.done`.

      - `"response.reasoning_summary_part.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `status: optional "incomplete"`

      The completion status of the summary part. Omitted when the part completed
      normally and set to `incomplete` when generation was interrupted.

      - `"incomplete"`

  - `BetaResponseReasoningSummaryTextDeltaEvent object { delta, item_id, output_index, 4 more }`

    Emitted when a delta is added to a reasoning summary text.

    - `delta: string`

      The text delta that was added to the summary.

    - `item_id: string`

      The ID of the item this summary text delta is associated with.

    - `output_index: number`

      The index of the output item this summary text delta is associated with.

    - `sequence_number: number`

      The sequence number of this event.

    - `summary_index: number`

      The index of the summary part within the reasoning summary.

    - `type: "response.reasoning_summary_text.delta"`

      The type of the event. Always `response.reasoning_summary_text.delta`.

      - `"response.reasoning_summary_text.delta"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseReasoningSummaryTextDoneEvent object { item_id, output_index, sequence_number, 4 more }`

    Emitted when a reasoning summary text is completed.

    - `item_id: string`

      The ID of the item this summary text is associated with.

    - `output_index: number`

      The index of the output item this summary text is associated with.

    - `sequence_number: number`

      The sequence number of this event.

    - `summary_index: number`

      The index of the summary part within the reasoning summary.

    - `text: string`

      The full text of the completed reasoning summary.

    - `type: "response.reasoning_summary_text.done"`

      The type of the event. Always `response.reasoning_summary_text.done`.

      - `"response.reasoning_summary_text.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseReasoningTextDeltaEvent object { content_index, delta, item_id, 4 more }`

    Emitted when a delta is added to a reasoning text.

    - `content_index: number`

      The index of the reasoning content part this delta is associated with.

    - `delta: string`

      The text delta that was added to the reasoning content.

    - `item_id: string`

      The ID of the item this reasoning text delta is associated with.

    - `output_index: number`

      The index of the output item this reasoning text delta is associated with.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.reasoning_text.delta"`

      The type of the event. Always `response.reasoning_text.delta`.

      - `"response.reasoning_text.delta"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseReasoningTextDoneEvent object { content_index, item_id, output_index, 4 more }`

    Emitted when a reasoning text is completed.

    - `content_index: number`

      The index of the reasoning content part.

    - `item_id: string`

      The ID of the item this reasoning text is associated with.

    - `output_index: number`

      The index of the output item this reasoning text is associated with.

    - `sequence_number: number`

      The sequence number of this event.

    - `text: string`

      The full text of the completed reasoning content.

    - `type: "response.reasoning_text.done"`

      The type of the event. Always `response.reasoning_text.done`.

      - `"response.reasoning_text.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseRefusalDeltaEvent object { content_index, delta, item_id, 4 more }`

    Emitted when there is a partial refusal text.

    - `content_index: number`

      The index of the content part that the refusal text is added to.

    - `delta: string`

      The refusal text that is added.

    - `item_id: string`

      The ID of the output item that the refusal text is added to.

    - `output_index: number`

      The index of the output item that the refusal text is added to.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.refusal.delta"`

      The type of the event. Always `response.refusal.delta`.

      - `"response.refusal.delta"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseRefusalDoneEvent object { content_index, item_id, output_index, 4 more }`

    Emitted when refusal text is finalized.

    - `content_index: number`

      The index of the content part that the refusal text is finalized.

    - `item_id: string`

      The ID of the output item that the refusal text is finalized.

    - `output_index: number`

      The index of the output item that the refusal text is finalized.

    - `refusal: string`

      The refusal text that is finalized.

    - `sequence_number: number`

      The sequence number of this event.

    - `type: "response.refusal.done"`

      The type of the event. Always `response.refusal.done`.

      - `"response.refusal.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseTextDeltaEvent object { content_index, delta, item_id, 5 more }`

    Emitted when there is an additional text delta.

    - `content_index: number`

      The index of the content part that the text delta was added to.

    - `delta: string`

      The text delta that was added.

    - `item_id: string`

      The ID of the output item that the text delta was added to.

    - `logprobs: array of object { token, logprob, top_logprobs }`

      The log probabilities of the tokens in the delta.

      - `token: string`

        A possible text token.

      - `logprob: number`

        The log probability of this token.

      - `top_logprobs: optional array of object { token, logprob }`

        The log probabilities of up to 20 of the most likely tokens.

        - `token: optional string`

          A possible text token.

        - `logprob: optional number`

          The log probability of this token.

    - `output_index: number`

      The index of the output item that the text delta was added to.

    - `sequence_number: number`

      The sequence number for this event.

    - `type: "response.output_text.delta"`

      The type of the event. Always `response.output_text.delta`.

      - `"response.output_text.delta"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseTextDoneEvent object { content_index, item_id, logprobs, 5 more }`

    Emitted when text content is finalized.

    - `content_index: number`

      The index of the content part that the text content is finalized.

    - `item_id: string`

      The ID of the output item that the text content is finalized.

    - `logprobs: array of object { token, logprob, top_logprobs }`

      The log probabilities of the tokens in the delta.

      - `token: string`

        A possible text token.

      - `logprob: number`

        The log probability of this token.

      - `top_logprobs: optional array of object { token, logprob }`

        The log probabilities of up to 20 of the most likely tokens.

        - `token: optional string`

          A possible text token.

        - `logprob: optional number`

          The log probability of this token.

    - `output_index: number`

      The index of the output item that the text content is finalized.

    - `sequence_number: number`

      The sequence number for this event.

    - `text: string`

      The text content that is finalized.

    - `type: "response.output_text.done"`

      The type of the event. Always `response.output_text.done`.

      - `"response.output_text.done"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseWebSearchCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    Emitted when a web search call is completed.

    - `item_id: string`

      Unique ID for the output item associated with the web search call.

    - `output_index: number`

      The index of the output item that the web search call is associated with.

    - `sequence_number: number`

      The sequence number of the web search call being processed.

    - `type: "response.web_search_call.completed"`

      The type of the event. Always `response.web_search_call.completed`.

      - `"response.web_search_call.completed"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseWebSearchCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    Emitted when a web search call is initiated.

    - `item_id: string`

      Unique ID for the output item associated with the web search call.

    - `output_index: number`

      The index of the output item that the web search call is associated with.

    - `sequence_number: number`

      The sequence number of the web search call being processed.

    - `type: "response.web_search_call.in_progress"`

      The type of the event. Always `response.web_search_call.in_progress`.

      - `"response.web_search_call.in_progress"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseWebSearchCallSearchingEvent object { item_id, output_index, sequence_number, 2 more }`

    Emitted when a web search call is executing.

    - `item_id: string`

      Unique ID for the output item associated with the web search call.

    - `output_index: number`

      The index of the output item that the web search call is associated with.

    - `sequence_number: number`

      The sequence number of the web search call being processed.

    - `type: "response.web_search_call.searching"`

      The type of the event. Always `response.web_search_call.searching`.

      - `"response.web_search_call.searching"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseImageGenCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseImageGenCallGeneratingEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseImageGenCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseImageGenCallPartialImageEvent object { item_id, output_index, partial_image_b64, 8 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `background: optional string`

      The background setting that was used.

    - `output_format: optional string`

      The output format that was used.

    - `quality: optional string`

      The image quality that was used.

    - `size: optional string`

      The image size that was used.

  - `BetaResponseMcpCallArgumentsDeltaEvent object { delta, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpCallArgumentsDoneEvent object { arguments, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpCallFailedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpListToolsCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpListToolsFailedEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseMcpListToolsInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseOutputTextAnnotationAddedEvent object { annotation, annotation_index, content_index, 5 more }`

    Emitted when an annotation is added to output text content.

    - `annotation: FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }  or null`

      The annotation object being added. (See annotation schema for details.)

      - `FileCitation object { file_id, filename, index, type }`

        A citation to a file.

        - `file_id: string`

          The ID of the file.

        - `filename: string`

          The filename of the file cited.

        - `index: number`

          The index 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 object { end_index, start_index, title, 2 more }`

        A citation for a web resource used to generate a model response.

        - `end_index: number`

          The index of the last character of the URL citation in the message.

        - `start_index: number`

          The index of the first character of the URL citation in the message.

        - `title: string`

          The title of the web resource.

        - `type: "url_citation"`

          The type of the URL citation. Always `url_citation`.

          - `"url_citation"`

        - `url: string`

          The URL of the web resource.

      - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

        A citation for a container file used to generate a model response.

        - `container_id: string`

          The ID of the container file.

        - `end_index: number`

          The index of the last character of the container file citation in the message.

        - `file_id: string`

          The ID of the file.

        - `filename: string`

          The filename of the container file cited.

        - `start_index: number`

          The index of the first character of the container file citation in the message.

        - `type: "container_file_citation"`

          The type of the container file citation. Always `container_file_citation`.

          - `"container_file_citation"`

      - `FilePath object { file_id, index, type }`

        A path to a file.

        - `file_id: string`

          The ID of the file.

        - `index: number`

          The index of the file in the list of files.

        - `type: "file_path"`

          The type of the file path. Always `file_path`.

          - `"file_path"`

    - `annotation_index: number`

      The index of the annotation within the content part.

    - `content_index: number`

      The index of the content part within the output item.

    - `item_id: string`

      The unique identifier of the item to which the annotation is being added.

    - `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.output_text.annotation.added"`

      The type of the event. Always 'response.output_text.annotation.added'.

      - `"response.output_text.annotation.added"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseQueuedEvent object { response, sequence_number, type, agent }`

    Emitted when a response is queued and waiting to be processed.

    - `response: BetaResponse`

      The full response object that is queued.

    - `sequence_number: number`

      The sequence number for this event.

    - `type: "response.queued"`

      The type of the event. Always 'response.queued'.

      - `"response.queued"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCustomToolCallInputDeltaEvent object { delta, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

  - `BetaResponseCustomToolCallInputDoneEvent object { input, item_id, output_index, 3 more }`

    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: optional object { agent_name }  or 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 Text Config

- `BetaResponseTextConfig object { format, verbosity }`

  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: optional 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 object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

      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: map[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: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `strict: optional boolean or 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 object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

  - `verbosity: optional "low" or "medium" or "high" or 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"`

### Beta Response Text Delta Event

- `BetaResponseTextDeltaEvent object { content_index, delta, item_id, 5 more }`

  Emitted when there is an additional text delta.

  - `content_index: number`

    The index of the content part that the text delta was added to.

  - `delta: string`

    The text delta that was added.

  - `item_id: string`

    The ID of the output item that the text delta was added to.

  - `logprobs: array of object { token, logprob, top_logprobs }`

    The log probabilities of the tokens in the delta.

    - `token: string`

      A possible text token.

    - `logprob: number`

      The log probability of this token.

    - `top_logprobs: optional array of object { token, logprob }`

      The log probabilities of up to 20 of the most likely tokens.

      - `token: optional string`

        A possible text token.

      - `logprob: optional number`

        The log probability of this token.

  - `output_index: number`

    The index of the output item that the text delta was added to.

  - `sequence_number: number`

    The sequence number for this event.

  - `type: "response.output_text.delta"`

    The type of the event. Always `response.output_text.delta`.

    - `"response.output_text.delta"`

  - `agent: optional object { agent_name }  or 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 Text Done Event

- `BetaResponseTextDoneEvent object { content_index, item_id, logprobs, 5 more }`

  Emitted when text content is finalized.

  - `content_index: number`

    The index of the content part that the text content is finalized.

  - `item_id: string`

    The ID of the output item that the text content is finalized.

  - `logprobs: array of object { token, logprob, top_logprobs }`

    The log probabilities of the tokens in the delta.

    - `token: string`

      A possible text token.

    - `logprob: number`

      The log probability of this token.

    - `top_logprobs: optional array of object { token, logprob }`

      The log probabilities of up to 20 of the most likely tokens.

      - `token: optional string`

        A possible text token.

      - `logprob: optional number`

        The log probability of this token.

  - `output_index: number`

    The index of the output item that the text content is finalized.

  - `sequence_number: number`

    The sequence number for this event.

  - `text: string`

    The text content that is finalized.

  - `type: "response.output_text.done"`

    The type of the event. Always `response.output_text.done`.

    - `"response.output_text.done"`

  - `agent: optional object { agent_name }  or 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 Usage

- `BetaResponseUsage object { input_tokens, input_tokens_details, output_tokens, 2 more }`

  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: object { cache_write_tokens, cached_tokens }`

    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).

  - `output_tokens: number`

    The number of output tokens.

  - `output_tokens_details: object { reasoning_tokens }`

    A detailed breakdown of the output tokens.

    - `reasoning_tokens: number`

      The number of reasoning tokens.

  - `total_tokens: number`

    The total number of tokens used.

### Beta Response Web Search Call Completed Event

- `BetaResponseWebSearchCallCompletedEvent object { item_id, output_index, sequence_number, 2 more }`

  Emitted when a web search call is completed.

  - `item_id: string`

    Unique ID for the output item associated with the web search call.

  - `output_index: number`

    The index of the output item that the web search call is associated with.

  - `sequence_number: number`

    The sequence number of the web search call being processed.

  - `type: "response.web_search_call.completed"`

    The type of the event. Always `response.web_search_call.completed`.

    - `"response.web_search_call.completed"`

  - `agent: optional object { agent_name }  or 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 Web Search Call In Progress Event

- `BetaResponseWebSearchCallInProgressEvent object { item_id, output_index, sequence_number, 2 more }`

  Emitted when a web search call is initiated.

  - `item_id: string`

    Unique ID for the output item associated with the web search call.

  - `output_index: number`

    The index of the output item that the web search call is associated with.

  - `sequence_number: number`

    The sequence number of the web search call being processed.

  - `type: "response.web_search_call.in_progress"`

    The type of the event. Always `response.web_search_call.in_progress`.

    - `"response.web_search_call.in_progress"`

  - `agent: optional object { agent_name }  or 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 Web Search Call Searching Event

- `BetaResponseWebSearchCallSearchingEvent object { item_id, output_index, sequence_number, 2 more }`

  Emitted when a web search call is executing.

  - `item_id: string`

    Unique ID for the output item associated with the web search call.

  - `output_index: number`

    The index of the output item that the web search call is associated with.

  - `sequence_number: number`

    The sequence number of the web search call being processed.

  - `type: "response.web_search_call.searching"`

    The type of the event. Always `response.web_search_call.searching`.

    - `"response.web_search_call.searching"`

  - `agent: optional object { agent_name }  or null`

    The agent that owns this multi-agent streaming event.

    - `agent_name: string`

      The canonical name of the agent that produced this item.

### Beta Responses Client Event

- `BetaResponsesClientEvent = ResponseCreate { type, access_programs, background, 32 more }  or BetaResponseSteerEvent or BetaResponseInjectEvent`

  Client events accepted by the Responses WebSocket server.

  - `ResponseCreate object { type, access_programs, background, 32 more }`

    Client event for creating a response over a persistent WebSocket connection.
    This payload uses the same top-level fields as `POST /v1/responses`, plus
    WebSocket-only envelope metadata.

    Notes:

    - `stream` is implicit over WebSocket and should not be sent.
    - `background` is not supported over WebSocket.
    - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.

    - `type: "response.create"`

      The type of the client event. Always `response.create`.

      - `"response.create"`

    - `access_programs: optional object { cyber }`

      Domain-specific access programs to use for this request.

      - `cyber: optional "standard" or "daybreak_blue" or "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: optional boolean or null`

      Whether to run the model response in the background.
      [Learn more](/api/docs/guides/background).

    - `context_management: optional array of object { type, compact_threshold }  or null`

      Context management configuration for this request.

      - `type: string`

        The context management entry type. Currently only 'compaction' is supported.

      - `compact_threshold: optional number or null`

        Token threshold at which compaction should be triggered for this entry.

    - `conversation: optional string or BetaResponseConversationParam or null`

      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.

      - `ConversationID = string`

        The unique ID of the conversation.

      - `BetaResponseConversationParam object { id }`

        The conversation that this response belongs to.

        - `id: string`

          The unique ID of the conversation.

    - `include: optional array of BetaResponseIncludable or null`

      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: optional string or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      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)

      - `TextInput = string`

        A text input to the model, equivalent to a text input with the
        `user` role.

      - `InputItemList = array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

        A list of one or many input items to the model, containing
        different content types.

        - `BetaEasyInputMessage object { content, role, phase, type }`

          A message input to the model with a role indicating instruction following
          hierarchy. Instructions given with the `developer` or `system` role take
          precedence over instructions given with the `user` role. Messages with the
          `assistant` role are presumed to have been generated by the model in previous
          interactions.

          - `content: string or BetaResponseInputMessageContentList`

            Text, image, or audio input to the model, used to generate a response.
            Can also contain previous assistant responses.

            - `TextInput = string`

              A text input to the model.

            - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

              A list of one or many input items to the model, containing different content
              types.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string`

                  The content of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string`

                  The URL of the file to be sent to the model.

                - `filename: optional string`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode }`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

          - `role: "user" or "assistant" or "system" or "developer"`

            The role of the message input. One of `user`, `assistant`, `system`, or
            `developer`.

            - `"user"`

            - `"assistant"`

            - `"system"`

            - `"developer"`

          - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

            The type of the message input. Always `message`.

            - `"message"`

        - `Message object { content, role, agent, 2 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.

          - `content: BetaResponseInputMessageContentList`

            A list of one or many input items to the model, containing different content
            types.

          - `role: "user" or "system" or "developer"`

            The role of the message input. One of `user`, `system`, or `developer`.

            - `"user"`

            - `"system"`

            - `"developer"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete"`

            The status of item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

          - `type: optional "message"`

            The type of the message input. Always set to `message`.

            - `"message"`

        - `BetaResponseOutputMessage object { id, content, role, 4 more }`

          An output message from the model.

          - `id: string`

            The unique ID of the output message.

          - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

            The content of the output message.

            - `BetaResponseOutputText object { annotations, logprobs, text, type }`

              A text output from the model.

              - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

                The annotations of the text output.

                - `FileCitation object { file_id, filename, index, type }`

                  A citation to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the file cited.

                  - `index: number`

                    The index 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 object { end_index, start_index, title, 2 more }`

                  A citation for a web resource used to generate a model response.

                  - `end_index: number`

                    The index of the last character of the URL citation in the message.

                  - `start_index: number`

                    The index of the first character of the URL citation in the message.

                  - `title: string`

                    The title of the web resource.

                  - `type: "url_citation"`

                    The type of the URL citation. Always `url_citation`.

                    - `"url_citation"`

                  - `url: string`

                    The URL of the web resource.

                - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                  A citation for a container file used to generate a model response.

                  - `container_id: string`

                    The ID of the container file.

                  - `end_index: number`

                    The index of the last character of the container file citation in the message.

                  - `file_id: string`

                    The ID of the file.

                  - `filename: string`

                    The filename of the container file cited.

                  - `start_index: number`

                    The index of the first character of the container file citation in the message.

                  - `type: "container_file_citation"`

                    The type of the container file citation. Always `container_file_citation`.

                    - `"container_file_citation"`

                - `FilePath object { file_id, index, type }`

                  A path to a file.

                  - `file_id: string`

                    The ID of the file.

                  - `index: number`

                    The index of the file in the list of files.

                  - `type: "file_path"`

                    The type of the file path. Always `file_path`.

                    - `"file_path"`

              - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

                - `top_logprobs: array of object { token, bytes, logprob }`

                  - `token: string`

                  - `bytes: array of number`

                  - `logprob: number`

              - `text: string`

                The text output from the model.

              - `type: "output_text"`

                The type of the output text. Always `output_text`.

                - `"output_text"`

            - `BetaResponseOutputRefusal object { refusal, type }`

              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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `phase: optional "commentary" or "final_answer" or 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"`

        - `FileSearchCall object { id, queries, status, 3 more }`

          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 of string`

            The queries used to search for files.

          - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

            The results of the file search tool call.

            - `attributes: optional map[string or number or boolean] or 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: optional string`

              The unique ID of the file.

            - `filename: optional string`

              The name of the file.

            - `score: optional number`

              The relevance score of the file - a value between 0 and 1.

            - `text: optional string`

              The text that was retrieved from the file.

        - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

          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 of object { id, code, message }`

            The pending safety checks for the computer call.

            - `id: string`

              The ID of the pending safety check.

            - `code: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

            A click action.

            - `Click object { button, type, x, 2 more }`

              A click action.

              - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

                The keys being held while clicking.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

              - `keys: array of string or 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 object { path, type, keys }`

              A drag action.

              - `path: array of object { x, y }`

                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: optional array of string or null`

                The keys being held while dragging the mouse.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

              - `keys: array of 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 object { type, x, y, keys }`

              A mouse move action.

              - `type: "move"`

                Specifies the event type. For a move action, this property is always set to `move`.

                - `"move"`

              - `x: number`

                The x-coordinate to move to.

              - `y: number`

                The y-coordinate to move to.

              - `keys: optional array of string or null`

                The keys being held while moving the mouse.

            - `Screenshot object { type }`

              A screenshot action.

              - `type: "screenshot"`

                Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

                - `"screenshot"`

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

              - `scroll_x: number`

                The horizontal scroll distance.

              - `scroll_y: number`

                The vertical scroll distance.

              - `type: "scroll"`

                Specifies the event type. For a scroll action, this property is always set to `scroll`.

                - `"scroll"`

              - `x: number`

                The x-coordinate where the scroll occurred.

              - `y: number`

                The y-coordinate where the scroll occurred.

              - `keys: optional array of string or null`

                The keys being held while scrolling.

            - `Type object { text, type }`

              An action to type in text.

              - `text: string`

                The text to type.

              - `type: "type"`

                Specifies the event type. For a type action, this property is always set to `type`.

                - `"type"`

            - `Wait object { type }`

              A wait action.

              - `type: "wait"`

                Specifies the event type. For a wait action, this property is always set to `wait`.

                - `"wait"`

          - `actions: optional BetaComputerActionList`

            Flattened batched actions for `computer_use`. Each action includes an
            `type` discriminator and action-specific fields.

            - `Click object { button, type, x, 2 more }`

              A click action.

            - `DoubleClick object { keys, type, x, y }`

              A double click action.

            - `Drag object { path, type, keys }`

              A drag action.

            - `Keypress object { keys, type }`

              A collection of keypresses the model would like to perform.

            - `Move object { type, x, y, keys }`

              A mouse move action.

            - `Screenshot object { type }`

              A screenshot action.

            - `Scroll object { scroll_x, scroll_y, type, 3 more }`

              A scroll action.

            - `Type object { text, type }`

              An action to type in text.

            - `Wait object { type }`

              A wait action.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ComputerCallOutput object { call_id, output, type, 4 more }`

          The output of a computer tool call.

          - `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: optional string`

              The identifier of an uploaded file that contains the screenshot.

            - `image_url: optional string`

              The URL of the screenshot image.

          - `type: "computer_call_output"`

            The type of the computer tool call output. Always `computer_call_output`.

            - `"computer_call_output"`

          - `id: optional string or null`

            The ID of the computer tool call output.

          - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

              The type of the pending safety check.

            - `message: optional string or null`

              Details about the pending safety check.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

        - `WebSearchCall object { id, status, type, 2 more }`

          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.

          - `status: "in_progress" or "searching" or "completed" or 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"`

          - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

            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 object { type, queries, query, sources }`

              Action type "search" - Performs a web search query.

              - `type: "search"`

                The action type.

                - `"search"`

              - `queries: optional array of string`

                The search queries.

              - `query: optional string`

                The search query.

              - `sources: optional array of object { type, url }`

                The sources used in the search.

                - `type: "url"`

                  The type of source. Always `url`.

                  - `"url"`

                - `url: string`

                  The URL of the source.

            - `OpenPage object { type, url }`

              Action type "open_page" - Opens a specific URL from search results.

              - `type: "open_page"`

                The action type.

                - `"open_page"`

              - `url: optional string or null`

                The URL opened by the model.

            - `FindInPage object { pattern, type, url }`

              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: optional string or null`

                The URL of the page searched for the pattern, when available.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `FunctionCall object { arguments, call_id, name, 7 more }`

          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: optional string`

            The unique ID of the function tool call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the function tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the function to run.

          - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

                - `text: string`

                  The text input to the model.

                - `type: "input_text"`

                  The type of the input item. Always `input_text`.

                  - `"input_text"`

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                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: optional BetaImageDetail or 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: optional string or null`

                  The ID of the file to be sent to the model.

                - `image_url: optional string or null`

                  The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "12h"`

                    The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                    - `"30m"`

                    - `"12h"`

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

                - `type: "input_file"`

                  The type of the input item. Always `input_file`.

                  - `"input_file"`

                - `detail: optional "auto" or "low" or "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: optional string or null`

                  The base64-encoded data of the file to be sent to the model.

                - `file_id: optional string or null`

                  The ID of the file to be sent to the model.

                - `file_url: optional string or null`

                  The URL of the file to be sent to the model.

                - `filename: optional string or null`

                  The name of the file to be sent to the model.

                - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                  Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                  - `mode: "explicit"`

                    The breakpoint mode. Always `explicit`.

                    - `"explicit"`

                  - `ttl: optional "30m" or "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: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

          A message routed between agents.

          - `author: string`

            The sending agent identity.

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

            Plaintext, image, or encrypted content sent between agents.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `EncryptedContent object { encrypted_content, type }`

              Opaque encrypted content that Responses API decrypts inside trusted model execution.

              - `encrypted_content: string`

                Opaque encrypted content.

              - `type: "encrypted_content"`

                The type of the input item. Always `encrypted_content`.

                - `"encrypted_content"`

          - `recipient: string`

            The destination agent identity.

          - `type: "agent_message"`

            The item type. Always `agent_message`.

            - `"agent_message"`

          - `id: optional string or null`

            The unique ID of this agent message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCall object { action, arguments, call_id, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

          - `type: "multi_agent_call"`

            The item type. Always `multi_agent_call`.

            - `"multi_agent_call"`

          - `id: optional string or null`

            The unique ID of this multi-agent call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

          - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

            Text output returned by the multi-agent action.

            - `text: string`

              The text content.

            - `type: "output_text"`

              The content type. Always `output_text`.

              - `"output_text"`

            - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

              Citations associated with the text content.

              - `FileCitation object { file_id, filename, index, type }`

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_citation"`

                  The citation type. Always `file_citation`.

                  - `"file_citation"`

              - `URLCitation object { end_index, start_index, title, 2 more }`

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `start_index: number`

                  The index of the first character of the citation in the message.

                - `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.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                - `container_id: string`

                  The ID of the container.

                - `end_index: number`

                  The index of the last character of the citation in the message.

                - `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.

                - `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: optional string or null`

            The unique ID of this multi-agent call output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ToolSearchCall object { arguments, type, id, 4 more }`

          - `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: optional string or null`

            The unique ID of this tool search call.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search call.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ToolSearchOutput object { tools, type, id, 4 more }`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            The loaded tool definitions returned by the tool search output.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                      - `type: "disabled"`

                        Disable outbound network access. Always `disabled`.

                        - `"disabled"`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                      - `allowed_domains: array of string`

                        A list of allowed domains when type is `allowlist`.

                      - `type: "allowlist"`

                        Allow outbound network access only to specified domains. Always `allowlist`.

                        - `"allowlist"`

                      - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                        Optional domain-scoped secrets for allowlisted domains.

                        - `domain: string`

                          The domain associated with the secret.

                        - `name: string`

                          The name of the secret to inject for the domain.

                        - `value: string`

                          The secret value to inject for the domain.

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                  - `type: "container_auto"`

                    Automatically creates a container for this request

                    - `"container_auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                    An optional list of skills referenced by id or inline data.

                    - `BetaSkillReference object { skill_id, type, version }`

                      - `skill_id: string`

                        The ID of the referenced skill.

                      - `type: "skill_reference"`

                        References a skill created with the /v1/skills endpoint.

                        - `"skill_reference"`

                      - `version: optional string`

                        Optional skill version. Use a positive integer or 'latest'. Omit for default.

                    - `BetaInlineSkill object { description, name, source, type }`

                      - `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.

                        - `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 object { type, skills }`

                  - `type: "local"`

                    Use a local computer environment.

                    - `"local"`

                  - `skills: optional array of BetaLocalSkill`

                    An optional list of skills.

                    - `description: string`

                      The description of the skill.

                    - `name: string`

                      The name of the skill.

                    - `path: string`

                      The path to the directory containing the skill.

                - `BetaContainerReference object { container_id, type }`

                  - `container_id: string`

                    The ID of the referenced container.

                  - `type: "container_reference"`

                    References a container created with the /v1/containers endpoint

                    - `"container_reference"`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools loaded inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                    The name of the loaded function tool.

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "tool_search_output"`

            The item type. Always `tool_search_output`.

            - `"tool_search_output"`

          - `id: optional string or null`

            The unique ID of this tool search output.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the tool search call generated by the model.

          - `execution: optional "server" or "client"`

            Whether tool search was executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the tool search output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `AdditionalTools object { role, tools, type, 2 more }`

          - `role: "developer"`

            The role that provided the additional tools. Only `developer` is supported.

            - `"developer"`

          - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

            A list of additional tools made available at this item.

            - `Function object { name, parameters, strict, 6 more }`

              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: map[unknown] or null`

                A JSON schema object describing the parameters of the function.

              - `strict: boolean or null`

                Whether strict parameter validation is enforced for this function tool.

              - `type: "function"`

                The type of the function tool. Always `function`.

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

              - `defer_loading: optional boolean`

                Whether this function is deferred and loaded via tool search.

              - `description: optional string or null`

                A description of the function. Used by the model to determine whether or not to call the function.

              - `output_schema: optional map[unknown] or null`

                A JSON schema object describing the JSON value encoded in string outputs for this function.

            - `FileSearch object { type, vector_store_ids, filters, 2 more }`

              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 of string`

                The IDs of the vector stores to search.

              - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

                A filter to apply.

                - `ComparisonFilter object { key, type, value }`

                  A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                  - `key: string`

                    The key to compare against the value.

                  - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                    The value to compare against the attribute key; supports string, number, or boolean types.

                    - `string`

                    - `number`

                    - `boolean`

                    - `array of string or number`

                      - `string`

                      - `number`

                - `BetaCompoundFilter = unknown`

                  Combine multiple filters using `and` or `or`.

              - `max_num_results: optional number`

                The maximum number of results to return. This number should be between 1 and 50 inclusive.

              - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

                Ranking options for search.

                - `hybrid_search: optional object { embedding_weight, text_weight }`

                  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: optional "auto" or "default-2024-11-15"`

                  The ranker to use for the file search.

                  - `"auto"`

                  - `"default-2024-11-15"`

                - `score_threshold: optional 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.

            - `Computer object { type }`

              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"`

            - `ComputerUsePreview object { display_height, display_width, environment, type }`

              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" or "mac" or "linux" or 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"`

            - `WebSearch object { type, external_web_access, filters, 2 more }`

              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" or "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: optional 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: optional object { allowed_domains }  or null`

                Filters for the search.

                - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

                - `type: optional "approximate"`

                  The type of location approximation. Always `approximate`.

                  - `"approximate"`

            - `Mcp object { server_label, type, allowed_callers, 9 more }`

              Give the model access to additional tools via remote Model Context Protocol
              (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

                List of allowed tool names or a filter object.

                - `McpAllowedTools = array of string`

                  A string array of allowed tool names

                - `McpToolFilter object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

                Whether this MCP tool is deferred and discovered via tool search.

              - `headers: optional map[string] or null`

                Optional HTTP headers to send to the MCP server. Use for authentication
                or other purposes.

              - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

                Specify which of the MCP server's tools require approval.

                - `McpToolApprovalFilter object { always, never }`

                  Specify which of the MCP server's tools require approval. Can be
                  `always`, `never`, or a filter object associated with tools
                  that require approval.

                  - `always: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                  - `never: optional object { read_only, tool_names }`

                    A filter object to specify which tools are allowed.

                    - `read_only: optional 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: optional array of string`

                      List of allowed tool names.

                - `McpToolApprovalSetting = "always" or "never"`

                  Specify a single approval policy for all tools. One of `always` or
                  `never`. When set to `always`, all tools will require approval. When
                  set to `never`, all tools will not require approval.

                  - `"always"`

                  - `"never"`

              - `server_description: optional string`

                Optional description of the MCP server, used to provide more context.

              - `server_url: optional string`

                The URL for the MCP server. One of `server_url`, `connector_id`, or
                `tunnel_id` must be provided.

              - `tunnel_id: optional 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 object { container, type, allowed_callers }`

              A tool that runs Python code to help generate a response to a prompt.

              - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

                The code interpreter container. Can be a container ID or an object that
                specifies uploaded file IDs to make available to your code, along with an
                optional `memory_limit` setting.

                - `string`

                  The container ID.

                - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                  Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                  - `type: "auto"`

                    Always `auto`.

                    - `"auto"`

                  - `file_ids: optional array of string`

                    An optional list of uploaded files to make available to your code.

                  - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                    The memory limit for the code interpreter container.

                    - `"1g"`

                    - `"4g"`

                    - `"16g"`

                    - `"64g"`

                  - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                    Network access policy for the container.

                    - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `type: "code_interpreter"`

                The type of the code interpreter tool. Always `code_interpreter`.

                - `"code_interpreter"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

            - `ProgrammaticToolCalling object { type }`

              - `type: "programmatic_tool_calling"`

                The type of the tool. Always `programmatic_tool_calling`.

                - `"programmatic_tool_calling"`

            - `ImageGeneration object { type, action, background, 9 more }`

              A tool that generates images using the GPT image models.

              - `type: "image_generation"`

                The type of the image generation tool. Always `image_generation`.

                - `"image_generation"`

              - `action: optional "generate" or "edit" or "auto"`

                Whether to generate a new image or edit an existing image. Default: `auto`.

                - `"generate"`

                - `"edit"`

                - `"auto"`

              - `background: optional "transparent" or "opaque" or "auto"`

                Set the background of the generated image. One of `transparent`, `opaque`,
                or `auto`. `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`.
                Default: `auto`.

                - `"transparent"`

                - `"opaque"`

                - `"auto"`

              - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

                Optional mask for inpainting. Contains `image_url`
                (string, optional) and `file_id` (string, optional).

                - `file_id: optional string`

                  File ID for the mask image.

                - `image_url: optional string`

                  Base64-encoded mask image.

              - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `string`

                - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                  The image generation model to use. One of `gpt-image-1`,
                  `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`, or `chatgpt-image-latest`. Default:
                  `gpt-image-1`.

                  - `"gpt-image-1"`

                  - `"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"`

              - `moderation: optional "auto" or "low"`

                Moderation level for the generated image. Default: `auto`.

                - `"auto"`

                - `"low"`

              - `output_compression: optional number`

                Compression level for the output image. Default: 100.

              - `output_format: optional "png" or "webp" or "jpeg"`

                The output format of the generated image. One of `png`, `webp`, or
                `jpeg`. Default: `png`.

                - `"png"`

                - `"webp"`

                - `"jpeg"`

              - `partial_images: optional number`

                Number of partial images to generate in streaming mode, from 0 (default value) to 3.

              - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                  - `"1024x1024"`

                  - `"1024x1536"`

                  - `"1536x1024"`

                  - `"auto"`

            - `LocalShell object { type }`

              A tool that allows the model to execute shell commands in a local environment.

              - `type: "local_shell"`

                The type of the local shell tool. Always `local_shell`.

                - `"local_shell"`

            - `Shell object { type, allowed_callers, environment }`

              A tool that allows the model to execute shell commands.

              - `type: "shell"`

                The type of the shell tool. Always `shell`.

                - `"shell"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

                - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `BetaLocalEnvironment object { type, skills }`

                - `BetaContainerReference object { container_id, type }`

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "regex"`

                    The syntax of the grammar definition. One of `lark` or `regex`.

                    - `"lark"`

                    - `"regex"`

                  - `type: "grammar"`

                    Grammar format. Always `grammar`.

                    - `"grammar"`

            - `Namespace object { description, name, tools, type }`

              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`).

              - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

                The function/custom tools available inside this namespace.

                - `Function object { name, type, allowed_callers, 6 more }`

                  - `name: string`

                  - `type: "function"`

                    - `"function"`

                  - `allowed_callers: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this function should be deferred and discovered via tool search.

                  - `description: optional string or null`

                  - `output_schema: optional map[unknown] or null`

                    A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                  - `parameters: optional unknown or null`

                  - `strict: optional boolean or 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.

                - `Custom object { name, type, allowed_callers, 4 more }`

                  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: optional array of "direct" or "programmatic" or null`

                    The tool invocation context(s).

                    - `"direct"`

                    - `"programmatic"`

                  - `async: optional boolean`

                    Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                  - `defer_loading: optional boolean`

                    Whether this tool should be deferred and discovered via tool search.

                  - `description: optional string`

                    Optional description of the custom tool, used to provide more context.

                  - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                    The input format for the custom tool. Default is unconstrained text.

                    - `Text object { type }`

                      Unconstrained free-form text.

                      - `type: "text"`

                        Unconstrained text format. Always `text`.

                        - `"text"`

                    - `Grammar object { definition, syntax, type }`

                      A grammar defined by the user.

                      - `definition: string`

                        The grammar definition.

                      - `syntax: "lark" or "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"`

            - `ToolSearch object { type, description, execution, parameters }`

              Hosted or BYOT tool search configuration for deferred tools.

              - `type: "tool_search"`

                The type of the tool. Always `tool_search`.

                - `"tool_search"`

              - `description: optional string or null`

                Description shown to the model for a client-executed tool search tool.

              - `execution: optional "server" or "client"`

                Whether tool search is executed by the server or by the client.

                - `"server"`

                - `"client"`

              - `parameters: optional unknown or null`

                Parameter schema for a client-executed tool search tool.

            - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

              This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

              - `type: "web_search_preview" or "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: optional array of "text" or "image"`

                - `"text"`

                - `"image"`

              - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                  Free text input for the city of the user, e.g. `San Francisco`.

                - `country: optional string or null`

                  The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

                - `region: optional string or null`

                  Free text input for the region of the user, e.g. `California`.

                - `timezone: optional string or null`

                  The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `ApplyPatch object { type, allowed_callers }`

              Allows the assistant to create, delete, or update files using unified diffs.

              - `type: "apply_patch"`

                The type of the tool. Always `apply_patch`.

                - `"apply_patch"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

          - `type: "additional_tools"`

            The item type. Always `additional_tools`.

            - `"additional_tools"`

          - `id: optional string or null`

            The unique ID of this additional tools item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ConfigurationUpdate object { type, id, agent, reasoning }`

          An update to the conversation's response configuration. The configuration
          remains in effect for subsequent responses until it is replaced by another
          configuration update.

          - `type: "configuration_update"`

            The item type. Always `configuration_update`.

            - `"configuration_update"`

          - `id: optional string or null`

            The unique ID of the configuration update item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reasoning: optional object { effort }`

            Updates to reasoning configuration. Only effort is supported.

            - `effort: optional "none" or "minimal" or "low" or 4 more or null`

              The reasoning effort to use for subsequent responses until another
              configuration update replaces it.

              - `"none"`

              - `"minimal"`

              - `"low"`

              - `"medium"`

              - `"high"`

              - `"xhigh"`

              - `"max"`

        - `Reasoning object { id, summary, type, 4 more }`

          A description of the chain of thought used by a reasoning model while generating
          a response. Be sure to include these items in your `input` to the Responses API
          for subsequent turns of a conversation if you are manually
          [managing context](/api/docs/guides/conversation-state).

          - `id: string`

            The unique identifier of the reasoning content.

          - `summary: array of object { text, type }`

            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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `content: optional array of object { text, type }`

            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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

            The status of the item. One of `in_progress`, `completed`, or
            `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `Compaction object { encrypted_content, type, id, agent }`

          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.

          - `type: "compaction"`

            The type of the item. Always `compaction`.

            - `"compaction"`

          - `id: optional string or null`

            The ID of the compaction item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ImageGenerationCall object { id, result, status, 9 more }`

          An image generation request made by the model.

          - `id: string`

            The unique ID of the image generation call.

          - `result: string or null`

            The generated image encoded in base64.

          - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

            The action used for image generation.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `background: optional "transparent" or "opaque" or "auto" or null`

            The background setting used for generation.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `error: optional object { code, message, param, 2 more }`

            Details of a moderation failure, when available.

            - `code: string or null`

              The error code.

            - `message: string`

              A description of the error.

            - `param: string or null`

              The related request parameter.

            - `type: string`

              The error type.

            - `moderation_details: optional object { categories, moderation_stage }`

              Public details for a `moderation_blocked` error, when available.

              - `categories: array of string`

                Public moderation categories. New category values may be added over time.

              - `moderation_stage: "input" or "output" or "unknown"`

                The stage where moderation blocked the image generation call.

                - `"input"`

                - `"output"`

                - `"unknown"`

          - `output_format: optional "png" or "webp" or "jpeg" or null`

            The output format used for generation.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

            The prompt that was used after any model prompt rewriting.

          - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `string`

            - `"1024x1024" or "1024x1536" or "1536x1024"`

              The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

        - `CodeInterpreterCall object { id, code, container_id, 4 more }`

          A tool call to run code.

          - `id: string`

            The unique ID of the code interpreter tool call.

          - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

            The outputs generated by the code interpreter, such as logs or images.
            Can be null if no outputs are available.

            - `Logs object { logs, type }`

              The logs output from the code interpreter.

              - `logs: string`

                The logs output from the code interpreter.

              - `type: "logs"`

                The type of the output. Always `logs`.

                - `"logs"`

            - `Image object { type, url }`

              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.

          - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCall object { id, action, call_id, 3 more }`

          A tool call to run a command on the local shell.

          - `id: string`

            The unique ID of the local shell call.

          - `action: object { command, env, type, 3 more }`

            Execute a shell command on the server.

            - `command: array of string`

              The command to run.

            - `env: map[string]`

              Environment variables to set for the command.

            - `type: "exec"`

              The type of the local shell action. Always `exec`.

              - `"exec"`

            - `timeout_ms: optional number or null`

              Optional timeout in milliseconds for the command.

            - `user: optional string or null`

              Optional user to run the command as.

            - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `LocalShellCallOutput object { id, output, type, 2 more }`

          The output of a local shell tool call.

          - `id: string`

            The unique ID of the local shell tool call generated by the model.

          - `output: string`

            A JSON string of the output of the local shell tool call.

          - `type: "local_shell_call_output"`

            The type of the local shell tool call output. Always `local_shell_call_output`.

            - `"local_shell_call_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCall object { action, call_id, type, 5 more }`

          A tool representing a request to execute one or more shell commands.

          - `action: object { commands, max_output_length, timeout_ms }`

            The shell commands and limits that describe how to run the tool call.

            - `commands: array of string`

              Ordered shell commands for the execution environment to run.

            - `max_output_length: optional number or null`

              Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

            - `timeout_ms: optional number or 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.

          - `type: "shell_call"`

            The type of the item. Always `shell_call`.

            - `"shell_call"`

          - `id: optional string or null`

            The unique ID of the shell tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

            The environment to execute the shell commands in.

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ShellCallOutput object { call_id, output, type, 5 more }`

          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.

          - `output: array of BetaResponseFunctionShellCallOutputContent`

            Captured chunks of stdout and stderr output, along with their associated outcomes.

            - `outcome: Timeout { type }  or Exit { exit_code, type }`

              The exit or timeout outcome associated with this shell call.

              - `Timeout object { type }`

                Indicates that the shell call exceeded its configured time limit.

                - `type: "timeout"`

                  The outcome type. Always `timeout`.

                  - `"timeout"`

              - `Exit object { exit_code, type }`

                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.

            - `stdout: string`

              Captured stdout output for the shell call.

          - `type: "shell_call_output"`

            The type of the item. Always `shell_call_output`.

            - `"shell_call_output"`

          - `id: optional string or null`

            The unique ID of the shell tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `max_output_length: optional number or null`

            The maximum number of UTF-8 characters captured for this shell call's combined output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the shell call output.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

        - `ApplyPatchCall object { call_id, operation, status, 4 more }`

          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.

          - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

            The specific create, delete, or update instruction for the apply_patch tool call.

            - `CreateFile object { diff, path, type }`

              Instruction for creating a new file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply when creating the file.

              - `path: string`

                Path of the file to create relative to the workspace root.

              - `type: "create_file"`

                The operation type. Always `create_file`.

                - `"create_file"`

            - `DeleteFile object { path, type }`

              Instruction for deleting an existing file via the apply_patch tool.

              - `path: string`

                Path of the file to delete relative to the workspace root.

              - `type: "delete_file"`

                The operation type. Always `delete_file`.

                - `"delete_file"`

            - `UpdateFile object { diff, path, type }`

              Instruction for updating an existing file via the apply_patch tool.

              - `diff: string`

                Unified diff content to apply to the existing file.

              - `path: string`

                Path of the file to update relative to the workspace root.

              - `type: "update_file"`

                The operation type. Always `update_file`.

                - `"update_file"`

          - `status: "in_progress" or "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: optional string or null`

            The unique ID of the apply patch tool call. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

          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.

          - `status: "completed" or "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: optional string or null`

            The unique ID of the apply patch tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `output: optional string or null`

            Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

        - `McpListTools object { id, server_label, tools, 3 more }`

          A list of tools available on an MCP server.

          - `id: string`

            The unique ID of the list.

          - `server_label: string`

            The label of the MCP server.

          - `tools: array of object { input_schema, name, annotations, description }`

            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: optional unknown or null`

              Additional annotations about the tool.

            - `description: optional string or null`

              The description of the tool.

          - `type: "mcp_list_tools"`

            The type of the item. Always `mcp_list_tools`.

            - `"mcp_list_tools"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `error: optional string or null`

            Error message if the server could not list tools.

        - `McpApprovalRequest object { id, arguments, name, 3 more }`

          A request for human approval of a tool invocation.

          - `id: string`

            The unique ID of the approval request.

          - `arguments: string`

            A JSON string of arguments for the tool.

          - `name: string`

            The name of the tool to run.

          - `server_label: string`

            The label of the MCP server making the request.

          - `type: "mcp_approval_request"`

            The type of the item. Always `mcp_approval_request`.

            - `"mcp_approval_request"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

          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: optional string or null`

            The unique ID of the approval response

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `reason: optional string or null`

            Optional reason for the decision.

        - `McpCall object { id, arguments, name, 7 more }`

          An invocation of a tool on an MCP server.

          - `id: string`

            The unique ID of the tool call.

          - `arguments: string`

            A JSON string of the arguments passed to the tool.

          - `name: string`

            The name of the tool that was run.

          - `server_label: string`

            The label of the MCP server running the tool.

          - `type: "mcp_call"`

            The type of the item. Always `mcp_call`.

            - `"mcp_call"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

            The error from the tool call, if any.

            - `McpProtocolError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "mcp_protocol_error"`

                - `"mcp_protocol_error"`

            - `McpToolExecutionError object { content, type }`

              - `content: unknown`

              - `type: "mcp_tool_execution_error"`

                - `"mcp_tool_execution_error"`

            - `HTTPError object { code, message, type }`

              - `code: number`

              - `message: string`

              - `type: "http_error"`

                - `"http_error"`

          - `output: optional string or null`

            The output from the tool call.

          - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

            The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

            - `"calling"`

            - `"failed"`

        - `CustomToolCallOutput object { call_id, output, type, 3 more }`

          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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            The output from the custom tool call generated by your code.
            Can be a string or an list of output content.

            - `StringOutput = string`

              A string of the output of the custom tool call.

            - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

              Text, image, or file output of the custom tool call.

              - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

              - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

                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: optional string`

            The unique ID of the custom tool call output in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

        - `CustomToolCall object { call_id, input, name, 6 more }`

          A call to a custom tool created by the model.

          - `call_id: string`

            An identifier used to map this custom tool call to a tool call output.

          - `input: string`

            The input for the custom tool call generated by the model.

          - `name: string`

            The name of the custom tool being called.

          - `type: "custom_tool_call"`

            The type of the custom tool call. Always `custom_tool_call`.

            - `"custom_tool_call"`

          - `id: optional string`

            The unique ID of the custom tool call in the OpenAI platform.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `async: optional boolean`

            Whether the custom tool call runs asynchronously.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                - `"program"`

          - `namespace: optional string`

            The namespace of the custom tool being called.

        - `CompactionTrigger object { type, id, agent }`

          Compacts the current context. Must be the final input item.

          - `type: "compaction_trigger"`

            The type of the item. Always `compaction_trigger`.

            - `"compaction_trigger"`

          - `id: optional string or null`

            The unique ID of this compaction trigger.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ItemReference object { id, agent, type }`

          An internal identifier for an item to reference.

          - `id: string`

            The ID of the item to reference.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `type: optional "item_reference" or null`

            The type of item to reference. Always `item_reference`.

            - `"item_reference"`

        - `Program object { id, call_id, code, 3 more }`

          - `id: string`

            The unique ID of this 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 item type. Always `program`.

            - `"program"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

        - `ProgramOutput object { id, call_id, result, 3 more }`

          - `id: string`

            The unique ID of this program output item.

          - `call_id: string`

            The call ID of the program item.

          - `result: string`

            The result produced by the program item.

          - `status: "completed" or "incomplete"`

            The terminal status of the program output.

            - `"completed"`

            - `"incomplete"`

          - `type: "program_output"`

            The item type. Always `program_output`.

            - `"program_output"`

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

    - `instructions: optional string or 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.

    - `max_output_tokens: optional number or 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: optional number or 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.

    - `metadata: optional map[string] or 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: optional "gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 more or 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.

      - `"gpt-6-astra" or "gpt-6.1-sol" or "gpt-6-sol" or 106 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-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-rosalind-research"`

      - `string`

    - `moderation: optional object { model, policy }  or null`

      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: optional object { input, output }  or null`

        The policy to apply to moderated response input and output.

        - `input: optional object { mode }  or null`

          The moderation policy for the response input.

          - `mode: "score" or "block"`

            - `"score"`

            - `"block"`

        - `output: optional object { mode }  or null`

          The moderation policy for the response output.

          - `mode: "score" or "block"`

            - `"score"`

            - `"block"`

    - `multi_agent: optional object { enabled, max_concurrent_subagents }  or null`

      Configuration for server-hosted multi-agent execution.

      - `enabled: boolean`

        Whether to enable server-hosted multi-agent execution for this response.

      - `max_concurrent_subagents: optional 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.

    - `parallel_tool_calls: optional boolean or null`

      Whether to allow the model to run tool calls in parallel.

    - `previous_response_id: optional string or 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: optional BetaResponsePrompt or 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: optional map[string or BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile] or 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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

      - `version: optional string or null`

        Optional version of the prompt template.

    - `prompt_cache_key: optional string or 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: optional object { comparison_response_id, mode, prewarm, ttl }`

      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`, which is currently the only supported value. See the [prompt caching guide](/api/docs/guides/prompt-caching) for current details.

      - `comparison_response_id: optional string or 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: optional "implicit" or "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: optional boolean`

        Prepares the prompt cache without generating output. Defaults to `false`. When set to `true`, overrides the `generate` field to `false`.

      - `ttl: optional "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: optional "in_memory" or "24h" or 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: optional object { context, effort, generate_summary, 2 more }  or null`

      Configuration options for
      [reasoning models](/api/docs/guides/reasoning).

      - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

        Controls the reasoning execution mode for the request.

        When returned on a response, this is the effective execution mode.

        - `string`

        - `"standard" or "pro"`

          Controls the reasoning execution mode for the request.

          When returned on a response, this is the effective execution mode.

          - `"standard"`

          - `"pro"`

      - `summary: optional "auto" or "concise" or "detailed" or 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: optional string or 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).

    - `service_tier: optional BetaServiceTier or 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"`

    - `store: optional boolean or null`

      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: optional boolean or null`

      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.

    - `stream_id: optional string`

      The WebSocket lane for this response. Requests with the same
      `stream_id` are processed FIFO, and events for the response echo the
      same `stream_id`.

      `stream_id` controls routing; `previous_response_id` controls
      conversation lineage, so a new lane can fork from a response created
      on another lane.

    - `stream_options: optional object { include_obfuscation }  or null`

      Options for streaming responses. Only set this when you set `stream: true`.

      - `include_obfuscation: optional 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: optional number or 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.

    - `text: optional 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: optional 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 object { type }`

          Default response format. Used to generate text responses.

          - `type: "text"`

            The type of response format being defined. Always `text`.

            - `"text"`

        - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

          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: map[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: optional string`

            A description of what the response format is for, used by the model to
            determine how to respond in the format.

          - `strict: optional boolean or 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 object { type }`

          JSON object response format. An older method of generating JSON responses.
          Using `json_schema` is recommended for models that support it. Note that the
          model will not generate JSON without a system or user message instructing it
          to do so.

          - `type: "json_object"`

            The type of response format being defined. Always `json_object`.

            - `"json_object"`

      - `verbosity: optional "low" or "medium" or "high" or 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: optional BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 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" or "auto" or "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 object { mode, tools, type }`

        Constrains the tools available to the model to a pre-defined set.

        - `mode: "auto" or "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 of map[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 object { type }`

        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" or "web_search_preview" or "computer" or 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 object { name, type }`

        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 object { server_label, type, name }`

        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: optional string or null`

          The name of the tool to call on the server.

      - `BetaToolChoiceCustom object { name, type }`

        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 object { type }`

        - `type: "programmatic_tool_calling"`

          The tool to call. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `BetaToolChoiceApplyPatch object { type }`

        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 object { type }`

        Forces the model to call the shell tool when a tool call is required.

        - `type: "shell"`

          The tool to call. Always `shell`.

          - `"shell"`

    - `tools: optional array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

      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.

      - `Function object { name, parameters, strict, 6 more }`

        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: map[unknown] or null`

          A JSON schema object describing the parameters of the function.

        - `strict: boolean or null`

          Whether strict parameter validation is enforced for this function tool.

        - `type: "function"`

          The type of the function tool. Always `function`.

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

        - `defer_loading: optional boolean`

          Whether this function is deferred and loaded via tool search.

        - `description: optional string or null`

          A description of the function. Used by the model to determine whether or not to call the function.

        - `output_schema: optional map[unknown] or null`

          A JSON schema object describing the JSON value encoded in string outputs for this function.

      - `FileSearch object { type, vector_store_ids, filters, 2 more }`

        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 of string`

          The IDs of the vector stores to search.

        - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

          A filter to apply.

          - `ComparisonFilter object { key, type, value }`

            A filter used to compare a specified attribute key to a given value using a defined comparison operation.

            - `key: string`

              The key to compare against the value.

            - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

              The value to compare against the attribute key; supports string, number, or boolean types.

              - `string`

              - `number`

              - `boolean`

              - `array of string or number`

                - `string`

                - `number`

          - `BetaCompoundFilter = unknown`

            Combine multiple filters using `and` or `or`.

        - `max_num_results: optional number`

          The maximum number of results to return. This number should be between 1 and 50 inclusive.

        - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

          Ranking options for search.

          - `hybrid_search: optional object { embedding_weight, text_weight }`

            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: optional "auto" or "default-2024-11-15"`

            The ranker to use for the file search.

            - `"auto"`

            - `"default-2024-11-15"`

          - `score_threshold: optional 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.

      - `Computer object { type }`

        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"`

      - `ComputerUsePreview object { display_height, display_width, environment, type }`

        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" or "mac" or "linux" or 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"`

      - `WebSearch object { type, external_web_access, filters, 2 more }`

        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" or "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: optional 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: optional object { allowed_domains }  or null`

          Filters for the search.

          - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `type: optional "approximate"`

            The type of location approximation. Always `approximate`.

            - `"approximate"`

      - `Mcp object { server_label, type, allowed_callers, 9 more }`

        Give the model access to additional tools via remote Model Context Protocol
        (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

          List of allowed tool names or a filter object.

          - `McpAllowedTools = array of string`

            A string array of allowed tool names

          - `McpToolFilter object { read_only, tool_names }`

            A filter object to specify which tools are allowed.

            - `read_only: optional 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: optional array of string`

              List of allowed tool names.

        - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

          Whether this MCP tool is deferred and discovered via tool search.

        - `headers: optional map[string] or null`

          Optional HTTP headers to send to the MCP server. Use for authentication
          or other purposes.

        - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

          Specify which of the MCP server's tools require approval.

          - `McpToolApprovalFilter object { always, never }`

            Specify which of the MCP server's tools require approval. Can be
            `always`, `never`, or a filter object associated with tools
            that require approval.

            - `always: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

            - `never: optional object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `McpToolApprovalSetting = "always" or "never"`

            Specify a single approval policy for all tools. One of `always` or
            `never`. When set to `always`, all tools will require approval. When
            set to `never`, all tools will not require approval.

            - `"always"`

            - `"never"`

        - `server_description: optional string`

          Optional description of the MCP server, used to provide more context.

        - `server_url: optional string`

          The URL for the MCP server. One of `server_url`, `connector_id`, or
          `tunnel_id` must be provided.

        - `tunnel_id: optional 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 object { container, type, allowed_callers }`

        A tool that runs Python code to help generate a response to a prompt.

        - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

          The code interpreter container. Can be a container ID or an object that
          specifies uploaded file IDs to make available to your code, along with an
          optional `memory_limit` setting.

          - `string`

            The container ID.

          - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

            Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

            - `type: "auto"`

              Always `auto`.

              - `"auto"`

            - `file_ids: optional array of string`

              An optional list of uploaded files to make available to your code.

            - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

              The memory limit for the code interpreter container.

              - `"1g"`

              - `"4g"`

              - `"16g"`

              - `"64g"`

            - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

              Network access policy for the container.

              - `BetaContainerNetworkPolicyDisabled object { type }`

              - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

        - `type: "code_interpreter"`

          The type of the code interpreter tool. Always `code_interpreter`.

          - `"code_interpreter"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

      - `ProgrammaticToolCalling object { type }`

        - `type: "programmatic_tool_calling"`

          The type of the tool. Always `programmatic_tool_calling`.

          - `"programmatic_tool_calling"`

      - `ImageGeneration object { type, action, background, 9 more }`

        A tool that generates images using the GPT image models.

        - `type: "image_generation"`

          The type of the image generation tool. Always `image_generation`.

          - `"image_generation"`

        - `action: optional "generate" or "edit" or "auto"`

          Whether to generate a new image or edit an existing image. Default: `auto`.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `background: optional "transparent" or "opaque" or "auto"`

          Set the background of the generated image. One of `transparent`, `opaque`,
          or `auto`. `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`.
          Default: `auto`.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

          Optional mask for inpainting. Contains `image_url`
          (string, optional) and `file_id` (string, optional).

          - `file_id: optional string`

            File ID for the mask image.

          - `image_url: optional string`

            Base64-encoded mask image.

        - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

          The image generation model to use. One of `gpt-image-1`,
          `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`, or `chatgpt-image-latest`. Default:
          `gpt-image-1`.

          - `string`

          - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `"gpt-image-1"`

            - `"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"`

        - `moderation: optional "auto" or "low"`

          Moderation level for the generated image. Default: `auto`.

          - `"auto"`

          - `"low"`

        - `output_compression: optional number`

          Compression level for the output image. Default: 100.

        - `output_format: optional "png" or "webp" or "jpeg"`

          The output format of the generated image. One of `png`, `webp`, or
          `jpeg`. Default: `png`.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `partial_images: optional number`

          Number of partial images to generate in streaming mode, from 0 (default value) to 3.

        - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

            - `"auto"`

      - `LocalShell object { type }`

        A tool that allows the model to execute shell commands in a local environment.

        - `type: "local_shell"`

          The type of the local shell tool. Always `local_shell`.

          - `"local_shell"`

      - `Shell object { type, allowed_callers, environment }`

        A tool that allows the model to execute shell commands.

        - `type: "shell"`

          The type of the shell tool. Always `shell`.

          - `"shell"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

          - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "regex"`

              The syntax of the grammar definition. One of `lark` or `regex`.

              - `"lark"`

              - `"regex"`

            - `type: "grammar"`

              Grammar format. Always `grammar`.

              - `"grammar"`

      - `Namespace object { description, name, tools, type }`

        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`).

        - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

          The function/custom tools available inside this namespace.

          - `Function object { name, type, allowed_callers, 6 more }`

            - `name: string`

            - `type: "function"`

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this function should be deferred and discovered via tool search.

            - `description: optional string or null`

            - `output_schema: optional map[unknown] or null`

              A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

            - `parameters: optional unknown or null`

            - `strict: optional boolean or 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.

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "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"`

      - `ToolSearch object { type, description, execution, parameters }`

        Hosted or BYOT tool search configuration for deferred tools.

        - `type: "tool_search"`

          The type of the tool. Always `tool_search`.

          - `"tool_search"`

        - `description: optional string or null`

          Description shown to the model for a client-executed tool search tool.

        - `execution: optional "server" or "client"`

          Whether tool search is executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `parameters: optional unknown or null`

          Parameter schema for a client-executed tool search tool.

      - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

        This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

        - `type: "web_search_preview" or "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: optional array of "text" or "image"`

          - `"text"`

          - `"image"`

        - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

            Free text input for the city of the user, e.g. `San Francisco`.

          - `country: optional string or null`

            The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

          - `region: optional string or null`

            Free text input for the region of the user, e.g. `California`.

          - `timezone: optional string or null`

            The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `ApplyPatch object { type, allowed_callers }`

        Allows the assistant to create, delete, or update files using unified diffs.

        - `type: "apply_patch"`

          The type of the tool. Always `apply_patch`.

          - `"apply_patch"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

    - `top_logprobs: optional number or 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.

    - `top_p: optional number or 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.

    - `truncation: optional "auto" or "disabled" or 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.
      - `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: optional string or null`

      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).

  - `BetaResponseSteerEvent object { input, previous_response_id, type }`

    Queues user input to steer a response on this WebSocket connection. Input
    can contain text, images, and files. Steering is supported only for
    single-agent responses on models and execution modes that support steering.
    Responses bound to a conversation or using automatic compaction do not
    support steering.

    A `response.steer.accepted` event acknowledges that the server owns the
    queued input, not that it has been applied. The successor's `response.created`
    event is the commit point. Input that cannot be committed is returned in
    `response.steer.failed`.

    Steering may cause the active response to finish at a safe output boundary
    with `response.incomplete` and `incomplete_details.reason` set to `steered`,
    followed automatically by a successor `response.created`. Normal completion
    can also be followed by an automatic successor. Automatic successors inherit
    the previous response's settings and continue from it with the queued input.

    If the response stops for client-owned tool output or approval, accepted
    steering input remains queued and `response.steer.pending` is emitted after
    `response.completed`. Fill the `required_input` stubs from that event with
    saved tool results or approval decisions, and send one explicit
    `response.create` per parent with the same `previous_response_id` and
    WebSocket lane. Do not rerun tools or resend accepted steering input. The
    queued input is prepended in submission order to that request's input, and
    the explicit request retains its own settings.

    This event accepts only `type`, `previous_response_id`, and `input`. Do not
    send `stream_id`; the target response determines the WebSocket lane.

    - `input: BetaResponseSteerInput`

      Input to queue for a continuation of the response. Uses the same string or
      input-item shape as `response.create.input`, with a non-empty array when
      supplying input items.

      Steering accepts only messages with the `user` role. Each message may
      contain only `type`, `role`, and `content`, with `content` as a string or an
      array of `input_text`, `input_image`, and `input_file` parts. The optional
      `type` must be `message`. Other roles, tool outputs, and item types are not
      supported for steering.

      - `TextInput = string`

        A text input, equivalent to a message with the `user` role.

      - `ResponseSteerInputItemList = array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

        A non-empty list of message inputs to queue for the response.

        - `Message object { content, role, type, 3 more }`

          - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent or string`

            The message content, as an array of content parts.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

            - `string`

              The message content, as a single string.

          - `role: "user"`

            The message role. Always `user`.

            - `"user"`

          - `type: "message"`

            The item type. Always `message`.

            - `"message"`

          - `id: optional string or null`

            The unique ID of this message item.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `status: optional string or null`

            The status of the message item.

        - `FunctionCallOutput object { output, type, id, 6 more }`

          The output of a function tool call.

          - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            Text, image, or file output of the function tool call.

            - `string`

              A JSON string of the output of the function tool call.

            - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              An array of content outputs (text, image, file) for the function tool call.

              - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                A text input to the model.

              - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

              - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                A file input to the model.

          - `type: "function_call_output"`

            The type of the function tool call output. Always `function_call_output`.

            - `"function_call_output"`

          - `id: optional string or null`

            The unique ID of the function tool call output. Populated when this item is returned via API.

          - `agent: optional object { agent_name }  or null`

            The agent that produced this item.

            - `agent_name: string`

              The canonical name of the agent that produced this item.

          - `call_id: optional string or null`

            The unique ID of the function tool call generated by the model.

          - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

            The execution context that produced this tool call.

            - `Direct object { type }`

              - `type: "direct"`

                The caller type. Always `direct`.

                - `"direct"`

            - `Program object { caller_id, type }`

              - `caller_id: string`

                The call ID of the program item that produced this tool call.

              - `type: "program"`

                The caller type. Always `program`.

                - `"program"`

          - `name: optional string or null`

            The name of the tool that produced the output.

          - `namespace: optional string or null`

            The namespace of the tool that produced the output.

          - `status: optional "in_progress" or "completed" or "incomplete" or null`

            The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

            - `"in_progress"`

            - `"completed"`

            - `"incomplete"`

    - `previous_response_id: string`

      The ID of the response to steer on this WebSocket connection.

    - `type: "response.steer"`

      The event discriminator. Always `response.steer`.

      - `"response.steer"`

  - `BetaResponseInjectEvent object { input, response_id, type }`

    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 of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      Input items to inject into the active response.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            Groups function/custom tools under a shared namespace.

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

          - `stderr: string`

            Captured stderr output for the shell call.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or 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 Responses Server Event

- `BetaResponsesServerEvent = BetaResponseAudioDeltaEvent or BetaResponseAudioDoneEvent or BetaResponseAudioTranscriptDeltaEvent or 61 more`

  Server events emitted by the Responses WebSocket server.

  - `BetaResponseAudioWsDelta = BetaResponseAudioDeltaEvent`

    Emitted when there is a partial audio response.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseAudioWsDone = BetaResponseAudioDoneEvent`

    Emitted when the audio response is complete.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseAudioTranscriptWsDelta = BetaResponseAudioTranscriptDeltaEvent`

    Emitted when there is a partial transcript of audio.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseAudioTranscriptWsDone = BetaResponseAudioTranscriptDoneEvent`

    Emitted when the full audio transcript is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCodeInterpreterCallCodeWsDelta = BetaResponseCodeInterpreterCallCodeDeltaEvent`

    Emitted when a partial code snippet is streamed by the code interpreter.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCodeInterpreterCallCodeWsDone = BetaResponseCodeInterpreterCallCodeDoneEvent`

    Emitted when the code snippet is finalized by the code interpreter.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCodeInterpreterCallWsCompleted = BetaResponseCodeInterpreterCallCompletedEvent`

    Emitted when the code interpreter call is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCodeInterpreterCallInWsProgress = BetaResponseCodeInterpreterCallInProgressEvent`

    Emitted when a code interpreter call is in progress.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCodeInterpreterCallWsInterpreting = BetaResponseCodeInterpreterCallInterpretingEvent`

    Emitted when the code interpreter is actively interpreting the code snippet.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCompactionWsCompacting = BetaResponseCompactionCompactingEvent`

    Emitted when new summary content is sampled for a compaction trigger. Contains no summary content.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsCompleted = BetaResponseCompletedEvent`

    Emitted when the model response is complete.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseContentPartWsAdded = BetaResponseContentPartAddedEvent`

    Emitted when a new content part is added.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseContentPartWsDone = BetaResponseContentPartDoneEvent`

    Emitted when a content part is done.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsCreated = BetaResponseCreatedEvent`

    An event that is emitted when a response is created.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseFileSearchCallWsCompleted = BetaResponseFileSearchCallCompletedEvent`

    Emitted when a file search call is completed (results found).

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseFileSearchCallInWsProgress = BetaResponseFileSearchCallInProgressEvent`

    Emitted when a file search call is initiated.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseFileSearchCallWsSearching = BetaResponseFileSearchCallSearchingEvent`

    Emitted when a file search is currently searching.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseFunctionCallArgumentsWsDelta = BetaResponseFunctionCallArgumentsDeltaEvent`

    Emitted when there is a partial function-call arguments delta.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseFunctionCallArgumentsWsDone = BetaResponseFunctionCallArgumentsDoneEvent`

    Emitted when function-call arguments are finalized.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseShellCallCommandWsAdded = BetaResponseShellCallCommandAddedEvent`

    A streaming event that indicated a shell command was added to a tool call.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseShellCallCommandWsDelta = BetaResponseShellCallCommandDeltaEvent`

    A streaming event that indicated a shell command was incrementally updated.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseShellCallCommandWsDone = BetaResponseShellCallCommandDoneEvent`

    A streaming event that indicated a shell command was completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseShellCallOutputContentWsDelta = BetaResponseShellCallOutputContentDeltaEvent`

    A streaming event that indicated shell call output was incrementally added.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseShellCallOutputContentWsDone = BetaResponseShellCallOutputContentDoneEvent`

    A streaming event that indicated shell call output was completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseInWsProgress = BetaResponseInProgressEvent`

    Emitted when the response is in progress.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsFailed = BetaResponseFailedEvent`

    An event that is emitted when a response fails.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsIncomplete = 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.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseOutputItemWsAdded = BetaResponseOutputItemAddedEvent`

    Emitted when a new output item is added.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseOutputItemWsDone = BetaResponseOutputItemDoneEvent`

    Emitted when an output item is marked done.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningSummaryPartWsAdded = BetaResponseReasoningSummaryPartAddedEvent`

    Emitted when a new reasoning summary part is added.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningSummaryPartWsDone = BetaResponseReasoningSummaryPartDoneEvent`

    Emitted when a reasoning summary part is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningSummaryTextWsDelta = BetaResponseReasoningSummaryTextDeltaEvent`

    Emitted when a delta is added to a reasoning summary text.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningSummaryTextWsDone = BetaResponseReasoningSummaryTextDoneEvent`

    Emitted when a reasoning summary text is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningTextWsDelta = BetaResponseReasoningTextDeltaEvent`

    Emitted when a delta is added to a reasoning text.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseReasoningTextWsDone = BetaResponseReasoningTextDoneEvent`

    Emitted when a reasoning text is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseRefusalWsDelta = BetaResponseRefusalDeltaEvent`

    Emitted when there is a partial refusal text.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseRefusalWsDone = BetaResponseRefusalDoneEvent`

    Emitted when refusal text is finalized.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseTextWsDelta = BetaResponseTextDeltaEvent`

    Emitted when there is an additional text delta.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseTextWsDone = BetaResponseTextDoneEvent`

    Emitted when text content is finalized.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWebSearchCallWsCompleted = BetaResponseWebSearchCallCompletedEvent`

    Emitted when a web search call is completed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWebSearchCallInWsProgress = BetaResponseWebSearchCallInProgressEvent`

    Emitted when a web search call is initiated.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWebSearchCallWsSearching = BetaResponseWebSearchCallSearchingEvent`

    Emitted when a web search call is executing.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseImageGenCallWsCompleted = BetaResponseImageGenCallCompletedEvent`

    Emitted when an image generation tool call has completed and the final image is available.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseImageGenCallWsGenerating = BetaResponseImageGenCallGeneratingEvent`

    Emitted when an image generation tool call is actively generating an image (intermediate state).

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseImageGenCallInWsProgress = BetaResponseImageGenCallInProgressEvent`

    Emitted when an image generation tool call is in progress.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseImageGenCallPartialWsImage = BetaResponseImageGenCallPartialImageEvent`

    Emitted when a partial image is available during image generation streaming.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpCallArgumentsWsDelta = BetaResponseMcpCallArgumentsDeltaEvent`

    Emitted when there is a delta (partial update) to the arguments of an MCP tool call.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpCallArgumentsWsDone = BetaResponseMcpCallArgumentsDoneEvent`

    Emitted when the arguments for an MCP tool call are finalized.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpCallWsCompleted = BetaResponseMcpCallCompletedEvent`

    Emitted when an MCP  tool call has completed successfully.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpCallWsFailed = BetaResponseMcpCallFailedEvent`

    Emitted when an MCP  tool call has failed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpCallInWsProgress = BetaResponseMcpCallInProgressEvent`

    Emitted when an MCP  tool call is in progress.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpListToolsWsCompleted = BetaResponseMcpListToolsCompletedEvent`

    Emitted when the list of available MCP tools has been successfully retrieved.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpListToolsWsFailed = BetaResponseMcpListToolsFailedEvent`

    Emitted when the attempt to list available MCP tools has failed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseMcpListToolsInWsProgress = BetaResponseMcpListToolsInProgressEvent`

    Emitted when the system is in the process of retrieving the list of available MCP tools.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseOutputTextAnnotationWsAdded = BetaResponseOutputTextAnnotationAddedEvent`

    Emitted when an annotation is added to output text content.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsQueued = BetaResponseQueuedEvent`

    Emitted when a response is queued and waiting to be processed.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCustomToolCallInputWsDelta = BetaResponseCustomToolCallInputDeltaEvent`

    Event representing a delta (partial update) to the input of a custom tool call.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseCustomToolCallInputWsDone = BetaResponseCustomToolCallInputDoneEvent`

    Event indicating that input for a custom tool call is complete.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present
      when the originating `response.create` event supplied a
      `stream_id`.

  - `BetaResponseWsError object { error, type, agent, 3 more }`

    Emitted when an error occurs while processing a Responses WebSocket request.

    - `error: object { code, message, param, 3 more }`

      Details about the error.

      - `code: string or null`

        The error code that was emitted, if any.

      - `message: string`

        The human-readable error message that was emitted.

      - `param: string or null`

        The parameter name that was associated with the error, if any.

      - `type: string`

        The error type that was emitted.

      - `headers: optional map[string]`

        The response headers that were emitted with the error, if any.

      - `misalignment: optional object { detailed_explanation, error_type, review_target, steer }`

        - `detailed_explanation: optional string`

          The public explanation for this block.

        - `error_type: optional string or "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

          An optional classification; clients must accept additional values.

          - `string`

          - `SafetyAlertErrorType = "potentially_unintended_data_transfer" or "potentially_unintended_data_access" or "potentially_unintended_destructive_activity" or "other"`

            An optional classification; clients must accept additional values.

            - `"potentially_unintended_data_transfer"`

            - `"potentially_unintended_data_access"`

            - `"potentially_unintended_destructive_activity"`

            - `"other"`

        - `review_target: optional string or null`

          An opaque target for explicitly continuing this review, or null when unavailable.

        - `steer: optional object { message }`

          An optional public continuation instruction.

          - `message: string`

            The public continuation instruction.

    - `type: "error"`

      The type of the event. Always `error`.

      - `"error"`

    - `agent: optional object { agent_name }  or null`

      The agent that owns this multi-agent streaming event.

      - `agent_name: string`

        The canonical name of the agent that produced this item.

    - `sequence_number: optional number`

      The sequence number of an error emitted by the response stream.

    - `status: optional number`

      The HTTP status code associated with a WebSocket protocol error.

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present when the
      originating `response.create` event supplied a `stream_id`.

  - `BetaResponseSteerAcceptedEvent object { sequence_number, steer, type, stream_id }`

    Emitted when steering input has been validated and queued. Acceptance means
    the server owns the input, not that it has been applied. The successor's
    `response.created` event is the commit point. If accepted input cannot be
    committed, `response.steer.failed` returns it with the same steering ID.

    When the response stops for client-owned tool output or approval, the input
    remains queued and `response.steer.pending` is emitted after
    `response.completed`. Fill the pending event's `required_input` stubs with
    saved results and send one matching explicit `response.create` per parent.
    Do not resend accepted input while it is still queued.

    - `sequence_number: number`

      The sequence number for this event.

    - `steer: object { id, previous_response_id }`

      The accepted steering submission.

      - `id: string`

        The ID assigned to the steering submission.

      - `previous_response_id: string`

        The ID of the response being steered.

    - `type: "response.steer.accepted"`

      The event discriminator. Always `response.steer.accepted`.

      - `"response.steer.accepted"`

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present when
      the target response's `response.create` event supplied a `stream_id`.

  - `BetaResponseSteerPendingEvent object { reason, required_input, sequence_number, 3 more }`

    Emitted when accepted steering input remains queued after the target
    response completes. The server still owns the input. Do not resend it.
    The successor's `response.created` event is the commit point.

    When `reason` is `waiting_for_required_input`, this event follows
    `response.completed` while the response waits for the tool results or
    approval decisions identified by `required_input`. Copy those stubs, fill
    their result fields using the ordinary `response.create` input schemas,
    and submit one continuation per parent with the same `previous_response_id`
    and WebSocket lane. Use saved results without rerunning tools. The queued
    steering input is prepended in submission order to the continuation's
    input. That explicit request retains its own settings.

    This notification is emitted at most once per steering submission. Multiple
    submissions for the same parent can report the same required inputs; they
    do not each require a separate continuation.

    - `reason: BetaResponseSteerPendingReason`

      An extensible enum describing why accepted steering input is still queued.
      Clients should handle unknown values because additional reasons may be
      introduced. Known values include:

      - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

      - `"waiting_for_required_input"`

        An extensible enum describing why accepted steering input is still queued.
        Clients should handle unknown values because additional reasons may be
        introduced. Known values include:

        - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`.

        - `"waiting_for_required_input"`

      - `string`

    - `required_input: array of BetaResponseSteerRequiredInput`

      Input stubs identifying outstanding client-owned tool results or
      approval decisions. Each stub contains identifying fields only; the
      client supplies the result before including it in `response.create`.

      - `FunctionCallOutput object { call_id, name, type }`

        Supply `output` using the function tool call output input schema.

        - `call_id: string`

        - `name: string`

        - `type: "function_call_output"`

          - `"function_call_output"`

      - `CustomToolCallOutput object { call_id, type }`

        Supply `output` using the custom tool call output input schema. The
        original custom tool call supplies the tool's name.

        - `call_id: string`

        - `type: "custom_tool_call_output"`

          - `"custom_tool_call_output"`

      - `ComputerCallOutput object { call_id, type }`

        Supply `output` using the computer tool call output input schema,
        including any required `acknowledged_safety_checks`.

        - `call_id: string`

        - `type: "computer_call_output"`

          - `"computer_call_output"`

      - `ShellCallOutput object { call_id, type }`

        Supply `output` using the shell tool call output input schema. Each
        output entry includes `stdout`, `stderr`, and `outcome`.

        - `call_id: string`

        - `type: "shell_call_output"`

          - `"shell_call_output"`

      - `ApplyPatchCallOutput object { call_id, type }`

        Supply `status` and optional `output` using the apply patch tool call
        output input schema.

        - `call_id: string`

        - `type: "apply_patch_call_output"`

          - `"apply_patch_call_output"`

      - `ToolSearchOutput object { call_id, execution, type }`

        Supply `tools` using the tool search output input schema, retaining
        `execution: "client"`.

        - `call_id: string`

        - `execution: "client"`

          - `"client"`

        - `type: "tool_search_output"`

          - `"tool_search_output"`

      - `McpApprovalResponse object { approval_request_id, type }`

        Supply `approve` using the MCP approval response input schema. An
        optional `reason` can be supplied when denying the request. The original
        approval request identifies the tool and server.

        - `approval_request_id: string`

        - `type: "mcp_approval_response"`

          - `"mcp_approval_response"`

    - `sequence_number: number`

      The sequence number for this event.

    - `steer: object { id, previous_response_id }`

      The steering submission that remains queued.

      - `id: string`

        The ID assigned to the steering submission.

      - `previous_response_id: string`

        The ID of the response being steered.

    - `type: "response.steer.pending"`

      The event discriminator. Always `response.steer.pending`.

      - `"response.steer.pending"`

    - `stream_id: optional string`

      The WebSocket lane that emitted this event. This field is present when
      the target response's `response.create` event supplied a `stream_id`.

  - `BetaResponseSteerFailedEvent object { error, sequence_number, steer, 2 more }`

    Emitted when steering input is rejected or cannot be committed to a
    successor response. Returns the original, uncommitted input so the client
    can carry it into `response.create` when appropriate. Invalid input must
    be corrected before retrying.

    Failures after acceptance include the same steering ID. Failures before an
    ID is allocated omit `steer.id`. A lost connection or missing acknowledgement
    leaves the outcome unknown; it is not proof that the input was rejected.

    - `error: object { code, message, type }`

      Information about why the input could not be committed.

      - `code: BetaResponseSteerErrorCode`

        A machine-readable steering error code. Clients should handle unknown
        values because additional codes may be introduced. Known values include:

        - `response_not_found`: The target response is not available on this connection.
        - `invalid_input`: The event or input failed validation.
        - `steering_not_supported`: The model or response execution mode does not support steering.
        - `too_many_pending_steers`: Too much steering input is pending for the response.
        - `response_already_completed`: The response completed and is no longer accepting steering input.
        - `response_not_active`: The response is no longer accepting steering input.
        - `successor_creation_failed`: The successor response could not be created.

        - `"response_not_found" or "invalid_input" or "steering_not_supported" or 4 more`

          A machine-readable steering error code. Clients should handle unknown
          values because additional codes may be introduced. Known values include:

          - `response_not_found`: The target response is not available on this connection.
          - `invalid_input`: The event or input failed validation.
          - `steering_not_supported`: The model or response execution mode does not support steering.
          - `too_many_pending_steers`: Too much steering input is pending for the response.
          - `response_already_completed`: The response completed and is no longer accepting steering input.
          - `response_not_active`: The response is no longer accepting steering input.
          - `successor_creation_failed`: The successor response could not be created.

          - `"response_not_found"`

          - `"invalid_input"`

          - `"steering_not_supported"`

          - `"too_many_pending_steers"`

          - `"response_already_completed"`

          - `"response_not_active"`

          - `"successor_creation_failed"`

        - `string`

      - `message: string`

        A human-readable description of the error.

      - `type: "invalid_request_error"`

        The error type. Always `invalid_request_error`.

        - `"invalid_request_error"`

    - `sequence_number: number`

      The sequence number for this event.

    - `steer: object { input, previous_response_id, id }`

      The steering submission that could not be committed.

      - `input: BetaResponseSteerInput`

        Input to queue for a continuation of the response. Uses the same string or
        input-item shape as `response.create.input`, with a non-empty array when
        supplying input items.

        Steering accepts only messages with the `user` role. Each message may
        contain only `type`, `role`, and `content`, with `content` as a string or an
        array of `input_text`, `input_image`, and `input_file` parts. The optional
        `type` must be `message`. Other roles, tool outputs, and item types are not
        supported for steering.

        - `TextInput = string`

          A text input, equivalent to a message with the `user` role.

        - `ResponseSteerInputItemList = array of Message { content, role, type, 3 more }  or FunctionCallOutput { output, type, id, 6 more }`

          A non-empty list of message inputs to queue for the response.

          - `Message object { content, role, type, 3 more }`

            - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent or string`

              The message content, as an array of content parts.

              - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

                - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                  A text input to the model.

                  - `text: string`

                    The text input to the model.

                  - `type: "input_text"`

                    The type of the input item. Always `input_text`.

                    - `"input_text"`

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "12h"`

                      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                      - `"30m"`

                      - `"12h"`

                - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                  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: optional BetaImageDetail or 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: optional string or null`

                    The ID of the file to be sent to the model.

                  - `image_url: optional string or null`

                    The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "12h"`

                      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                      - `"30m"`

                      - `"12h"`

                - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                  A file input to the model.

                  - `type: "input_file"`

                    The type of the input item. Always `input_file`.

                    - `"input_file"`

                  - `detail: optional "auto" or "low" or "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: optional string or null`

                    The base64-encoded data of the file to be sent to the model.

                  - `file_id: optional string or null`

                    The ID of the file to be sent to the model.

                  - `file_url: optional string or null`

                    The URL of the file to be sent to the model.

                  - `filename: optional string or null`

                    The name of the file to be sent to the model.

                  - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

                    Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                    - `mode: "explicit"`

                      The breakpoint mode. Always `explicit`.

                      - `"explicit"`

                    - `ttl: optional "30m" or "12h"`

                      The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                      - `"30m"`

                      - `"12h"`

              - `string`

                The message content, as a single string.

            - `role: "user"`

              The message role. Always `user`.

              - `"user"`

            - `type: "message"`

              The item type. Always `message`.

              - `"message"`

            - `id: optional string or null`

              The unique ID of this message item.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `status: optional string or null`

              The status of the message item.

          - `FunctionCallOutput object { output, type, id, 6 more }`

            The output of a function tool call.

            - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

              Text, image, or file output of the function tool call.

              - `string`

                A JSON string of the output of the function tool call.

              - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

                An array of content outputs (text, image, file) for the function tool call.

                - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

                  A text input to the model.

                - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

                  An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

                - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

                  A file input to the model.

            - `type: "function_call_output"`

              The type of the function tool call output. Always `function_call_output`.

              - `"function_call_output"`

            - `id: optional string or null`

              The unique ID of the function tool call output. Populated when this item is returned via API.

            - `agent: optional object { agent_name }  or null`

              The agent that produced this item.

              - `agent_name: string`

                The canonical name of the agent that produced this item.

            - `call_id: optional string or null`

              The unique ID of the function tool call generated by the model.

            - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

              The execution context that produced this tool call.

              - `Direct object { type }`

                - `type: "direct"`

                  The caller type. Always `direct`.

                  - `"direct"`

              - `Program object { caller_id, type }`

                - `caller_id: string`

                  The call ID of the program item that produced this tool call.

                - `type: "program"`

                  The caller type. Always `program`.

                  - `"program"`

            - `name: optional string or null`

              The name of the tool that produced the output.

            - `namespace: optional string or null`

              The namespace of the tool that produced the output.

            - `status: optional "in_progress" or "completed" or "incomplete" or null`

              The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.

              - `"in_progress"`

              - `"completed"`

              - `"incomplete"`

      - `previous_response_id: string`

        The ID of the response that was targeted for steering.

      - `id: optional string`

        The ID assigned to the steering submission, if one was allocated.

    - `type: "response.steer.failed"`

      The event discriminator. Always `response.steer.failed`.

      - `"response.steer.failed"`

    - `stream_id: optional string`

      The WebSocket lane that emitted this event, when the target response is
      available and its `response.create` event supplied a `stream_id`.

  - `BetaResponseInjectCreatedEvent object { response_id, sequence_number, type, stream_id }`

    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: optional string`

      The multiplexed WebSocket stream that emitted the event. This field is
      present only when WebSocket multiplexing is enabled separately.

  - `BetaResponseInjectFailedEvent object { error, input, response_id, 3 more }`

    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: object { code, message }`

      Information about why the input was not committed.

      - `code: "response_already_completed" or "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 of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

      The raw input items that were not committed.

      - `BetaEasyInputMessage object { content, role, phase, type }`

        A message input to the model with a role indicating instruction following
        hierarchy. Instructions given with the `developer` or `system` role take
        precedence over instructions given with the `user` role. Messages with the
        `assistant` role are presumed to have been generated by the model in previous
        interactions.

        - `content: string or BetaResponseInputMessageContentList`

          Text, image, or audio input to the model, used to generate a response.
          Can also contain previous assistant responses.

          - `TextInput = string`

            A text input to the model.

          - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

            A list of one or many input items to the model, containing different content
            types.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

              - `text: string`

                The text input to the model.

              - `type: "input_text"`

                The type of the input item. Always `input_text`.

                - `"input_text"`

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              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`.

              - `type: "input_image"`

                The type of the input item. Always `input_image`.

                - `"input_image"`

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `image_url: optional string or null`

                The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              A file input to the model.

              - `type: "input_file"`

                The type of the input item. Always `input_file`.

                - `"input_file"`

              - `detail: optional "auto" or "low" or "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: optional string`

                The content of the file to be sent to the model.

              - `file_id: optional string or null`

                The ID of the file to be sent to the model.

              - `file_url: optional string`

                The URL of the file to be sent to the model.

              - `filename: optional string`

                The name of the file to be sent to the model.

              - `prompt_cache_breakpoint: optional object { mode }`

                Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

                - `mode: "explicit"`

                  The breakpoint mode. Always `explicit`.

                  - `"explicit"`

        - `role: "user" or "assistant" or "system" or "developer"`

          The role of the message input. One of `user`, `assistant`, `system`, or
          `developer`.

          - `"user"`

          - `"assistant"`

          - `"system"`

          - `"developer"`

        - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

          The type of the message input. Always `message`.

          - `"message"`

      - `Message object { content, role, agent, 2 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.

        - `content: BetaResponseInputMessageContentList`

          A list of one or many input items to the model, containing different content
          types.

        - `role: "user" or "system" or "developer"`

          The role of the message input. One of `user`, `system`, or `developer`.

          - `"user"`

          - `"system"`

          - `"developer"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete"`

          The status of item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

        - `type: optional "message"`

          The type of the message input. Always set to `message`.

          - `"message"`

      - `BetaResponseOutputMessage object { id, content, role, 4 more }`

        An output message from the model.

        - `id: string`

          The unique ID of the output message.

        - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

          The content of the output message.

          - `BetaResponseOutputText object { annotations, logprobs, text, type }`

            A text output from the model.

            - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

              The annotations of the text output.

              - `FileCitation object { file_id, filename, index, type }`

                A citation to a file.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the file cited.

                - `index: number`

                  The index 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 object { end_index, start_index, title, 2 more }`

                A citation for a web resource used to generate a model response.

                - `end_index: number`

                  The index of the last character of the URL citation in the message.

                - `start_index: number`

                  The index of the first character of the URL citation in the message.

                - `title: string`

                  The title of the web resource.

                - `type: "url_citation"`

                  The type of the URL citation. Always `url_citation`.

                  - `"url_citation"`

                - `url: string`

                  The URL of the web resource.

              - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

                A citation for a container file used to generate a model response.

                - `container_id: string`

                  The ID of the container file.

                - `end_index: number`

                  The index of the last character of the container file citation in the message.

                - `file_id: string`

                  The ID of the file.

                - `filename: string`

                  The filename of the container file cited.

                - `start_index: number`

                  The index of the first character of the container file citation in the message.

                - `type: "container_file_citation"`

                  The type of the container file citation. Always `container_file_citation`.

                  - `"container_file_citation"`

              - `FilePath object { file_id, index, type }`

                A path to a file.

                - `file_id: string`

                  The ID of the file.

                - `index: number`

                  The index of the file in the list of files.

                - `type: "file_path"`

                  The type of the file path. Always `file_path`.

                  - `"file_path"`

            - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

              - `top_logprobs: array of object { token, bytes, logprob }`

                - `token: string`

                - `bytes: array of number`

                - `logprob: number`

            - `text: string`

              The text output from the model.

            - `type: "output_text"`

              The type of the output text. Always `output_text`.

              - `"output_text"`

          - `BetaResponseOutputRefusal object { refusal, type }`

            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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `phase: optional "commentary" or "final_answer" or 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"`

      - `FileSearchCall object { id, queries, status, 3 more }`

        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 of string`

          The queries used to search for files.

        - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

          The results of the file search tool call.

          - `attributes: optional map[string or number or boolean] or 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: optional string`

            The unique ID of the file.

          - `filename: optional string`

            The name of the file.

          - `score: optional number`

            The relevance score of the file - a value between 0 and 1.

          - `text: optional string`

            The text that was retrieved from the file.

      - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

        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 of object { id, code, message }`

          The pending safety checks for the computer call.

          - `id: string`

            The ID of the pending safety check.

          - `code: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

          A click action.

          - `Click object { button, type, x, 2 more }`

            A click action.

            - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

              The keys being held while clicking.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

            - `keys: array of string or 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 object { path, type, keys }`

            A drag action.

            - `path: array of object { x, y }`

              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: optional array of string or null`

              The keys being held while dragging the mouse.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

            - `keys: array of 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 object { type, x, y, keys }`

            A mouse move action.

            - `type: "move"`

              Specifies the event type. For a move action, this property is always set to `move`.

              - `"move"`

            - `x: number`

              The x-coordinate to move to.

            - `y: number`

              The y-coordinate to move to.

            - `keys: optional array of string or null`

              The keys being held while moving the mouse.

          - `Screenshot object { type }`

            A screenshot action.

            - `type: "screenshot"`

              Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

              - `"screenshot"`

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

            - `scroll_x: number`

              The horizontal scroll distance.

            - `scroll_y: number`

              The vertical scroll distance.

            - `type: "scroll"`

              Specifies the event type. For a scroll action, this property is always set to `scroll`.

              - `"scroll"`

            - `x: number`

              The x-coordinate where the scroll occurred.

            - `y: number`

              The y-coordinate where the scroll occurred.

            - `keys: optional array of string or null`

              The keys being held while scrolling.

          - `Type object { text, type }`

            An action to type in text.

            - `text: string`

              The text to type.

            - `type: "type"`

              Specifies the event type. For a type action, this property is always set to `type`.

              - `"type"`

          - `Wait object { type }`

            A wait action.

            - `type: "wait"`

              Specifies the event type. For a wait action, this property is always set to `wait`.

              - `"wait"`

        - `actions: optional BetaComputerActionList`

          Flattened batched actions for `computer_use`. Each action includes an
          `type` discriminator and action-specific fields.

          - `Click object { button, type, x, 2 more }`

            A click action.

          - `DoubleClick object { keys, type, x, y }`

            A double click action.

          - `Drag object { path, type, keys }`

            A drag action.

          - `Keypress object { keys, type }`

            A collection of keypresses the model would like to perform.

          - `Move object { type, x, y, keys }`

            A mouse move action.

          - `Screenshot object { type }`

            A screenshot action.

          - `Scroll object { scroll_x, scroll_y, type, 3 more }`

            A scroll action.

          - `Type object { text, type }`

            An action to type in text.

          - `Wait object { type }`

            A wait action.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ComputerCallOutput object { call_id, output, type, 4 more }`

        The output of a computer tool call.

        - `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: optional string`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: optional string`

            The URL of the screenshot image.

        - `type: "computer_call_output"`

          The type of the computer tool call output. Always `computer_call_output`.

          - `"computer_call_output"`

        - `id: optional string or null`

          The ID of the computer tool call output.

        - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

            The type of the pending safety check.

          - `message: optional string or null`

            Details about the pending safety check.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

      - `WebSearchCall object { id, status, type, 2 more }`

        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.

        - `status: "in_progress" or "searching" or "completed" or 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"`

        - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

          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 object { type, queries, query, sources }`

            Action type "search" - Performs a web search query.

            - `type: "search"`

              The action type.

              - `"search"`

            - `queries: optional array of string`

              The search queries.

            - `query: optional string`

              The search query.

            - `sources: optional array of object { type, url }`

              The sources used in the search.

              - `type: "url"`

                The type of source. Always `url`.

                - `"url"`

              - `url: string`

                The URL of the source.

          - `OpenPage object { type, url }`

            Action type "open_page" - Opens a specific URL from search results.

            - `type: "open_page"`

              The action type.

              - `"open_page"`

            - `url: optional string or null`

              The URL opened by the model.

          - `FindInPage object { pattern, type, url }`

            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: optional string or null`

              The URL of the page searched for the pattern, when available.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `FunctionCall object { arguments, call_id, name, 7 more }`

        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: optional string`

          The unique ID of the function tool call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the function tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the function to run.

        - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

        The output of a function tool call.

        - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          Text, image, or file output of the function tool call.

          - `string`

            A JSON string of the output of the function tool call.

          - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

            An array of content outputs (text, image, file) for the function tool call.

            - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

            - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

              A file input to the model.

        - `type: "function_call_output"`

          The type of the function tool call output. Always `function_call_output`.

          - `"function_call_output"`

        - `id: optional string or null`

          The unique ID of the function tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the function tool call generated by the model.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `name: optional string or null`

          The name of the tool that produced the output.

        - `namespace: optional string or null`

          The namespace of the tool that produced the output.

        - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

        A message routed between agents.

        - `author: string`

          The sending agent identity.

        - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

          Plaintext, image, or encrypted content sent between agents.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

          - `EncryptedContent object { encrypted_content, type }`

            Opaque encrypted content that Responses API decrypts inside trusted model execution.

            - `encrypted_content: string`

              Opaque encrypted content.

            - `type: "encrypted_content"`

              The type of the input item. Always `encrypted_content`.

              - `"encrypted_content"`

        - `recipient: string`

          The destination agent identity.

        - `type: "agent_message"`

          The item type. Always `agent_message`.

          - `"agent_message"`

        - `id: optional string or null`

          The unique ID of this agent message item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCall object { action, arguments, call_id, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

        - `type: "multi_agent_call"`

          The item type. Always `multi_agent_call`.

          - `"multi_agent_call"`

        - `id: optional string or null`

          The unique ID of this multi-agent call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

        - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

          Text output returned by the multi-agent action.

          - `text: string`

            The text content.

          - `type: "output_text"`

            The content type. Always `output_text`.

            - `"output_text"`

          - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

            Citations associated with the text content.

            - `FileCitation object { file_id, filename, index, type }`

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_citation"`

                The citation type. Always `file_citation`.

                - `"file_citation"`

            - `URLCitation object { end_index, start_index, title, 2 more }`

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `start_index: number`

                The index of the first character of the citation in the message.

              - `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.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              - `container_id: string`

                The ID of the container.

              - `end_index: number`

                The index of the last character of the citation in the message.

              - `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.

              - `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: optional string or null`

          The unique ID of this multi-agent call output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ToolSearchCall object { arguments, type, id, 4 more }`

        - `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: optional string or null`

          The unique ID of this tool search call.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search call.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ToolSearchOutput object { tools, type, id, 4 more }`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          The loaded tool definitions returned by the tool search output.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                    - `type: "disabled"`

                      Disable outbound network access. Always `disabled`.

                      - `"disabled"`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                    - `allowed_domains: array of string`

                      A list of allowed domains when type is `allowlist`.

                    - `type: "allowlist"`

                      Allow outbound network access only to specified domains. Always `allowlist`.

                      - `"allowlist"`

                    - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                      Optional domain-scoped secrets for allowlisted domains.

                      - `domain: string`

                        The domain associated with the secret.

                      - `name: string`

                        The name of the secret to inject for the domain.

                      - `value: string`

                        The secret value to inject for the domain.

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

                - `type: "container_auto"`

                  Automatically creates a container for this request

                  - `"container_auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                  An optional list of skills referenced by id or inline data.

                  - `BetaSkillReference object { skill_id, type, version }`

                    - `skill_id: string`

                      The ID of the referenced skill.

                    - `type: "skill_reference"`

                      References a skill created with the /v1/skills endpoint.

                      - `"skill_reference"`

                    - `version: optional string`

                      Optional skill version. Use a positive integer or 'latest'. Omit for default.

                  - `BetaInlineSkill object { description, name, source, type }`

                    - `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.

                      - `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 object { type, skills }`

                - `type: "local"`

                  Use a local computer environment.

                  - `"local"`

                - `skills: optional array of BetaLocalSkill`

                  An optional list of skills.

                  - `description: string`

                    The description of the skill.

                  - `name: string`

                    The name of the skill.

                  - `path: string`

                    The path to the directory containing the skill.

              - `BetaContainerReference object { container_id, type }`

                - `container_id: string`

                  The ID of the referenced container.

                - `type: "container_reference"`

                  References a container created with the /v1/containers endpoint

                  - `"container_reference"`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools loaded inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                  The name of the loaded function tool.

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "tool_search_output"`

          The item type. Always `tool_search_output`.

          - `"tool_search_output"`

        - `id: optional string or null`

          The unique ID of this tool search output.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `call_id: optional string or null`

          The unique ID of the tool search call generated by the model.

        - `execution: optional "server" or "client"`

          Whether tool search was executed by the server or by the client.

          - `"server"`

          - `"client"`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the tool search output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `AdditionalTools object { role, tools, type, 2 more }`

        - `role: "developer"`

          The role that provided the additional tools. Only `developer` is supported.

          - `"developer"`

        - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

          A list of additional tools made available at this item.

          - `Function object { name, parameters, strict, 6 more }`

            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: map[unknown] or null`

              A JSON schema object describing the parameters of the function.

            - `strict: boolean or null`

              Whether strict parameter validation is enforced for this function tool.

            - `type: "function"`

              The type of the function tool. Always `function`.

              - `"function"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

            - `defer_loading: optional boolean`

              Whether this function is deferred and loaded via tool search.

            - `description: optional string or null`

              A description of the function. Used by the model to determine whether or not to call the function.

            - `output_schema: optional map[unknown] or null`

              A JSON schema object describing the JSON value encoded in string outputs for this function.

          - `FileSearch object { type, vector_store_ids, filters, 2 more }`

            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 of string`

              The IDs of the vector stores to search.

            - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

              A filter to apply.

              - `ComparisonFilter object { key, type, value }`

                A filter used to compare a specified attribute key to a given value using a defined comparison operation.

                - `key: string`

                  The key to compare against the value.

                - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                  The value to compare against the attribute key; supports string, number, or boolean types.

                  - `string`

                  - `number`

                  - `boolean`

                  - `array of string or number`

                    - `string`

                    - `number`

              - `BetaCompoundFilter = unknown`

                Combine multiple filters using `and` or `or`.

            - `max_num_results: optional number`

              The maximum number of results to return. This number should be between 1 and 50 inclusive.

            - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

              Ranking options for search.

              - `hybrid_search: optional object { embedding_weight, text_weight }`

                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: optional "auto" or "default-2024-11-15"`

                The ranker to use for the file search.

                - `"auto"`

                - `"default-2024-11-15"`

              - `score_threshold: optional 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.

          - `Computer object { type }`

            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"`

          - `ComputerUsePreview object { display_height, display_width, environment, type }`

            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" or "mac" or "linux" or 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"`

          - `WebSearch object { type, external_web_access, filters, 2 more }`

            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" or "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: optional 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: optional object { allowed_domains }  or null`

              Filters for the search.

              - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

              - `type: optional "approximate"`

                The type of location approximation. Always `approximate`.

                - `"approximate"`

          - `Mcp object { server_label, type, allowed_callers, 9 more }`

            Give the model access to additional tools via remote Model Context Protocol
            (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

              List of allowed tool names or a filter object.

              - `McpAllowedTools = array of string`

                A string array of allowed tool names

              - `McpToolFilter object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

              Whether this MCP tool is deferred and discovered via tool search.

            - `headers: optional map[string] or null`

              Optional HTTP headers to send to the MCP server. Use for authentication
              or other purposes.

            - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

              Specify which of the MCP server's tools require approval.

              - `McpToolApprovalFilter object { always, never }`

                Specify which of the MCP server's tools require approval. Can be
                `always`, `never`, or a filter object associated with tools
                that require approval.

                - `always: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

                - `never: optional object { read_only, tool_names }`

                  A filter object to specify which tools are allowed.

                  - `read_only: optional 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: optional array of string`

                    List of allowed tool names.

              - `McpToolApprovalSetting = "always" or "never"`

                Specify a single approval policy for all tools. One of `always` or
                `never`. When set to `always`, all tools will require approval. When
                set to `never`, all tools will not require approval.

                - `"always"`

                - `"never"`

            - `server_description: optional string`

              Optional description of the MCP server, used to provide more context.

            - `server_url: optional string`

              The URL for the MCP server. One of `server_url`, `connector_id`, or
              `tunnel_id` must be provided.

            - `tunnel_id: optional 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 object { container, type, allowed_callers }`

            A tool that runs Python code to help generate a response to a prompt.

            - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

              The code interpreter container. Can be a container ID or an object that
              specifies uploaded file IDs to make available to your code, along with an
              optional `memory_limit` setting.

              - `string`

                The container ID.

              - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

                Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

                - `type: "auto"`

                  Always `auto`.

                  - `"auto"`

                - `file_ids: optional array of string`

                  An optional list of uploaded files to make available to your code.

                - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                  The memory limit for the code interpreter container.

                  - `"1g"`

                  - `"4g"`

                  - `"16g"`

                  - `"64g"`

                - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                  Network access policy for the container.

                  - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

            - `type: "code_interpreter"`

              The type of the code interpreter tool. Always `code_interpreter`.

              - `"code_interpreter"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

          - `ProgrammaticToolCalling object { type }`

            - `type: "programmatic_tool_calling"`

              The type of the tool. Always `programmatic_tool_calling`.

              - `"programmatic_tool_calling"`

          - `ImageGeneration object { type, action, background, 9 more }`

            A tool that generates images using the GPT image models.

            - `type: "image_generation"`

              The type of the image generation tool. Always `image_generation`.

              - `"image_generation"`

            - `action: optional "generate" or "edit" or "auto"`

              Whether to generate a new image or edit an existing image. Default: `auto`.

              - `"generate"`

              - `"edit"`

              - `"auto"`

            - `background: optional "transparent" or "opaque" or "auto"`

              Set the background of the generated image. One of `transparent`, `opaque`,
              or `auto`. `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`.
              Default: `auto`.

              - `"transparent"`

              - `"opaque"`

              - `"auto"`

            - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

              Optional mask for inpainting. Contains `image_url`
              (string, optional) and `file_id` (string, optional).

              - `file_id: optional string`

                File ID for the mask image.

              - `image_url: optional string`

                Base64-encoded mask image.

            - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `string`

              - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

                The image generation model to use. One of `gpt-image-1`,
                `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`, or `chatgpt-image-latest`. Default:
                `gpt-image-1`.

                - `"gpt-image-1"`

                - `"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"`

            - `moderation: optional "auto" or "low"`

              Moderation level for the generated image. Default: `auto`.

              - `"auto"`

              - `"low"`

            - `output_compression: optional number`

              Compression level for the output image. Default: 100.

            - `output_format: optional "png" or "webp" or "jpeg"`

              The output format of the generated image. One of `png`, `webp`, or
              `jpeg`. Default: `png`.

              - `"png"`

              - `"webp"`

              - `"jpeg"`

            - `partial_images: optional number`

              Number of partial images to generate in streaming mode, from 0 (default value) to 3.

            - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

                - `"1024x1024"`

                - `"1024x1536"`

                - `"1536x1024"`

                - `"auto"`

          - `LocalShell object { type }`

            A tool that allows the model to execute shell commands in a local environment.

            - `type: "local_shell"`

              The type of the local shell tool. Always `local_shell`.

              - `"local_shell"`

          - `Shell object { type, allowed_callers, environment }`

            A tool that allows the model to execute shell commands.

            - `type: "shell"`

              The type of the shell tool. Always `shell`.

              - `"shell"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

              - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `BetaLocalEnvironment object { type, skills }`

              - `BetaContainerReference object { container_id, type }`

          - `Custom object { name, type, allowed_callers, 4 more }`

            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: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

            - `async: optional boolean`

              Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

            - `defer_loading: optional boolean`

              Whether this tool should be deferred and discovered via tool search.

            - `description: optional string`

              Optional description of the custom tool, used to provide more context.

            - `format: optional Text { type }  or Grammar { definition, syntax, type }`

              The input format for the custom tool. Default is unconstrained text.

              - `Text object { type }`

                Unconstrained free-form text.

                - `type: "text"`

                  Unconstrained text format. Always `text`.

                  - `"text"`

              - `Grammar object { definition, syntax, type }`

                A grammar defined by the user.

                - `definition: string`

                  The grammar definition.

                - `syntax: "lark" or "regex"`

                  The syntax of the grammar definition. One of `lark` or `regex`.

                  - `"lark"`

                  - `"regex"`

                - `type: "grammar"`

                  Grammar format. Always `grammar`.

                  - `"grammar"`

          - `Namespace object { description, name, tools, type }`

            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`).

            - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

              The function/custom tools available inside this namespace.

              - `Function object { name, type, allowed_callers, 6 more }`

                - `name: string`

                - `type: "function"`

                  - `"function"`

                - `allowed_callers: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this function should be deferred and discovered via tool search.

                - `description: optional string or null`

                - `output_schema: optional map[unknown] or null`

                  A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

                - `parameters: optional unknown or null`

                - `strict: optional boolean or 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.

              - `Custom object { name, type, allowed_callers, 4 more }`

                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: optional array of "direct" or "programmatic" or null`

                  The tool invocation context(s).

                  - `"direct"`

                  - `"programmatic"`

                - `async: optional boolean`

                  Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

                - `defer_loading: optional boolean`

                  Whether this tool should be deferred and discovered via tool search.

                - `description: optional string`

                  Optional description of the custom tool, used to provide more context.

                - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                  The input format for the custom tool. Default is unconstrained text.

                  - `Text object { type }`

                    Unconstrained free-form text.

                    - `type: "text"`

                      Unconstrained text format. Always `text`.

                      - `"text"`

                  - `Grammar object { definition, syntax, type }`

                    A grammar defined by the user.

                    - `definition: string`

                      The grammar definition.

                    - `syntax: "lark" or "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"`

          - `ToolSearch object { type, description, execution, parameters }`

            Hosted or BYOT tool search configuration for deferred tools.

            - `type: "tool_search"`

              The type of the tool. Always `tool_search`.

              - `"tool_search"`

            - `description: optional string or null`

              Description shown to the model for a client-executed tool search tool.

            - `execution: optional "server" or "client"`

              Whether tool search is executed by the server or by the client.

              - `"server"`

              - `"client"`

            - `parameters: optional unknown or null`

              Parameter schema for a client-executed tool search tool.

          - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

            This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

            - `type: "web_search_preview" or "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: optional array of "text" or "image"`

              - `"text"`

              - `"image"`

            - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

                Free text input for the city of the user, e.g. `San Francisco`.

              - `country: optional string or null`

                The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

              - `region: optional string or null`

                Free text input for the region of the user, e.g. `California`.

              - `timezone: optional string or null`

                The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

          - `ApplyPatch object { type, allowed_callers }`

            Allows the assistant to create, delete, or update files using unified diffs.

            - `type: "apply_patch"`

              The type of the tool. Always `apply_patch`.

              - `"apply_patch"`

            - `allowed_callers: optional array of "direct" or "programmatic" or null`

              The tool invocation context(s).

              - `"direct"`

              - `"programmatic"`

        - `type: "additional_tools"`

          The item type. Always `additional_tools`.

          - `"additional_tools"`

        - `id: optional string or null`

          The unique ID of this additional tools item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ConfigurationUpdate object { type, id, agent, reasoning }`

        An update to the conversation's response configuration. The configuration
        remains in effect for subsequent responses until it is replaced by another
        configuration update.

        - `type: "configuration_update"`

          The item type. Always `configuration_update`.

          - `"configuration_update"`

        - `id: optional string or null`

          The unique ID of the configuration update item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reasoning: optional object { effort }`

          Updates to reasoning configuration. Only effort is supported.

          - `effort: optional "none" or "minimal" or "low" or 4 more or null`

            The reasoning effort to use for subsequent responses until another
            configuration update replaces it.

            - `"none"`

            - `"minimal"`

            - `"low"`

            - `"medium"`

            - `"high"`

            - `"xhigh"`

            - `"max"`

      - `Reasoning object { id, summary, type, 4 more }`

        A description of the chain of thought used by a reasoning model while generating
        a response. Be sure to include these items in your `input` to the Responses API
        for subsequent turns of a conversation if you are manually
        [managing context](/api/docs/guides/conversation-state).

        - `id: string`

          The unique identifier of the reasoning content.

        - `summary: array of object { text, type }`

          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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `content: optional array of object { text, type }`

          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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

          The status of the item. One of `in_progress`, `completed`, or
          `incomplete`. Populated when items are returned via API.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `Compaction object { encrypted_content, type, id, agent }`

        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.

        - `type: "compaction"`

          The type of the item. Always `compaction`.

          - `"compaction"`

        - `id: optional string or null`

          The ID of the compaction item.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ImageGenerationCall object { id, result, status, 9 more }`

        An image generation request made by the model.

        - `id: string`

          The unique ID of the image generation call.

        - `result: string or null`

          The generated image encoded in base64.

        - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

          The action used for image generation.

          - `"generate"`

          - `"edit"`

          - `"auto"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `background: optional "transparent" or "opaque" or "auto" or null`

          The background setting used for generation.

          - `"transparent"`

          - `"opaque"`

          - `"auto"`

        - `error: optional object { code, message, param, 2 more }`

          Details of a moderation failure, when available.

          - `code: string or null`

            The error code.

          - `message: string`

            A description of the error.

          - `param: string or null`

            The related request parameter.

          - `type: string`

            The error type.

          - `moderation_details: optional object { categories, moderation_stage }`

            Public details for a `moderation_blocked` error, when available.

            - `categories: array of string`

              Public moderation categories. New category values may be added over time.

            - `moderation_stage: "input" or "output" or "unknown"`

              The stage where moderation blocked the image generation call.

              - `"input"`

              - `"output"`

              - `"unknown"`

        - `output_format: optional "png" or "webp" or "jpeg" or null`

          The output format used for generation.

          - `"png"`

          - `"webp"`

          - `"jpeg"`

        - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

          The prompt that was used after any model prompt rewriting.

        - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `string`

          - `"1024x1024" or "1024x1536" or "1536x1024"`

            The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

            - `"1024x1024"`

            - `"1024x1536"`

            - `"1536x1024"`

      - `CodeInterpreterCall object { id, code, container_id, 4 more }`

        A tool call to run code.

        - `id: string`

          The unique ID of the code interpreter tool call.

        - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

          The outputs generated by the code interpreter, such as logs or images.
          Can be null if no outputs are available.

          - `Logs object { logs, type }`

            The logs output from the code interpreter.

            - `logs: string`

              The logs output from the code interpreter.

            - `type: "logs"`

              The type of the output. Always `logs`.

              - `"logs"`

          - `Image object { type, url }`

            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.

        - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCall object { id, action, call_id, 3 more }`

        A tool call to run a command on the local shell.

        - `id: string`

          The unique ID of the local shell call.

        - `action: object { command, env, type, 3 more }`

          Execute a shell command on the server.

          - `command: array of string`

            The command to run.

          - `env: map[string]`

            Environment variables to set for the command.

          - `type: "exec"`

            The type of the local shell action. Always `exec`.

            - `"exec"`

          - `timeout_ms: optional number or null`

            Optional timeout in milliseconds for the command.

          - `user: optional string or null`

            Optional user to run the command as.

          - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `LocalShellCallOutput object { id, output, type, 2 more }`

        The output of a local shell tool call.

        - `id: string`

          The unique ID of the local shell tool call generated by the model.

        - `output: string`

          A JSON string of the output of the local shell tool call.

        - `type: "local_shell_call_output"`

          The type of the local shell tool call output. Always `local_shell_call_output`.

          - `"local_shell_call_output"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the item. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCall object { action, call_id, type, 5 more }`

        A tool representing a request to execute one or more shell commands.

        - `action: object { commands, max_output_length, timeout_ms }`

          The shell commands and limits that describe how to run the tool call.

          - `commands: array of string`

            Ordered shell commands for the execution environment to run.

          - `max_output_length: optional number or null`

            Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

          - `timeout_ms: optional number or 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.

        - `type: "shell_call"`

          The type of the item. Always `shell_call`.

          - `"shell_call"`

        - `id: optional string or null`

          The unique ID of the shell tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

          The environment to execute the shell commands in.

          - `BetaLocalEnvironment object { type, skills }`

          - `BetaContainerReference object { container_id, type }`

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ShellCallOutput object { call_id, output, type, 5 more }`

        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.

        - `output: array of BetaResponseFunctionShellCallOutputContent`

          Captured chunks of stdout and stderr output, along with their associated outcomes.

          - `outcome: Timeout { type }  or Exit { exit_code, type }`

            The exit or timeout outcome associated with this shell call.

            - `Timeout object { type }`

              Indicates that the shell call exceeded its configured time limit.

              - `type: "timeout"`

                The outcome type. Always `timeout`.

                - `"timeout"`

            - `Exit object { exit_code, type }`

              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.

          - `stdout: string`

            Captured stdout output for the shell call.

        - `type: "shell_call_output"`

          The type of the item. Always `shell_call_output`.

          - `"shell_call_output"`

        - `id: optional string or null`

          The unique ID of the shell tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `max_output_length: optional number or null`

          The maximum number of UTF-8 characters captured for this shell call's combined output.

        - `status: optional "in_progress" or "completed" or "incomplete" or null`

          The status of the shell call output.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

      - `ApplyPatchCall object { call_id, operation, status, 4 more }`

        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.

        - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

          The specific create, delete, or update instruction for the apply_patch tool call.

          - `CreateFile object { diff, path, type }`

            Instruction for creating a new file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply when creating the file.

            - `path: string`

              Path of the file to create relative to the workspace root.

            - `type: "create_file"`

              The operation type. Always `create_file`.

              - `"create_file"`

          - `DeleteFile object { path, type }`

            Instruction for deleting an existing file via the apply_patch tool.

            - `path: string`

              Path of the file to delete relative to the workspace root.

            - `type: "delete_file"`

              The operation type. Always `delete_file`.

              - `"delete_file"`

          - `UpdateFile object { diff, path, type }`

            Instruction for updating an existing file via the apply_patch tool.

            - `diff: string`

              Unified diff content to apply to the existing file.

            - `path: string`

              Path of the file to update relative to the workspace root.

            - `type: "update_file"`

              The operation type. Always `update_file`.

              - `"update_file"`

        - `status: "in_progress" or "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: optional string or null`

          The unique ID of the apply patch tool call. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

        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.

        - `status: "completed" or "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: optional string or null`

          The unique ID of the apply patch tool call output. Populated when this item is returned via API.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

        - `output: optional string or null`

          Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

      - `McpListTools object { id, server_label, tools, 3 more }`

        A list of tools available on an MCP server.

        - `id: string`

          The unique ID of the list.

        - `server_label: string`

          The label of the MCP server.

        - `tools: array of object { input_schema, name, annotations, description }`

          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: optional unknown or null`

            Additional annotations about the tool.

          - `description: optional string or null`

            The description of the tool.

        - `type: "mcp_list_tools"`

          The type of the item. Always `mcp_list_tools`.

          - `"mcp_list_tools"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `error: optional string or null`

          Error message if the server could not list tools.

      - `McpApprovalRequest object { id, arguments, name, 3 more }`

        A request for human approval of a tool invocation.

        - `id: string`

          The unique ID of the approval request.

        - `arguments: string`

          A JSON string of arguments for the tool.

        - `name: string`

          The name of the tool to run.

        - `server_label: string`

          The label of the MCP server making the request.

        - `type: "mcp_approval_request"`

          The type of the item. Always `mcp_approval_request`.

          - `"mcp_approval_request"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

        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: optional string or null`

          The unique ID of the approval response

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `reason: optional string or null`

          Optional reason for the decision.

      - `McpCall object { id, arguments, name, 7 more }`

        An invocation of a tool on an MCP server.

        - `id: string`

          The unique ID of the tool call.

        - `arguments: string`

          A JSON string of the arguments passed to the tool.

        - `name: string`

          The name of the tool that was run.

        - `server_label: string`

          The label of the MCP server running the tool.

        - `type: "mcp_call"`

          The type of the item. Always `mcp_call`.

          - `"mcp_call"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

          The error from the tool call, if any.

          - `McpProtocolError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "mcp_protocol_error"`

              - `"mcp_protocol_error"`

          - `McpToolExecutionError object { content, type }`

            - `content: unknown`

            - `type: "mcp_tool_execution_error"`

              - `"mcp_tool_execution_error"`

          - `HTTPError object { code, message, type }`

            - `code: number`

            - `message: string`

            - `type: "http_error"`

              - `"http_error"`

        - `output: optional string or null`

          The output from the tool call.

        - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

          The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

          - `"in_progress"`

          - `"completed"`

          - `"incomplete"`

          - `"calling"`

          - `"failed"`

      - `CustomToolCallOutput object { call_id, output, type, 3 more }`

        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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          The output from the custom tool call generated by your code.
          Can be a string or an list of output content.

          - `StringOutput = string`

            A string of the output of the custom tool call.

          - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

            Text, image, or file output of the custom tool call.

            - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

              A text input to the model.

            - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

              An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

            - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

              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: optional string`

          The unique ID of the custom tool call output in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              The caller type. Always `direct`.

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              The caller type. Always `program`.

              - `"program"`

      - `CustomToolCall object { call_id, input, name, 6 more }`

        A call to a custom tool created by the model.

        - `call_id: string`

          An identifier used to map this custom tool call to a tool call output.

        - `input: string`

          The input for the custom tool call generated by the model.

        - `name: string`

          The name of the custom tool being called.

        - `type: "custom_tool_call"`

          The type of the custom tool call. Always `custom_tool_call`.

          - `"custom_tool_call"`

        - `id: optional string`

          The unique ID of the custom tool call in the OpenAI platform.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `async: optional boolean`

          Whether the custom tool call runs asynchronously.

        - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

          The execution context that produced this tool call.

          - `Direct object { type }`

            - `type: "direct"`

              - `"direct"`

          - `Program object { caller_id, type }`

            - `caller_id: string`

              The call ID of the program item that produced this tool call.

            - `type: "program"`

              - `"program"`

        - `namespace: optional string`

          The namespace of the custom tool being called.

      - `CompactionTrigger object { type, id, agent }`

        Compacts the current context. Must be the final input item.

        - `type: "compaction_trigger"`

          The type of the item. Always `compaction_trigger`.

          - `"compaction_trigger"`

        - `id: optional string or null`

          The unique ID of this compaction trigger.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ItemReference object { id, agent, type }`

        An internal identifier for an item to reference.

        - `id: string`

          The ID of the item to reference.

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

        - `type: optional "item_reference" or null`

          The type of item to reference. Always `item_reference`.

          - `"item_reference"`

      - `Program object { id, call_id, code, 3 more }`

        - `id: string`

          The unique ID of this 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 item type. Always `program`.

          - `"program"`

        - `agent: optional object { agent_name }  or null`

          The agent that produced this item.

          - `agent_name: string`

            The canonical name of the agent that produced this item.

      - `ProgramOutput object { id, call_id, result, 3 more }`

        - `id: string`

          The unique ID of this program output item.

        - `call_id: string`

          The call ID of the program item.

        - `result: string`

          The result produced by the program item.

        - `status: "completed" or "incomplete"`

          The terminal status of the program output.

          - `"completed"`

          - `"incomplete"`

        - `type: "program_output"`

          The item type. Always `program_output`.

          - `"program_output"`

        - `agent: optional object { agent_name }  or 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: optional string`

      The multiplexed WebSocket stream that emitted the event. This field is
      present only when WebSocket multiplexing is enabled separately.

### Beta Service Tier

- `BetaServiceTier = "auto" or "default" or "flex" or 4 more`

  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"`

### Beta Skill Reference

- `BetaSkillReference object { skill_id, type, version }`

  - `skill_id: string`

    The ID of the referenced skill.

  - `type: "skill_reference"`

    References a skill created with the /v1/skills endpoint.

    - `"skill_reference"`

  - `version: optional string`

    Optional skill version. Use a positive integer or 'latest'. Omit for default.

### Beta Tool Choice Allowed

- `BetaToolChoiceAllowed object { mode, tools, type }`

  Constrains the tools available to the model to a pre-defined set.

  - `mode: "auto" or "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 of map[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"`

### Beta Tool Choice Apply Patch

- `BetaToolChoiceApplyPatch object { type }`

  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"`

### Beta Tool Choice Custom

- `BetaToolChoiceCustom object { name, type }`

  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"`

### Beta Tool Choice Function

- `BetaToolChoiceFunction object { name, type }`

  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"`

### Beta Tool Choice Mcp

- `BetaToolChoiceMcp object { server_label, type, name }`

  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: optional string or null`

    The name of the tool to call on the server.

### Beta Tool Choice Options

- `BetaToolChoiceOptions = "none" or "auto" or "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"`

### Beta Tool Choice Shell

- `BetaToolChoiceShell object { type }`

  Forces the model to call the shell tool when a tool call is required.

  - `type: "shell"`

    The tool to call. Always `shell`.

    - `"shell"`

### Beta Tool Choice Types

- `BetaToolChoiceTypes object { type }`

  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" or "web_search_preview" or "computer" or 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"`

### Beta Tool Search Output Namespace Tool

- `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

  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`).

  - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

    The function/custom tools loaded inside this namespace.

    - `Function object { name, type, allowed_callers, 6 more }`

      - `name: string`

        The name of the loaded function tool.

      - `type: "function"`

        - `"function"`

      - `allowed_callers: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this function should be deferred and discovered via tool search.

      - `description: optional string or null`

      - `output_schema: optional map[unknown] or null`

        A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

      - `parameters: optional unknown or null`

      - `strict: optional boolean or 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.

    - `Custom object { name, type, allowed_callers, 4 more }`

      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: optional array of "direct" or "programmatic" or null`

        The tool invocation context(s).

        - `"direct"`

        - `"programmatic"`

      - `async: optional boolean`

        Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

      - `defer_loading: optional boolean`

        Whether this tool should be deferred and discovered via tool search.

      - `description: optional string`

        Optional description of the custom tool, used to provide more context.

      - `format: optional Text { type }  or Grammar { definition, syntax, type }`

        The input format for the custom tool. Default is unconstrained text.

        - `Text object { type }`

          Unconstrained free-form text.

          - `type: "text"`

            Unconstrained text format. Always `text`.

            - `"text"`

        - `Grammar object { definition, syntax, type }`

          A grammar defined by the user.

          - `definition: string`

            The grammar definition.

          - `syntax: "lark" or "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"`

# Input Items

## List input items

**get** `/responses/{response_id}/input_items?beta=true`

Returns a list of input items for a given response.

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Path Parameters

- `response_id: string`

### Query Parameters

- `after: optional string`

  An item ID to list items after, used in pagination.

- `include: optional array of BetaResponseIncludable`

  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"`

- `limit: optional number`

  A limit on the number of objects to be returned. Limit can range between
  1 and 100, and the default is 20.

- `order: optional "asc" or "desc"`

  The order to return the input items in. Default is `desc`.

  - `asc`: Return the input items in ascending order.
  - `desc`: Return the input items in descending order.

  - `"asc"`

  - `"desc"`

### Returns

- `BetaResponseItemList object { data, first_id, has_more, 2 more }`

  A list of Response items.

  - `data: array of BetaResponseInputMessageItem or BetaResponseOutputMessage or FileSearchCall { id, queries, status, 3 more }  or 30 more`

    A list of items used to generate this response.

    - `BetaResponseInputMessageItem object { id, content, role, 3 more }`

      - `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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

          - `text: string`

            The text input to the model.

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          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: optional string or null`

            The ID of the file to be sent to the model.

          - `image_url: optional string or null`

            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"input_file"`

          - `detail: optional "auto" or "low" or "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: optional string`

            The content of the file to be sent to the model.

          - `file_id: optional string or null`

            The ID of the file to be sent to the model.

          - `file_url: optional string`

            The URL of the file to be sent to the model.

          - `filename: optional string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

      - `role: "user" or "system" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { id, arguments, call_id, 8 more }`

      - `id: string`

        The unique ID of the function tool call.

      - `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.

      - `status: "in_progress" or "completed" or "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"`

        The type of the function tool call. Always `function_call`.

        - `"function_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `namespace: optional string`

        The namespace of the function to run.

    - `FunctionCallOutput object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { id, type, agent, reasoning }`

      A configuration update that applies to subsequent responses until it is
      replaced by another configuration update.

      - `id: string`

        The unique ID of the configuration update item.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        The reasoning configuration applied by this update.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort used for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCall object { id, call_id, input, 8 more }`

      - `id: string`

        The unique ID of the custom tool call item.

      - `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.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

  - `first_id: string`

    The ID of the first item in the list.

  - `has_more: boolean`

    Whether there are more items available.

  - `last_id: string`

    The ID of the last item in the list.

  - `object: "list"`

    The type of object returned, must be `list`.

    - `"list"`

### Example

```http
curl https://api.openai.com/v1/responses/$RESPONSE_ID/input_items \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "content": [
        {
          "text": "text",
          "type": "input_text",
          "prompt_cache_breakpoint": {
            "mode": "explicit"
          }
        }
      ],
      "role": "user",
      "type": "message",
      "agent": {
        "agent_name": "agent_name"
      },
      "status": "in_progress"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
```

### Example

```http
curl https://api.openai.com/v1/responses/resp_abc123/input_items \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "msg_abc123",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Tell me a three sentence bedtime story about a unicorn."
        }
      ]
    }
  ],
  "first_id": "msg_abc123",
  "last_id": "msg_abc123",
  "has_more": false
}
```

## Domain Types

### Beta Response Item List

- `BetaResponseItemList object { data, first_id, has_more, 2 more }`

  A list of Response items.

  - `data: array of BetaResponseInputMessageItem or BetaResponseOutputMessage or FileSearchCall { id, queries, status, 3 more }  or 30 more`

    A list of items used to generate this response.

    - `BetaResponseInputMessageItem object { id, content, role, 3 more }`

      - `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 object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

          - `text: string`

            The text input to the model.

          - `type: "input_text"`

            The type of the input item. Always `input_text`.

            - `"input_text"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          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: optional string or null`

            The ID of the file to be sent to the model.

          - `image_url: optional string or null`

            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

          - `type: "input_file"`

            The type of the input item. Always `input_file`.

            - `"input_file"`

          - `detail: optional "auto" or "low" or "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: optional string`

            The content of the file to be sent to the model.

          - `file_id: optional string or null`

            The ID of the file to be sent to the model.

          - `file_url: optional string`

            The URL of the file to be sent to the model.

          - `filename: optional string`

            The name of the file to be sent to the model.

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

      - `role: "user" or "system" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { id, call_id, output, 5 more }`

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `status: "completed" or "incomplete" or "failed" or "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: optional array of object { id, code, message }`

        The safety checks reported by the API that have been acknowledged by the
        developer.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { id, arguments, call_id, 8 more }`

      - `id: string`

        The unique ID of the function tool call.

      - `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.

      - `status: "in_progress" or "completed" or "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"`

        The type of the function tool call. Always `function_call`.

        - `"function_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `namespace: optional string`

        The namespace of the function to run.

    - `FunctionCallOutput object { id, output, status, 7 more }`

      - `id: string`

        The unique ID of the function call tool output.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the function call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the function call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the function call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `name: optional string`

        The name of the tool that produced the output.

      - `namespace: optional string`

        The namespace of the tool that produced the output.

    - `AgentMessage object { id, author, content, 3 more }`

      - `id: string`

        The unique ID of the agent message.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputText or BetaResponseOutputText or Text { text, type }  or 7 more`

        Encrypted content sent between agents.

        - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

        - `Text object { text, type }`

          A text content.

          - `text: string`

          - `type: "text"`

            - `"text"`

        - `SummaryText object { text, type }`

          A summary text from the model.

          - `text: string`

            A summary of the reasoning output from the model so far.

          - `type: "summary_text"`

            The type of the object. Always `summary_text`.

            - `"summary_text"`

        - `ReasoningText object { text, type }`

          Reasoning text from the model.

          - `text: string`

            The reasoning text from the model.

          - `type: "reasoning_text"`

            The type of the reasoning text. Always `reasoning_text`.

            - `"reasoning_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          A refusal from the model.

        - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

        - `ComputerScreenshot object { detail, file_id, image_url, 2 more }`

          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 or null`

            The identifier of an uploaded file that contains the screenshot.

          - `image_url: string or null`

            The URL of the screenshot image.

          - `type: "computer_screenshot"`

            Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`.

            - `"computer_screenshot"`

          - `prompt_cache_breakpoint: optional object { mode }`

            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

            - `mode: "explicit"`

              The breakpoint mode. Always `explicit`.

              - `"explicit"`

        - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

          A file input to the model.

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The type of the item. Always `agent_message`.

        - `"agent_message"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { id, action, arguments, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { id, action, call_id, 3 more }`

      - `id: string`

        The unique ID of the multi-agent call output item.

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of BetaResponseOutputText`

        Text output returned by the multi-agent action.

        - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

          The annotations of the text output.

        - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

        - `text: string`

          The text output from the model.

        - `type: "output_text"`

          The type of the output text. Always `output_text`.

      - `type: "multi_agent_call_output"`

        The type of the multi-agent result. Always `multi_agent_call_output`.

        - `"multi_agent_call_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { id, arguments, call_id, 5 more }`

      - `id: string`

        The unique ID of the tool search call item.

      - `arguments: unknown`

        Arguments used for the tool search call.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ToolSearchOutput object { id, call_id, execution, 5 more }`

      - `id: string`

        The unique ID of the tool search output item.

      - `call_id: string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: "in_progress" or "completed" or "incomplete"`

        The status of the tool search output item that was recorded.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by tool search.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The type of the item. Always `tool_search_output`.

        - `"tool_search_output"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `AdditionalTools object { id, role, tools, 2 more }`

      - `id: string`

        The unique ID of the additional tools item.

      - `role: "unknown" or "user" or "assistant" or 5 more`

        The role that provided the additional tools.

        - `"unknown"`

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"critic"`

        - `"discriminator"`

        - `"developer"`

        - `"tool"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The additional tool definitions made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The type of the item. Always `additional_tools`.

        - `"additional_tools"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { id, type, agent, reasoning }`

      A configuration update that applies to subsequent responses until it is
      replaced by another configuration update.

      - `id: string`

        The unique ID of the configuration update item.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        The reasoning configuration applied by this update.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort used for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "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 object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of the program item.

      - `call_id: string`

        The stable call ID of the program item.

      - `code: string`

        The JavaScript source executed by programmatic tool calling.

      - `fingerprint: string`

        Opaque program replay fingerprint that must be round-tripped.

      - `type: "program"`

        The type of the item. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of the program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `Compaction object { id, encrypted_content, type, 2 more }`

      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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { id, action, call_id, 6 more }`

      A tool call that executes one or more shell commands in a managed environment.

      - `id: string`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

        - `max_output_length: number or null`

          Optional maximum number of characters to return from each command.

        - `timeout_ms: number or 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 or BetaResponseContainerReference or null`

        Represents the use of a local environment to perform shell actions.

        - `BetaResponseLocalEnvironment object { type }`

          Represents the use of a local environment to perform shell actions.

          - `type: "local"`

            The environment type. Always `local`.

            - `"local"`

        - `BetaResponseContainerReference object { container_id, type }`

          Represents a container created with /v1/containers.

          - `container_id: string`

          - `type: "container_reference"`

            The environment type. Always `container_reference`.

            - `"container_reference"`

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ShellCallOutput object { id, call_id, max_output_length, 6 more }`

      The output of a shell tool call that was emitted.

      - `id: string`

        The unique ID of the shell call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the shell tool call generated by the model.

      - `max_output_length: number or 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 of object { outcome, stderr, stdout, created_by }`

        An array of shell call output contents

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            Indicates that the shell commands finished and returned an exit code.

            - `exit_code: number`

              Exit code from the shell process.

            - `type: "exit"`

              The outcome type. Always `exit`.

              - `"exit"`

        - `stderr: string`

          The standard error output that was captured.

        - `stdout: string`

          The standard output that was captured.

        - `created_by: optional string`

          The identifier of the actor that created the item.

      - `status: "in_progress" or "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

    - `ApplyPatchCall object { id, call_id, operation, 5 more }`

      A tool call that applies file diffs by creating, deleting, or updating files.

      - `id: string`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        One of the create_file, delete_file, or update_file operations applied via apply_patch.

        - `CreateFile object { diff, path, type }`

          Instruction describing how to create a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to create.

          - `type: "create_file"`

            Create a new file with the provided diff.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction describing how to delete a file via the apply_patch tool.

          - `path: string`

            Path of the file to delete.

          - `type: "delete_file"`

            Delete the specified file.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction describing how to update a file via the apply_patch tool.

          - `diff: string`

            Diff to apply.

          - `path: string`

            Path of the file to update.

          - `type: "update_file"`

            Update an existing file with the provided diff.

            - `"update_file"`

      - `status: "in_progress" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call.

    - `ApplyPatchCallOutput object { id, call_id, status, 5 more }`

      The output emitted by an apply patch tool call.

      - `id: string`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `call_id: string`

        The unique ID of the apply patch tool call generated by the model.

      - `status: "completed" or "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: optional object { agent_name }`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The ID of the entity that created this tool call output.

      - `output: optional string or null`

        Optional textual output returned by the apply patch tool.

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { id, approval_request_id, approve, 3 more }`

      A response to an MCP approval request.

      - `id: string`

        The unique ID of the approval response

      - `approval_request_id: string`

        The ID of the approval request being answered.

      - `approve: boolean`

        Whether the request was approved.

      - `type: "mcp_approval_response"`

        The type of the item. Always `mcp_approval_response`.

        - `"mcp_approval_response"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCall object { id, call_id, input, 8 more }`

      - `id: string`

        The unique ID of the custom tool call item.

      - `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.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CustomToolCallOutput object { id, call_id, output, 5 more }`

      - `id: string`

        The unique ID of the custom tool call output item.

      - `call_id: string`

        The call ID, used to map this custom tool call output to a custom tool call.

      - `output: string or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

      - `status: "in_progress" or "completed" or "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: "custom_tool_call_output"`

        The type of the custom tool call output. Always `custom_tool_call_output`.

        - `"custom_tool_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `created_by: optional string`

        The identifier of the actor that created the item.

  - `first_id: string`

    The ID of the first item in the list.

  - `has_more: boolean`

    Whether there are more items available.

  - `last_id: string`

    The ID of the last item in the list.

  - `object: "list"`

    The type of object returned, must be `list`.

    - `"list"`

# Input Tokens

## Get input token counts

**post** `/responses/input_tokens?beta=true`

Returns input token counts of the request.

Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count.

### Header Parameters

- `"openai-beta": optional array of "responses_multi_agent=v1"`

  - `"responses_multi_agent=v1"`

### Body Parameters

- `conversation: optional string or BetaResponseConversationParam or null`

  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.

  - `ConversationID = string`

    The unique ID of the conversation.

  - `BetaResponseConversationParam object { id }`

    The conversation that this response belongs to.

    - `id: string`

      The unique ID of the conversation.

- `input: optional string or array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more or null`

  Text, image, or file inputs to the model, used to generate a response

  - `string`

    A text input to the model, equivalent to a text input with the `user` role.

  - `array of BetaEasyInputMessage or Message { content, role, agent, 2 more }  or BetaResponseOutputMessage or 33 more`

    A list of one or many input items to the model, containing different content types.

    - `BetaEasyInputMessage object { content, role, phase, type }`

      A message input to the model with a role indicating instruction following
      hierarchy. Instructions given with the `developer` or `system` role take
      precedence over instructions given with the `user` role. Messages with the
      `assistant` role are presumed to have been generated by the model in previous
      interactions.

      - `content: string or BetaResponseInputMessageContentList`

        Text, image, or audio input to the model, used to generate a response.
        Can also contain previous assistant responses.

        - `TextInput = string`

          A text input to the model.

        - `BetaResponseInputMessageContentList = array of BetaResponseInputContent`

          A list of one or many input items to the model, containing different content
          types.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string`

              The content of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string`

              The URL of the file to be sent to the model.

            - `filename: optional string`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode }`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

      - `role: "user" or "assistant" or "system" or "developer"`

        The role of the message input. One of `user`, `assistant`, `system`, or
        `developer`.

        - `"user"`

        - `"assistant"`

        - `"system"`

        - `"developer"`

      - `phase: optional "commentary" or "final_answer" or 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: optional "message"`

        The type of the message input. Always `message`.

        - `"message"`

    - `Message object { content, role, agent, 2 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.

      - `content: BetaResponseInputMessageContentList`

        A list of one or many input items to the model, containing different content
        types.

      - `role: "user" or "system" or "developer"`

        The role of the message input. One of `user`, `system`, or `developer`.

        - `"user"`

        - `"system"`

        - `"developer"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete"`

        The status of item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

      - `type: optional "message"`

        The type of the message input. Always set to `message`.

        - `"message"`

    - `BetaResponseOutputMessage object { id, content, role, 4 more }`

      An output message from the model.

      - `id: string`

        The unique ID of the output message.

      - `content: array of BetaResponseOutputText or BetaResponseOutputRefusal`

        The content of the output message.

        - `BetaResponseOutputText object { annotations, logprobs, text, type }`

          A text output from the model.

          - `annotations: array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }  or FilePath { file_id, index, type }`

            The annotations of the text output.

            - `FileCitation object { file_id, filename, index, type }`

              A citation to a file.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the file cited.

              - `index: number`

                The index 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 object { end_index, start_index, title, 2 more }`

              A citation for a web resource used to generate a model response.

              - `end_index: number`

                The index of the last character of the URL citation in the message.

              - `start_index: number`

                The index of the first character of the URL citation in the message.

              - `title: string`

                The title of the web resource.

              - `type: "url_citation"`

                The type of the URL citation. Always `url_citation`.

                - `"url_citation"`

              - `url: string`

                The URL of the web resource.

            - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

              A citation for a container file used to generate a model response.

              - `container_id: string`

                The ID of the container file.

              - `end_index: number`

                The index of the last character of the container file citation in the message.

              - `file_id: string`

                The ID of the file.

              - `filename: string`

                The filename of the container file cited.

              - `start_index: number`

                The index of the first character of the container file citation in the message.

              - `type: "container_file_citation"`

                The type of the container file citation. Always `container_file_citation`.

                - `"container_file_citation"`

            - `FilePath object { file_id, index, type }`

              A path to a file.

              - `file_id: string`

                The ID of the file.

              - `index: number`

                The index of the file in the list of files.

              - `type: "file_path"`

                The type of the file path. Always `file_path`.

                - `"file_path"`

          - `logprobs: array of object { token, bytes, logprob, top_logprobs }`

            - `token: string`

            - `bytes: array of number`

            - `logprob: number`

            - `top_logprobs: array of object { token, bytes, logprob }`

              - `token: string`

              - `bytes: array of number`

              - `logprob: number`

          - `text: string`

            The text output from the model.

          - `type: "output_text"`

            The type of the output text. Always `output_text`.

            - `"output_text"`

        - `BetaResponseOutputRefusal object { refusal, type }`

          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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `phase: optional "commentary" or "final_answer" or 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"`

    - `FileSearchCall object { id, queries, status, 3 more }`

      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 of string`

        The queries used to search for files.

      - `status: "in_progress" or "searching" or "completed" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `results: optional array of object { attributes, file_id, filename, 2 more }  or null`

        The results of the file search tool call.

        - `attributes: optional map[string or number or boolean] or 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: optional string`

          The unique ID of the file.

        - `filename: optional string`

          The name of the file.

        - `score: optional number`

          The relevance score of the file - a value between 0 and 1.

        - `text: optional string`

          The text that was retrieved from the file.

    - `ComputerCall object { id, call_id, pending_safety_checks, 5 more }`

      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 of object { id, code, message }`

        The pending safety checks for the computer call.

        - `id: string`

          The ID of the pending safety check.

        - `code: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `status: "in_progress" or "completed" or "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: optional BetaComputerAction`

        A click action.

        - `Click object { button, type, x, 2 more }`

          A click action.

          - `button: "left" or "right" or "wheel" or 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: optional array of string or null`

            The keys being held while clicking.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

          - `keys: array of string or 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 object { path, type, keys }`

          A drag action.

          - `path: array of object { x, y }`

            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: optional array of string or null`

            The keys being held while dragging the mouse.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

          - `keys: array of 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 object { type, x, y, keys }`

          A mouse move action.

          - `type: "move"`

            Specifies the event type. For a move action, this property is always set to `move`.

            - `"move"`

          - `x: number`

            The x-coordinate to move to.

          - `y: number`

            The y-coordinate to move to.

          - `keys: optional array of string or null`

            The keys being held while moving the mouse.

        - `Screenshot object { type }`

          A screenshot action.

          - `type: "screenshot"`

            Specifies the event type. For a screenshot action, this property is always set to `screenshot`.

            - `"screenshot"`

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

          - `scroll_x: number`

            The horizontal scroll distance.

          - `scroll_y: number`

            The vertical scroll distance.

          - `type: "scroll"`

            Specifies the event type. For a scroll action, this property is always set to `scroll`.

            - `"scroll"`

          - `x: number`

            The x-coordinate where the scroll occurred.

          - `y: number`

            The y-coordinate where the scroll occurred.

          - `keys: optional array of string or null`

            The keys being held while scrolling.

        - `Type object { text, type }`

          An action to type in text.

          - `text: string`

            The text to type.

          - `type: "type"`

            Specifies the event type. For a type action, this property is always set to `type`.

            - `"type"`

        - `Wait object { type }`

          A wait action.

          - `type: "wait"`

            Specifies the event type. For a wait action, this property is always set to `wait`.

            - `"wait"`

      - `actions: optional BetaComputerActionList`

        Flattened batched actions for `computer_use`. Each action includes an
        `type` discriminator and action-specific fields.

        - `Click object { button, type, x, 2 more }`

          A click action.

        - `DoubleClick object { keys, type, x, y }`

          A double click action.

        - `Drag object { path, type, keys }`

          A drag action.

        - `Keypress object { keys, type }`

          A collection of keypresses the model would like to perform.

        - `Move object { type, x, y, keys }`

          A mouse move action.

        - `Screenshot object { type }`

          A screenshot action.

        - `Scroll object { scroll_x, scroll_y, type, 3 more }`

          A scroll action.

        - `Type object { text, type }`

          An action to type in text.

        - `Wait object { type }`

          A wait action.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ComputerCallOutput object { call_id, output, type, 4 more }`

      The output of a computer tool call.

      - `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: optional string`

          The identifier of an uploaded file that contains the screenshot.

        - `image_url: optional string`

          The URL of the screenshot image.

      - `type: "computer_call_output"`

        The type of the computer tool call output. Always `computer_call_output`.

        - `"computer_call_output"`

      - `id: optional string or null`

        The ID of the computer tool call output.

      - `acknowledged_safety_checks: optional array of object { id, code, message }  or 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: optional string or null`

          The type of the pending safety check.

        - `message: optional string or null`

          Details about the pending safety check.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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"`

    - `WebSearchCall object { id, status, type, 2 more }`

      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.

      - `status: "in_progress" or "searching" or "completed" or 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"`

      - `action: optional Search { type, queries, query, sources }  or OpenPage { type, url }  or FindInPage { pattern, type, url }`

        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 object { type, queries, query, sources }`

          Action type "search" - Performs a web search query.

          - `type: "search"`

            The action type.

            - `"search"`

          - `queries: optional array of string`

            The search queries.

          - `query: optional string`

            The search query.

          - `sources: optional array of object { type, url }`

            The sources used in the search.

            - `type: "url"`

              The type of source. Always `url`.

              - `"url"`

            - `url: string`

              The URL of the source.

        - `OpenPage object { type, url }`

          Action type "open_page" - Opens a specific URL from search results.

          - `type: "open_page"`

            The action type.

            - `"open_page"`

          - `url: optional string or null`

            The URL opened by the model.

        - `FindInPage object { pattern, type, url }`

          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: optional string or null`

            The URL of the page searched for the pattern, when available.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `FunctionCall object { arguments, call_id, name, 7 more }`

      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: optional string`

        The unique ID of the function tool call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the function tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the function to run.

      - `status: optional "in_progress" or "completed" or "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 object { output, type, id, 6 more }`

      The output of a function tool call.

      - `output: string or array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

        Text, image, or file output of the function tool call.

        - `string`

          A JSON string of the output of the function tool call.

        - `array of BetaResponseInputTextContent or BetaResponseInputImageContent or BetaResponseInputFileContent`

          An array of content outputs (text, image, file) for the function tool call.

          - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

            - `text: string`

              The text input to the model.

            - `type: "input_text"`

              The type of the input item. Always `input_text`.

              - `"input_text"`

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

            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: optional BetaImageDetail or 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: optional string or null`

              The ID of the file to be sent to the model.

            - `image_url: optional string or null`

              The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "12h"`

                The minimum lifetime of this cache breakpoint. Defaults to the request TTL.

                - `"30m"`

                - `"12h"`

          - `BetaResponseInputFileContent object { type, detail, file_data, 4 more }`

            A file input to the model.

            - `type: "input_file"`

              The type of the input item. Always `input_file`.

              - `"input_file"`

            - `detail: optional "auto" or "low" or "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: optional string or null`

              The base64-encoded data of the file to be sent to the model.

            - `file_id: optional string or null`

              The ID of the file to be sent to the model.

            - `file_url: optional string or null`

              The URL of the file to be sent to the model.

            - `filename: optional string or null`

              The name of the file to be sent to the model.

            - `prompt_cache_breakpoint: optional object { mode, ttl }  or null`

              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.

              - `mode: "explicit"`

                The breakpoint mode. Always `explicit`.

                - `"explicit"`

              - `ttl: optional "30m" or "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: optional string or null`

        The unique ID of the function tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the function tool call generated by the model.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `name: optional string or null`

        The name of the tool that produced the output.

      - `namespace: optional string or null`

        The namespace of the tool that produced the output.

      - `status: optional "in_progress" or "completed" or "incomplete" or 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 object { author, content, recipient, 3 more }`

      A message routed between agents.

      - `author: string`

        The sending agent identity.

      - `content: array of BetaResponseInputTextContent or BetaResponseInputImageContent or EncryptedContent { encrypted_content, type }`

        Plaintext, image, or encrypted content sent between agents.

        - `BetaResponseInputTextContent object { text, type, prompt_cache_breakpoint }`

          A text input to the model.

        - `BetaResponseInputImageContent object { type, detail, file_id, 2 more }`

          An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision)

        - `EncryptedContent object { encrypted_content, type }`

          Opaque encrypted content that Responses API decrypts inside trusted model execution.

          - `encrypted_content: string`

            Opaque encrypted content.

          - `type: "encrypted_content"`

            The type of the input item. Always `encrypted_content`.

            - `"encrypted_content"`

      - `recipient: string`

        The destination agent identity.

      - `type: "agent_message"`

        The item type. Always `agent_message`.

        - `"agent_message"`

      - `id: optional string or null`

        The unique ID of this agent message item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCall object { action, arguments, call_id, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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.

      - `type: "multi_agent_call"`

        The item type. Always `multi_agent_call`.

        - `"multi_agent_call"`

      - `id: optional string or null`

        The unique ID of this multi-agent call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `MultiAgentCallOutput object { action, call_id, output, 3 more }`

      - `action: "spawn_agent" or "interrupt_agent" or "list_agents" or 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 of object { text, type, annotations }`

        Text output returned by the multi-agent action.

        - `text: string`

          The text content.

        - `type: "output_text"`

          The content type. Always `output_text`.

          - `"output_text"`

        - `annotations: optional array of FileCitation { file_id, filename, index, type }  or URLCitation { end_index, start_index, title, 2 more }  or ContainerFileCitation { container_id, end_index, file_id, 3 more }`

          Citations associated with the text content.

          - `FileCitation object { file_id, filename, index, type }`

            - `file_id: string`

              The ID of the file.

            - `filename: string`

              The filename of the file cited.

            - `index: number`

              The index of the file in the list of files.

            - `type: "file_citation"`

              The citation type. Always `file_citation`.

              - `"file_citation"`

          - `URLCitation object { end_index, start_index, title, 2 more }`

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `start_index: number`

              The index of the first character of the citation in the message.

            - `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.

          - `ContainerFileCitation object { container_id, end_index, file_id, 3 more }`

            - `container_id: string`

              The ID of the container.

            - `end_index: number`

              The index of the last character of the citation in the message.

            - `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.

            - `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: optional string or null`

        The unique ID of this multi-agent call output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ToolSearchCall object { arguments, type, id, 4 more }`

      - `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: optional string or null`

        The unique ID of this tool search call.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search call.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ToolSearchOutput object { tools, type, id, 4 more }`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        The loaded tool definitions returned by the tool search output.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                  - `type: "disabled"`

                    Disable outbound network access. Always `disabled`.

                    - `"disabled"`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

                  - `allowed_domains: array of string`

                    A list of allowed domains when type is `allowlist`.

                  - `type: "allowlist"`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `"allowlist"`

                  - `domain_secrets: optional array of BetaContainerNetworkPolicyDomainSecret`

                    Optional domain-scoped secrets for allowlisted domains.

                    - `domain: string`

                      The domain associated with the secret.

                    - `name: string`

                      The name of the secret to inject for the domain.

                    - `value: string`

                      The secret value to inject for the domain.

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

              - `type: "container_auto"`

                Automatically creates a container for this request

                - `"container_auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

              - `skills: optional array of BetaSkillReference or BetaInlineSkill`

                An optional list of skills referenced by id or inline data.

                - `BetaSkillReference object { skill_id, type, version }`

                  - `skill_id: string`

                    The ID of the referenced skill.

                  - `type: "skill_reference"`

                    References a skill created with the /v1/skills endpoint.

                    - `"skill_reference"`

                  - `version: optional string`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `BetaInlineSkill object { description, name, source, type }`

                  - `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.

                    - `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 object { type, skills }`

              - `type: "local"`

                Use a local computer environment.

                - `"local"`

              - `skills: optional array of BetaLocalSkill`

                An optional list of skills.

                - `description: string`

                  The description of the skill.

                - `name: string`

                  The name of the skill.

                - `path: string`

                  The path to the directory containing the skill.

            - `BetaContainerReference object { container_id, type }`

              - `container_id: string`

                The ID of the referenced container.

              - `type: "container_reference"`

                References a container created with the /v1/containers endpoint

                - `"container_reference"`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `BetaToolSearchOutputNamespaceTool object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools loaded inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

                The name of the loaded function tool.

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "tool_search_output"`

        The item type. Always `tool_search_output`.

        - `"tool_search_output"`

      - `id: optional string or null`

        The unique ID of this tool search output.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `call_id: optional string or null`

        The unique ID of the tool search call generated by the model.

      - `execution: optional "server" or "client"`

        Whether tool search was executed by the server or by the client.

        - `"server"`

        - `"client"`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the tool search output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `AdditionalTools object { role, tools, type, 2 more }`

      - `role: "developer"`

        The role that provided the additional tools. Only `developer` is supported.

        - `"developer"`

      - `tools: array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more`

        A list of additional tools made available at this item.

        - `Function object { name, parameters, strict, 6 more }`

          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: map[unknown] or null`

            A JSON schema object describing the parameters of the function.

          - `strict: boolean or null`

            Whether strict parameter validation is enforced for this function tool.

          - `type: "function"`

            The type of the function tool. Always `function`.

            - `"function"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

          - `defer_loading: optional boolean`

            Whether this function is deferred and loaded via tool search.

          - `description: optional string or null`

            A description of the function. Used by the model to determine whether or not to call the function.

          - `output_schema: optional map[unknown] or null`

            A JSON schema object describing the JSON value encoded in string outputs for this function.

        - `FileSearch object { type, vector_store_ids, filters, 2 more }`

          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 of string`

            The IDs of the vector stores to search.

          - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

            A filter to apply.

            - `ComparisonFilter object { key, type, value }`

              A filter used to compare a specified attribute key to a given value using a defined comparison operation.

              - `key: string`

                The key to compare against the value.

              - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

                The value to compare against the attribute key; supports string, number, or boolean types.

                - `string`

                - `number`

                - `boolean`

                - `array of string or number`

                  - `string`

                  - `number`

            - `BetaCompoundFilter = unknown`

              Combine multiple filters using `and` or `or`.

          - `max_num_results: optional number`

            The maximum number of results to return. This number should be between 1 and 50 inclusive.

          - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

            Ranking options for search.

            - `hybrid_search: optional object { embedding_weight, text_weight }`

              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: optional "auto" or "default-2024-11-15"`

              The ranker to use for the file search.

              - `"auto"`

              - `"default-2024-11-15"`

            - `score_threshold: optional 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.

        - `Computer object { type }`

          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"`

        - `ComputerUsePreview object { display_height, display_width, environment, type }`

          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" or "mac" or "linux" or 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"`

        - `WebSearch object { type, external_web_access, filters, 2 more }`

          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" or "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: optional 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: optional object { allowed_domains }  or null`

            Filters for the search.

            - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

            - `type: optional "approximate"`

              The type of location approximation. Always `approximate`.

              - `"approximate"`

        - `Mcp object { server_label, type, allowed_callers, 9 more }`

          Give the model access to additional tools via remote Model Context Protocol
          (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

            List of allowed tool names or a filter object.

            - `McpAllowedTools = array of string`

              A string array of allowed tool names

            - `McpToolFilter object { read_only, tool_names }`

              A filter object to specify which tools are allowed.

              - `read_only: optional 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: optional array of string`

                List of allowed tool names.

          - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

            Whether this MCP tool is deferred and discovered via tool search.

          - `headers: optional map[string] or null`

            Optional HTTP headers to send to the MCP server. Use for authentication
            or other purposes.

          - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

            Specify which of the MCP server's tools require approval.

            - `McpToolApprovalFilter object { always, never }`

              Specify which of the MCP server's tools require approval. Can be
              `always`, `never`, or a filter object associated with tools
              that require approval.

              - `always: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

              - `never: optional object { read_only, tool_names }`

                A filter object to specify which tools are allowed.

                - `read_only: optional 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: optional array of string`

                  List of allowed tool names.

            - `McpToolApprovalSetting = "always" or "never"`

              Specify a single approval policy for all tools. One of `always` or
              `never`. When set to `always`, all tools will require approval. When
              set to `never`, all tools will not require approval.

              - `"always"`

              - `"never"`

          - `server_description: optional string`

            Optional description of the MCP server, used to provide more context.

          - `server_url: optional string`

            The URL for the MCP server. One of `server_url`, `connector_id`, or
            `tunnel_id` must be provided.

          - `tunnel_id: optional 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 object { container, type, allowed_callers }`

          A tool that runs Python code to help generate a response to a prompt.

          - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

            The code interpreter container. Can be a container ID or an object that
            specifies uploaded file IDs to make available to your code, along with an
            optional `memory_limit` setting.

            - `string`

              The container ID.

            - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

              Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

              - `type: "auto"`

                Always `auto`.

                - `"auto"`

              - `file_ids: optional array of string`

                An optional list of uploaded files to make available to your code.

              - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

                The memory limit for the code interpreter container.

                - `"1g"`

                - `"4g"`

                - `"16g"`

                - `"64g"`

              - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

                Network access policy for the container.

                - `BetaContainerNetworkPolicyDisabled object { type }`

                - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

          - `type: "code_interpreter"`

            The type of the code interpreter tool. Always `code_interpreter`.

            - `"code_interpreter"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

        - `ProgrammaticToolCalling object { type }`

          - `type: "programmatic_tool_calling"`

            The type of the tool. Always `programmatic_tool_calling`.

            - `"programmatic_tool_calling"`

        - `ImageGeneration object { type, action, background, 9 more }`

          A tool that generates images using the GPT image models.

          - `type: "image_generation"`

            The type of the image generation tool. Always `image_generation`.

            - `"image_generation"`

          - `action: optional "generate" or "edit" or "auto"`

            Whether to generate a new image or edit an existing image. Default: `auto`.

            - `"generate"`

            - `"edit"`

            - `"auto"`

          - `background: optional "transparent" or "opaque" or "auto"`

            Set the background of the generated image. One of `transparent`, `opaque`,
            or `auto`. `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`.
            Default: `auto`.

            - `"transparent"`

            - `"opaque"`

            - `"auto"`

          - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

            Optional mask for inpainting. Contains `image_url`
            (string, optional) and `file_id` (string, optional).

            - `file_id: optional string`

              File ID for the mask image.

            - `image_url: optional string`

              Base64-encoded mask image.

          - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

            The image generation model to use. One of `gpt-image-1`,
            `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`, or `chatgpt-image-latest`. Default:
            `gpt-image-1`.

            - `string`

            - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

              The image generation model to use. One of `gpt-image-1`,
              `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`, or `chatgpt-image-latest`. Default:
              `gpt-image-1`.

              - `"gpt-image-1"`

              - `"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"`

          - `moderation: optional "auto" or "low"`

            Moderation level for the generated image. Default: `auto`.

            - `"auto"`

            - `"low"`

          - `output_compression: optional number`

            Compression level for the output image. Default: 100.

          - `output_format: optional "png" or "webp" or "jpeg"`

            The output format of the generated image. One of `png`, `webp`, or
            `jpeg`. Default: `png`.

            - `"png"`

            - `"webp"`

            - `"jpeg"`

          - `partial_images: optional number`

            Number of partial images to generate in streaming mode, from 0 (default value) to 3.

          - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

              - `"1024x1024"`

              - `"1024x1536"`

              - `"1536x1024"`

              - `"auto"`

        - `LocalShell object { type }`

          A tool that allows the model to execute shell commands in a local environment.

          - `type: "local_shell"`

            The type of the local shell tool. Always `local_shell`.

            - `"local_shell"`

        - `Shell object { type, allowed_callers, environment }`

          A tool that allows the model to execute shell commands.

          - `type: "shell"`

            The type of the shell tool. Always `shell`.

            - `"shell"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

            - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

            - `BetaLocalEnvironment object { type, skills }`

            - `BetaContainerReference object { container_id, type }`

        - `Custom object { name, type, allowed_callers, 4 more }`

          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: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

          - `async: optional boolean`

            Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

          - `defer_loading: optional boolean`

            Whether this tool should be deferred and discovered via tool search.

          - `description: optional string`

            Optional description of the custom tool, used to provide more context.

          - `format: optional Text { type }  or Grammar { definition, syntax, type }`

            The input format for the custom tool. Default is unconstrained text.

            - `Text object { type }`

              Unconstrained free-form text.

              - `type: "text"`

                Unconstrained text format. Always `text`.

                - `"text"`

            - `Grammar object { definition, syntax, type }`

              A grammar defined by the user.

              - `definition: string`

                The grammar definition.

              - `syntax: "lark" or "regex"`

                The syntax of the grammar definition. One of `lark` or `regex`.

                - `"lark"`

                - `"regex"`

              - `type: "grammar"`

                Grammar format. Always `grammar`.

                - `"grammar"`

        - `Namespace object { description, name, tools, type }`

          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`).

          - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

            The function/custom tools available inside this namespace.

            - `Function object { name, type, allowed_callers, 6 more }`

              - `name: string`

              - `type: "function"`

                - `"function"`

              - `allowed_callers: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this function should be deferred and discovered via tool search.

              - `description: optional string or null`

              - `output_schema: optional map[unknown] or null`

                A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

              - `parameters: optional unknown or null`

              - `strict: optional boolean or 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.

            - `Custom object { name, type, allowed_callers, 4 more }`

              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: optional array of "direct" or "programmatic" or null`

                The tool invocation context(s).

                - `"direct"`

                - `"programmatic"`

              - `async: optional boolean`

                Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

              - `defer_loading: optional boolean`

                Whether this tool should be deferred and discovered via tool search.

              - `description: optional string`

                Optional description of the custom tool, used to provide more context.

              - `format: optional Text { type }  or Grammar { definition, syntax, type }`

                The input format for the custom tool. Default is unconstrained text.

                - `Text object { type }`

                  Unconstrained free-form text.

                  - `type: "text"`

                    Unconstrained text format. Always `text`.

                    - `"text"`

                - `Grammar object { definition, syntax, type }`

                  A grammar defined by the user.

                  - `definition: string`

                    The grammar definition.

                  - `syntax: "lark" or "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"`

        - `ToolSearch object { type, description, execution, parameters }`

          Hosted or BYOT tool search configuration for deferred tools.

          - `type: "tool_search"`

            The type of the tool. Always `tool_search`.

            - `"tool_search"`

          - `description: optional string or null`

            Description shown to the model for a client-executed tool search tool.

          - `execution: optional "server" or "client"`

            Whether tool search is executed by the server or by the client.

            - `"server"`

            - `"client"`

          - `parameters: optional unknown or null`

            Parameter schema for a client-executed tool search tool.

        - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

          This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

          - `type: "web_search_preview" or "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: optional array of "text" or "image"`

            - `"text"`

            - `"image"`

          - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

              Free text input for the city of the user, e.g. `San Francisco`.

            - `country: optional string or null`

              The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

            - `region: optional string or null`

              Free text input for the region of the user, e.g. `California`.

            - `timezone: optional string or null`

              The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

        - `ApplyPatch object { type, allowed_callers }`

          Allows the assistant to create, delete, or update files using unified diffs.

          - `type: "apply_patch"`

            The type of the tool. Always `apply_patch`.

            - `"apply_patch"`

          - `allowed_callers: optional array of "direct" or "programmatic" or null`

            The tool invocation context(s).

            - `"direct"`

            - `"programmatic"`

      - `type: "additional_tools"`

        The item type. Always `additional_tools`.

        - `"additional_tools"`

      - `id: optional string or null`

        The unique ID of this additional tools item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ConfigurationUpdate object { type, id, agent, reasoning }`

      An update to the conversation's response configuration. The configuration
      remains in effect for subsequent responses until it is replaced by another
      configuration update.

      - `type: "configuration_update"`

        The item type. Always `configuration_update`.

        - `"configuration_update"`

      - `id: optional string or null`

        The unique ID of the configuration update item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reasoning: optional object { effort }`

        Updates to reasoning configuration. Only effort is supported.

        - `effort: optional "none" or "minimal" or "low" or 4 more or null`

          The reasoning effort to use for subsequent responses until another
          configuration update replaces it.

          - `"none"`

          - `"minimal"`

          - `"low"`

          - `"medium"`

          - `"high"`

          - `"xhigh"`

          - `"max"`

    - `Reasoning object { id, summary, type, 4 more }`

      A description of the chain of thought used by a reasoning model while generating
      a response. Be sure to include these items in your `input` to the Responses API
      for subsequent turns of a conversation if you are manually
      [managing context](/api/docs/guides/conversation-state).

      - `id: string`

        The unique identifier of the reasoning content.

      - `summary: array of object { text, type }`

        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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `content: optional array of object { text, type }`

        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: optional string or 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: optional "in_progress" or "completed" or "incomplete"`

        The status of the item. One of `in_progress`, `completed`, or
        `incomplete`. Populated when items are returned via API.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `Compaction object { encrypted_content, type, id, agent }`

      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.

      - `type: "compaction"`

        The type of the item. Always `compaction`.

        - `"compaction"`

      - `id: optional string or null`

        The ID of the compaction item.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ImageGenerationCall object { id, result, status, 9 more }`

      An image generation request made by the model.

      - `id: string`

        The unique ID of the image generation call.

      - `result: string or null`

        The generated image encoded in base64.

      - `status: "in_progress" or "completed" or "generating" or "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: optional "generate" or "edit" or "auto" or null`

        The action used for image generation.

        - `"generate"`

        - `"edit"`

        - `"auto"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `background: optional "transparent" or "opaque" or "auto" or null`

        The background setting used for generation.

        - `"transparent"`

        - `"opaque"`

        - `"auto"`

      - `error: optional object { code, message, param, 2 more }`

        Details of a moderation failure, when available.

        - `code: string or null`

          The error code.

        - `message: string`

          A description of the error.

        - `param: string or null`

          The related request parameter.

        - `type: string`

          The error type.

        - `moderation_details: optional object { categories, moderation_stage }`

          Public details for a `moderation_blocked` error, when available.

          - `categories: array of string`

            Public moderation categories. New category values may be added over time.

          - `moderation_stage: "input" or "output" or "unknown"`

            The stage where moderation blocked the image generation call.

            - `"input"`

            - `"output"`

            - `"unknown"`

      - `output_format: optional "png" or "webp" or "jpeg" or null`

        The output format used for generation.

        - `"png"`

        - `"webp"`

        - `"jpeg"`

      - `quality: optional "low" or "medium" or "high" or 3 more or 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: optional string or null`

        The prompt that was used after any model prompt rewriting.

      - `size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or null`

        The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

        - `string`

        - `"1024x1024" or "1024x1536" or "1536x1024"`

          The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.

          - `"1024x1024"`

          - `"1024x1536"`

          - `"1536x1024"`

    - `CodeInterpreterCall object { id, code, container_id, 4 more }`

      A tool call to run code.

      - `id: string`

        The unique ID of the code interpreter tool call.

      - `code: string or 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 of Logs { logs, type }  or Image { type, url }  or null`

        The outputs generated by the code interpreter, such as logs or images.
        Can be null if no outputs are available.

        - `Logs object { logs, type }`

          The logs output from the code interpreter.

          - `logs: string`

            The logs output from the code interpreter.

          - `type: "logs"`

            The type of the output. Always `logs`.

            - `"logs"`

        - `Image object { type, url }`

          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.

      - `status: "in_progress" or "completed" or "incomplete" or 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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCall object { id, action, call_id, 3 more }`

      A tool call to run a command on the local shell.

      - `id: string`

        The unique ID of the local shell call.

      - `action: object { command, env, type, 3 more }`

        Execute a shell command on the server.

        - `command: array of string`

          The command to run.

        - `env: map[string]`

          Environment variables to set for the command.

        - `type: "exec"`

          The type of the local shell action. Always `exec`.

          - `"exec"`

        - `timeout_ms: optional number or null`

          Optional timeout in milliseconds for the command.

        - `user: optional string or null`

          Optional user to run the command as.

        - `working_directory: optional string or 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" or "completed" or "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: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `LocalShellCallOutput object { id, output, type, 2 more }`

      The output of a local shell tool call.

      - `id: string`

        The unique ID of the local shell tool call generated by the model.

      - `output: string`

        A JSON string of the output of the local shell tool call.

      - `type: "local_shell_call_output"`

        The type of the local shell tool call output. Always `local_shell_call_output`.

        - `"local_shell_call_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the item. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCall object { action, call_id, type, 5 more }`

      A tool representing a request to execute one or more shell commands.

      - `action: object { commands, max_output_length, timeout_ms }`

        The shell commands and limits that describe how to run the tool call.

        - `commands: array of string`

          Ordered shell commands for the execution environment to run.

        - `max_output_length: optional number or null`

          Maximum number of UTF-8 characters to capture from combined stdout and stderr output.

        - `timeout_ms: optional number or 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.

      - `type: "shell_call"`

        The type of the item. Always `shell_call`.

        - `"shell_call"`

      - `id: optional string or null`

        The unique ID of the shell tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `environment: optional BetaLocalEnvironment or BetaContainerReference or null`

        The environment to execute the shell commands in.

        - `BetaLocalEnvironment object { type, skills }`

        - `BetaContainerReference object { container_id, type }`

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ShellCallOutput object { call_id, output, type, 5 more }`

      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.

      - `output: array of BetaResponseFunctionShellCallOutputContent`

        Captured chunks of stdout and stderr output, along with their associated outcomes.

        - `outcome: Timeout { type }  or Exit { exit_code, type }`

          The exit or timeout outcome associated with this shell call.

          - `Timeout object { type }`

            Indicates that the shell call exceeded its configured time limit.

            - `type: "timeout"`

              The outcome type. Always `timeout`.

              - `"timeout"`

          - `Exit object { exit_code, type }`

            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.

        - `stdout: string`

          Captured stdout output for the shell call.

      - `type: "shell_call_output"`

        The type of the item. Always `shell_call_output`.

        - `"shell_call_output"`

      - `id: optional string or null`

        The unique ID of the shell tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `max_output_length: optional number or null`

        The maximum number of UTF-8 characters captured for this shell call's combined output.

      - `status: optional "in_progress" or "completed" or "incomplete" or null`

        The status of the shell call output.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

    - `ApplyPatchCall object { call_id, operation, status, 4 more }`

      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.

      - `operation: CreateFile { diff, path, type }  or DeleteFile { path, type }  or UpdateFile { diff, path, type }`

        The specific create, delete, or update instruction for the apply_patch tool call.

        - `CreateFile object { diff, path, type }`

          Instruction for creating a new file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply when creating the file.

          - `path: string`

            Path of the file to create relative to the workspace root.

          - `type: "create_file"`

            The operation type. Always `create_file`.

            - `"create_file"`

        - `DeleteFile object { path, type }`

          Instruction for deleting an existing file via the apply_patch tool.

          - `path: string`

            Path of the file to delete relative to the workspace root.

          - `type: "delete_file"`

            The operation type. Always `delete_file`.

            - `"delete_file"`

        - `UpdateFile object { diff, path, type }`

          Instruction for updating an existing file via the apply_patch tool.

          - `diff: string`

            Unified diff content to apply to the existing file.

          - `path: string`

            Path of the file to update relative to the workspace root.

          - `type: "update_file"`

            The operation type. Always `update_file`.

            - `"update_file"`

      - `status: "in_progress" or "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: optional string or null`

        The unique ID of the apply patch tool call. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `ApplyPatchCallOutput object { call_id, status, type, 4 more }`

      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.

      - `status: "completed" or "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: optional string or null`

        The unique ID of the apply patch tool call output. Populated when this item is returned via API.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

      - `output: optional string or null`

        Optional human-readable log text from the apply patch tool (e.g., patch results or errors).

    - `McpListTools object { id, server_label, tools, 3 more }`

      A list of tools available on an MCP server.

      - `id: string`

        The unique ID of the list.

      - `server_label: string`

        The label of the MCP server.

      - `tools: array of object { input_schema, name, annotations, description }`

        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: optional unknown or null`

          Additional annotations about the tool.

        - `description: optional string or null`

          The description of the tool.

      - `type: "mcp_list_tools"`

        The type of the item. Always `mcp_list_tools`.

        - `"mcp_list_tools"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `error: optional string or null`

        Error message if the server could not list tools.

    - `McpApprovalRequest object { id, arguments, name, 3 more }`

      A request for human approval of a tool invocation.

      - `id: string`

        The unique ID of the approval request.

      - `arguments: string`

        A JSON string of arguments for the tool.

      - `name: string`

        The name of the tool to run.

      - `server_label: string`

        The label of the MCP server making the request.

      - `type: "mcp_approval_request"`

        The type of the item. Always `mcp_approval_request`.

        - `"mcp_approval_request"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `McpApprovalResponse object { approval_request_id, approve, type, 3 more }`

      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: optional string or null`

        The unique ID of the approval response

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `reason: optional string or null`

        Optional reason for the decision.

    - `McpCall object { id, arguments, name, 7 more }`

      An invocation of a tool on an MCP server.

      - `id: string`

        The unique ID of the tool call.

      - `arguments: string`

        A JSON string of the arguments passed to the tool.

      - `name: string`

        The name of the tool that was run.

      - `server_label: string`

        The label of the MCP server running the tool.

      - `type: "mcp_call"`

        The type of the item. Always `mcp_call`.

        - `"mcp_call"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `approval_request_id: optional string or 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: optional BetaMcpToolCallError or null`

        The error from the tool call, if any.

        - `McpProtocolError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "mcp_protocol_error"`

            - `"mcp_protocol_error"`

        - `McpToolExecutionError object { content, type }`

          - `content: unknown`

          - `type: "mcp_tool_execution_error"`

            - `"mcp_tool_execution_error"`

        - `HTTPError object { code, message, type }`

          - `code: number`

          - `message: string`

          - `type: "http_error"`

            - `"http_error"`

      - `output: optional string or null`

        The output from the tool call.

      - `status: optional "in_progress" or "completed" or "incomplete" or 2 more`

        The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.

        - `"in_progress"`

        - `"completed"`

        - `"incomplete"`

        - `"calling"`

        - `"failed"`

    - `CustomToolCallOutput object { call_id, output, type, 3 more }`

      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 or array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

        The output from the custom tool call generated by your code.
        Can be a string or an list of output content.

        - `StringOutput = string`

          A string of the output of the custom tool call.

        - `OutputContentList = array of BetaResponseInputText or BetaResponseInputImage or BetaResponseInputFile`

          Text, image, or file output of the custom tool call.

          - `BetaResponseInputText object { text, type, prompt_cache_breakpoint }`

            A text input to the model.

          - `BetaResponseInputImage object { detail, type, file_id, 2 more }`

            An image input to the model. Learn about [image inputs](/api/docs/guides/images-vision).

          - `BetaResponseInputFile object { type, detail, file_data, 4 more }`

            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: optional string`

        The unique ID of the custom tool call output in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            The caller type. Always `direct`.

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            The caller type. Always `program`.

            - `"program"`

    - `CustomToolCall object { call_id, input, name, 6 more }`

      A call to a custom tool created by the model.

      - `call_id: string`

        An identifier used to map this custom tool call to a tool call output.

      - `input: string`

        The input for the custom tool call generated by the model.

      - `name: string`

        The name of the custom tool being called.

      - `type: "custom_tool_call"`

        The type of the custom tool call. Always `custom_tool_call`.

        - `"custom_tool_call"`

      - `id: optional string`

        The unique ID of the custom tool call in the OpenAI platform.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `async: optional boolean`

        Whether the custom tool call runs asynchronously.

      - `caller: optional Direct { type }  or Program { caller_id, type }  or null`

        The execution context that produced this tool call.

        - `Direct object { type }`

          - `type: "direct"`

            - `"direct"`

        - `Program object { caller_id, type }`

          - `caller_id: string`

            The call ID of the program item that produced this tool call.

          - `type: "program"`

            - `"program"`

      - `namespace: optional string`

        The namespace of the custom tool being called.

    - `CompactionTrigger object { type, id, agent }`

      Compacts the current context. Must be the final input item.

      - `type: "compaction_trigger"`

        The type of the item. Always `compaction_trigger`.

        - `"compaction_trigger"`

      - `id: optional string or null`

        The unique ID of this compaction trigger.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ItemReference object { id, agent, type }`

      An internal identifier for an item to reference.

      - `id: string`

        The ID of the item to reference.

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

      - `type: optional "item_reference" or null`

        The type of item to reference. Always `item_reference`.

        - `"item_reference"`

    - `Program object { id, call_id, code, 3 more }`

      - `id: string`

        The unique ID of this 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 item type. Always `program`.

        - `"program"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

    - `ProgramOutput object { id, call_id, result, 3 more }`

      - `id: string`

        The unique ID of this program output item.

      - `call_id: string`

        The call ID of the program item.

      - `result: string`

        The result produced by the program item.

      - `status: "completed" or "incomplete"`

        The terminal status of the program output.

        - `"completed"`

        - `"incomplete"`

      - `type: "program_output"`

        The item type. Always `program_output`.

        - `"program_output"`

      - `agent: optional object { agent_name }  or null`

        The agent that produced this item.

        - `agent_name: string`

          The canonical name of the agent that produced this item.

- `instructions: optional string or null`

  A system (or developer) message inserted into the model's context.
  When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

- `model: optional string or null`

  Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/api/docs/models) to browse and compare available models.

- `parallel_tool_calls: optional boolean or null`

  Whether to allow the model to run tool calls in parallel.

- `personality: optional string or "friendly" or "pragmatic"`

  A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters.

  - `string`

  - `"friendly" or "pragmatic"`

    A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters.

    - `"friendly"`

    - `"pragmatic"`

- `previous_response_id: optional string or 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`.

- `reasoning: optional object { context, effort, generate_summary, 2 more }  or null`

  **gpt-5 and o-series models only** Configuration options for [reasoning models](/api/docs/guides/reasoning).

  - `context: optional "auto" or "current_turn" or "all_turns" or 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: optional "none" or "minimal" or "low" or 4 more or 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: optional "auto" or "concise" or "detailed" or 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: optional string or "standard" or "pro"`

    Controls the reasoning execution mode for the request.

    When returned on a response, this is the effective execution mode.

    - `string`

    - `"standard" or "pro"`

      Controls the reasoning execution mode for the request.

      When returned on a response, this is the effective execution mode.

      - `"standard"`

      - `"pro"`

  - `summary: optional "auto" or "concise" or "detailed" or 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"`

- `text: optional object { format, verbosity }  or null`

  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: optional 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 object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `BetaResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }`

      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: map[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: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `strict: optional boolean or 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 object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

  - `verbosity: optional "low" or "medium" or "high" or 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: optional BetaToolChoiceOptions or BetaToolChoiceAllowed or BetaToolChoiceTypes or 6 more or null`

  Controls which tool the model should use, if any.

  - `BetaToolChoiceOptions = "none" or "auto" or "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 object { mode, tools, type }`

    Constrains the tools available to the model to a pre-defined set.

    - `mode: "auto" or "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 of map[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 object { type }`

    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" or "web_search_preview" or "computer" or 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 object { name, type }`

    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 object { server_label, type, name }`

    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: optional string or null`

      The name of the tool to call on the server.

  - `BetaToolChoiceCustom object { name, type }`

    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 object { type }`

    - `type: "programmatic_tool_calling"`

      The tool to call. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `BetaToolChoiceApplyPatch object { type }`

    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 object { type }`

    Forces the model to call the shell tool when a tool call is required.

    - `type: "shell"`

      The tool to call. Always `shell`.

      - `"shell"`

- `tools: optional array of Function { name, parameters, strict, 6 more }  or FileSearch { type, vector_store_ids, filters, 2 more }  or Computer { type }  or 13 more or null`

  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.

  - `Function object { name, parameters, strict, 6 more }`

    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: map[unknown] or null`

      A JSON schema object describing the parameters of the function.

    - `strict: boolean or null`

      Whether strict parameter validation is enforced for this function tool.

    - `type: "function"`

      The type of the function tool. Always `function`.

      - `"function"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `async: optional boolean`

    - `defer_loading: optional boolean`

      Whether this function is deferred and loaded via tool search.

    - `description: optional string or null`

      A description of the function. Used by the model to determine whether or not to call the function.

    - `output_schema: optional map[unknown] or null`

      A JSON schema object describing the JSON value encoded in string outputs for this function.

  - `FileSearch object { type, vector_store_ids, filters, 2 more }`

    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 of string`

      The IDs of the vector stores to search.

    - `filters: optional ComparisonFilter { key, type, value }  or unknown or null`

      A filter to apply.

      - `ComparisonFilter object { key, type, value }`

        A filter used to compare a specified attribute key to a given value using a defined comparison operation.

        - `key: string`

          The key to compare against the value.

        - `type: "eq" or "ne" or "gt" or 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 or number or boolean or array of string or number`

          The value to compare against the attribute key; supports string, number, or boolean types.

          - `string`

          - `number`

          - `boolean`

          - `array of string or number`

            - `string`

            - `number`

      - `BetaCompoundFilter = unknown`

        Combine multiple filters using `and` or `or`.

    - `max_num_results: optional number`

      The maximum number of results to return. This number should be between 1 and 50 inclusive.

    - `ranking_options: optional object { hybrid_search, ranker, score_threshold }`

      Ranking options for search.

      - `hybrid_search: optional object { embedding_weight, text_weight }`

        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: optional "auto" or "default-2024-11-15"`

        The ranker to use for the file search.

        - `"auto"`

        - `"default-2024-11-15"`

      - `score_threshold: optional 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.

  - `Computer object { type }`

    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"`

  - `ComputerUsePreview object { display_height, display_width, environment, type }`

    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" or "mac" or "linux" or 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"`

  - `WebSearch object { type, external_web_access, filters, 2 more }`

    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" or "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: optional 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: optional object { allowed_domains }  or null`

      Filters for the search.

      - `allowed_domains: optional array of string or 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: optional "low" or "medium" or "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: optional object { city, country, region, 2 more }  or 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: optional string or null`

        Free text input for the city of the user, e.g. `San Francisco`.

      - `country: optional string or null`

        The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

      - `region: optional string or null`

        Free text input for the region of the user, e.g. `California`.

      - `timezone: optional string or null`

        The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

      - `type: optional "approximate"`

        The type of location approximation. Always `approximate`.

        - `"approximate"`

  - `Mcp object { server_label, type, allowed_callers, 9 more }`

    Give the model access to additional tools via remote Model Context Protocol
    (MCP) servers. [Learn more about MCP](/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: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `allowed_tools: optional array of string or McpToolFilter { read_only, tool_names }  or null`

      List of allowed tool names or a filter object.

      - `McpAllowedTools = array of string`

        A string array of allowed tool names

      - `McpToolFilter object { read_only, tool_names }`

        A filter object to specify which tools are allowed.

        - `read_only: optional 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: optional array of string`

          List of allowed tool names.

    - `authorization: optional 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: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 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: optional boolean`

      Whether this MCP tool is deferred and discovered via tool search.

    - `headers: optional map[string] or null`

      Optional HTTP headers to send to the MCP server. Use for authentication
      or other purposes.

    - `require_approval: optional McpToolApprovalFilter { always, never }  or "always" or "never" or null`

      Specify which of the MCP server's tools require approval.

      - `McpToolApprovalFilter object { always, never }`

        Specify which of the MCP server's tools require approval. Can be
        `always`, `never`, or a filter object associated with tools
        that require approval.

        - `always: optional object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

        - `never: optional object { read_only, tool_names }`

          A filter object to specify which tools are allowed.

          - `read_only: optional 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: optional array of string`

            List of allowed tool names.

      - `McpToolApprovalSetting = "always" or "never"`

        Specify a single approval policy for all tools. One of `always` or
        `never`. When set to `always`, all tools will require approval. When
        set to `never`, all tools will not require approval.

        - `"always"`

        - `"never"`

    - `server_description: optional string`

      Optional description of the MCP server, used to provide more context.

    - `server_url: optional string`

      The URL for the MCP server. One of `server_url`, `connector_id`, or
      `tunnel_id` must be provided.

    - `tunnel_id: optional 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 object { container, type, allowed_callers }`

    A tool that runs Python code to help generate a response to a prompt.

    - `container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }`

      The code interpreter container. Can be a container ID or an object that
      specifies uploaded file IDs to make available to your code, along with an
      optional `memory_limit` setting.

      - `string`

        The container ID.

      - `CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }`

        Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.

        - `type: "auto"`

          Always `auto`.

          - `"auto"`

        - `file_ids: optional array of string`

          An optional list of uploaded files to make available to your code.

        - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

          The memory limit for the code interpreter container.

          - `"1g"`

          - `"4g"`

          - `"16g"`

          - `"64g"`

        - `network_policy: optional BetaContainerNetworkPolicyDisabled or BetaContainerNetworkPolicyAllowlist`

          Network access policy for the container.

          - `BetaContainerNetworkPolicyDisabled object { type }`

          - `BetaContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }`

    - `type: "code_interpreter"`

      The type of the code interpreter tool. Always `code_interpreter`.

      - `"code_interpreter"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

  - `ProgrammaticToolCalling object { type }`

    - `type: "programmatic_tool_calling"`

      The type of the tool. Always `programmatic_tool_calling`.

      - `"programmatic_tool_calling"`

  - `ImageGeneration object { type, action, background, 9 more }`

    A tool that generates images using the GPT image models.

    - `type: "image_generation"`

      The type of the image generation tool. Always `image_generation`.

      - `"image_generation"`

    - `action: optional "generate" or "edit" or "auto"`

      Whether to generate a new image or edit an existing image. Default: `auto`.

      - `"generate"`

      - `"edit"`

      - `"auto"`

    - `background: optional "transparent" or "opaque" or "auto"`

      Set the background of the generated image. One of `transparent`, `opaque`,
      or `auto`. `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`.
      Default: `auto`.

      - `"transparent"`

      - `"opaque"`

      - `"auto"`

    - `input_fidelity: optional "high" or "low" or 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` and `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: optional object { file_id, image_url }`

      Optional mask for inpainting. Contains `image_url`
      (string, optional) and `file_id` (string, optional).

      - `file_id: optional string`

        File ID for the mask image.

      - `image_url: optional string`

        Base64-encoded mask image.

    - `model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

      The image generation model to use. One of `gpt-image-1`,
      `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`, or `chatgpt-image-latest`. Default:
      `gpt-image-1`.

      - `string`

      - `"gpt-image-1" or "gpt-image-1-mini" or "gpt-image-1.5" or 6 more`

        The image generation model to use. One of `gpt-image-1`,
        `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`, or `chatgpt-image-latest`. Default:
        `gpt-image-1`.

        - `"gpt-image-1"`

        - `"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"`

    - `moderation: optional "auto" or "low"`

      Moderation level for the generated image. Default: `auto`.

      - `"auto"`

      - `"low"`

    - `output_compression: optional number`

      Compression level for the output image. Default: 100.

    - `output_format: optional "png" or "webp" or "jpeg"`

      The output format of the generated image. One of `png`, `webp`, or
      `jpeg`. Default: `png`.

      - `"png"`

      - `"webp"`

      - `"jpeg"`

    - `partial_images: optional number`

      Number of partial images to generate in streaming mode, from 0 (default value) to 3.

    - `quality: optional "low" or "medium" or "high" or 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: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "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" or "1024x1536" or "1536x1024" or "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.

        - `"1024x1024"`

        - `"1024x1536"`

        - `"1536x1024"`

        - `"auto"`

  - `LocalShell object { type }`

    A tool that allows the model to execute shell commands in a local environment.

    - `type: "local_shell"`

      The type of the local shell tool. Always `local_shell`.

      - `"local_shell"`

  - `Shell object { type, allowed_callers, environment }`

    A tool that allows the model to execute shell commands.

    - `type: "shell"`

      The type of the shell tool. Always `shell`.

      - `"shell"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `environment: optional BetaContainerAuto or BetaLocalEnvironment or BetaContainerReference or null`

      - `BetaContainerAuto object { type, file_ids, memory_limit, 2 more }`

      - `BetaLocalEnvironment object { type, skills }`

      - `BetaContainerReference object { container_id, type }`

  - `Custom object { name, type, allowed_callers, 4 more }`

    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: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

    - `async: optional boolean`

      Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

    - `defer_loading: optional boolean`

      Whether this tool should be deferred and discovered via tool search.

    - `description: optional string`

      Optional description of the custom tool, used to provide more context.

    - `format: optional Text { type }  or Grammar { definition, syntax, type }`

      The input format for the custom tool. Default is unconstrained text.

      - `Text object { type }`

        Unconstrained free-form text.

        - `type: "text"`

          Unconstrained text format. Always `text`.

          - `"text"`

      - `Grammar object { definition, syntax, type }`

        A grammar defined by the user.

        - `definition: string`

          The grammar definition.

        - `syntax: "lark" or "regex"`

          The syntax of the grammar definition. One of `lark` or `regex`.

          - `"lark"`

          - `"regex"`

        - `type: "grammar"`

          Grammar format. Always `grammar`.

          - `"grammar"`

  - `Namespace object { description, name, tools, type }`

    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`).

    - `tools: array of Function { name, type, allowed_callers, 6 more }  or Custom { name, type, allowed_callers, 4 more }`

      The function/custom tools available inside this namespace.

      - `Function object { name, type, allowed_callers, 6 more }`

        - `name: string`

        - `type: "function"`

          - `"function"`

        - `allowed_callers: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this function should be deferred and discovered via tool search.

        - `description: optional string or null`

        - `output_schema: optional map[unknown] or null`

          A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs.

        - `parameters: optional unknown or null`

        - `strict: optional boolean or 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.

      - `Custom object { name, type, allowed_callers, 4 more }`

        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: optional array of "direct" or "programmatic" or null`

          The tool invocation context(s).

          - `"direct"`

          - `"programmatic"`

        - `async: optional boolean`

          Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

        - `defer_loading: optional boolean`

          Whether this tool should be deferred and discovered via tool search.

        - `description: optional string`

          Optional description of the custom tool, used to provide more context.

        - `format: optional Text { type }  or Grammar { definition, syntax, type }`

          The input format for the custom tool. Default is unconstrained text.

          - `Text object { type }`

            Unconstrained free-form text.

            - `type: "text"`

              Unconstrained text format. Always `text`.

              - `"text"`

          - `Grammar object { definition, syntax, type }`

            A grammar defined by the user.

            - `definition: string`

              The grammar definition.

            - `syntax: "lark" or "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"`

  - `ToolSearch object { type, description, execution, parameters }`

    Hosted or BYOT tool search configuration for deferred tools.

    - `type: "tool_search"`

      The type of the tool. Always `tool_search`.

      - `"tool_search"`

    - `description: optional string or null`

      Description shown to the model for a client-executed tool search tool.

    - `execution: optional "server" or "client"`

      Whether tool search is executed by the server or by the client.

      - `"server"`

      - `"client"`

    - `parameters: optional unknown or null`

      Parameter schema for a client-executed tool search tool.

  - `WebSearchPreview object { type, search_content_types, search_context_size, user_location }`

    This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](/api/docs/guides/tools-web-search).

    - `type: "web_search_preview" or "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: optional array of "text" or "image"`

      - `"text"`

      - `"image"`

    - `search_context_size: optional "low" or "medium" or "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: optional object { type, city, country, 2 more }  or 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: optional string or null`

        Free text input for the city of the user, e.g. `San Francisco`.

      - `country: optional string or null`

        The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.

      - `region: optional string or null`

        Free text input for the region of the user, e.g. `California`.

      - `timezone: optional string or null`

        The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.

  - `ApplyPatch object { type, allowed_callers }`

    Allows the assistant to create, delete, or update files using unified diffs.

    - `type: "apply_patch"`

      The type of the tool. Always `apply_patch`.

      - `"apply_patch"`

    - `allowed_callers: optional array of "direct" or "programmatic" or null`

      The tool invocation context(s).

      - `"direct"`

      - `"programmatic"`

- `truncation: optional "auto" or "disabled"`

  The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.

  - `"auto"`

  - `"disabled"`

### Returns

- `input_tokens: number`

- `object: "response.input_tokens"`

  - `"response.input_tokens"`

### Example

```http
curl https://api.openai.com/v1/responses/input_tokens \
    -X POST \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "input_tokens": 123,
  "object": "response.input_tokens"
}
```

### Example

```http
curl -X POST https://api.openai.com/v1/responses/input_tokens \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
      "model": "gpt-6-astra",
      "input": "Tell me a joke."
    }'
```

#### Response

```json
{
  "object": "response.input_tokens",
  "input_tokens": 11
}
```

## Domain Types

### Input Token Count Response

- `InputTokenCountResponse object { input_tokens, object }`

  - `input_tokens: number`

  - `object: "response.input_tokens"`

    - `"response.input_tokens"`

# Threads

## Create thread

**post** `/threads`

Create a thread.

### Body Parameters

- `messages: optional array of object { content, role, attachments, metadata }`

  A list of [messages](/api/docs/assistants/migration) to start the thread with.

  - `content: string or array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

    The text contents of the message.

    - `TextContent = string`

      The text contents of the message.

    - `ArrayOfContentParts = array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

      An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/api/docs/models).

      - `ImageFileContentBlock object { image_file, type }`

        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: optional "auto" or "low" or "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 object { image_url, type }`

        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.

          - `detail: optional "auto" or "low" or "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"`

      - `TextContentBlockParam object { text, type }`

        The text content that is part of a message.

        - `text: string`

          Text content to be sent to the model

        - `type: "text"`

          Always `text`.

          - `"text"`

  - `role: "user" or "assistant"`

    The role of the entity that is creating the message. Allowed values include:

    - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
    - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.

    - `"user"`

    - `"assistant"`

  - `attachments: optional array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they should be added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `metadata: optional Metadata or 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.

- `metadata: optional Metadata or 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.

- `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

    - `file_ids: optional array of 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.

  - `file_search: optional object { vector_store_ids, vector_stores }`

    - `vector_store_ids: optional array of 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.

    - `vector_stores: optional array of object { chunking_strategy, file_ids, metadata }`

      A helper to create a [vector store](/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.

      - `chunking_strategy: optional Auto { type }  or Static { static, type }`

        The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.

        - `Auto object { type }`

          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 object { static, type }`

          - `static: object { chunk_overlap_tokens, max_chunk_size_tokens }`

            - `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`.

          - `type: "static"`

            Always `static`.

            - `"static"`

      - `file_ids: optional array of 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.

      - `metadata: optional Metadata or 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.

### Returns

- `Thread object { id, created_at, metadata, 2 more }`

  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.

  - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

### Example

```http
curl https://api.openai.com/v1/threads \
    -X POST \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "thread",
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  }
}
```

### Empty

```http
curl https://api.openai.com/v1/threads \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d ''
```

#### Response

```json
{
  "id": "thread_abc123",
  "object": "thread",
  "created_at": 1699012949,
  "metadata": {},
  "tool_resources": {}
}
```

### Messages

```http
curl https://api.openai.com/v1/threads \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v2" \
-d '{
    "messages": [{
      "role": "user",
      "content": "Hello, what is AI?"
    }, {
      "role": "user",
      "content": "How does AI work? Explain it in simple terms."
    }]
  }'
```

#### Response

```json
{
  "id": "thread_abc123",
  "object": "thread",
  "created_at": 1699014083,
  "metadata": {},
  "tool_resources": {}
}
```

## Create thread and run

**post** `/threads/runs`

Create a thread and run it in one request.

### Body Parameters

- `assistant_id: string`

  The ID of the [assistant](/api/docs/assistants/migration) to use to execute this run.

- `instructions: optional string or null`

  Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.

- `max_completion_tokens: optional number or null`

  The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.

- `max_prompt_tokens: optional number or null`

  The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.

- `metadata: optional Metadata or 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: optional string or "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 35 more or null`

  The ID of the [Model](/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

  - `string`

  - `"gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 35 more`

    The ID of the [Model](/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

    - `"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"`

    - `"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"`

- `parallel_tool_calls: optional boolean`

  Whether to enable [parallel function calling](/api/docs/guides/function-calling#parallel-function-calling) during tool use.

- `response_format: optional AssistantResponseFormatOption or 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` is the default value

    - `"auto"`

  - `ResponseFormatText object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `ResponseFormatJSONObject object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

  - `ResponseFormatJSONSchema object { json_schema, type }`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `json_schema: object { name, description, schema, strict }`

      Structured Outputs configuration options, including a JSON Schema.

      - `name: string`

        The name of the response format. Must be a-z, A-Z, 0-9, or contain
        underscores and dashes, with a maximum length of 64.

      - `description: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `schema: optional map[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: optional boolean or 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"`

- `stream: optional boolean or null`

  If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.

- `temperature: optional number or 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.

- `thread: optional object { messages, metadata, tool_resources }`

  Options to create a new thread. If no thread is provided when running a
  request, an empty thread will be created.

  - `messages: optional array of object { content, role, attachments, metadata }`

    A list of [messages](/api/docs/assistants/migration) to start the thread with.

    - `content: string or array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

      The text contents of the message.

      - `TextContent = string`

        The text contents of the message.

      - `ArrayOfContentParts = array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

        An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/api/docs/models).

        - `ImageFileContentBlock object { image_file, type }`

          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: optional "auto" or "low" or "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 object { image_url, type }`

          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.

            - `detail: optional "auto" or "low" or "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"`

        - `TextContentBlockParam object { text, type }`

          The text content that is part of a message.

          - `text: string`

            Text content to be sent to the model

          - `type: "text"`

            Always `text`.

            - `"text"`

    - `role: "user" or "assistant"`

      The role of the entity that is creating the message. Allowed values include:

      - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
      - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.

      - `"user"`

      - `"assistant"`

    - `attachments: optional array of object { file_id, tools }  or null`

      A list of files attached to the message, and the tools they should be added to.

      - `file_id: optional string`

        The ID of the file to attach to the message.

      - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

        The tools to add this file to.

        - `CodeInterpreterTool object { type }`

          - `type: "code_interpreter"`

            The type of tool being defined: `code_interpreter`

            - `"code_interpreter"`

        - `FileSearchTool object { type }`

          - `type: "file_search"`

            The type of tool being defined: `file_search`

            - `"file_search"`

    - `metadata: optional Metadata or 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.

  - `metadata: optional Metadata or 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.

  - `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids, vector_stores }`

      - `vector_store_ids: optional array of 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.

      - `vector_stores: optional array of object { chunking_strategy, file_ids, metadata }`

        A helper to create a [vector store](/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread.

        - `chunking_strategy: optional Auto { type }  or Static { static, type }`

          The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.

          - `Auto object { type }`

            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 object { static, type }`

            - `static: object { chunk_overlap_tokens, max_chunk_size_tokens }`

              - `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`.

            - `type: "static"`

              Always `static`.

              - `"static"`

        - `file_ids: optional array of 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.

        - `metadata: optional Metadata or 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.

- `tool_choice: optional AssistantToolChoiceOption or 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" or "auto" or "required"`

    `none` means the model will not call any tools 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 before responding to the user.

    - `"none"`

    - `"auto"`

    - `"required"`

  - `AssistantToolChoice object { type, function }`

    Specifies a tool the model should use. Use to force the model to call a specific tool.

    - `type: "function" or "code_interpreter" or "file_search"`

      The type of the tool. If type is `function`, the function name must be set

      - `"function"`

      - `"code_interpreter"`

      - `"file_search"`

    - `function: optional AssistantToolChoiceFunction`

      - `name: string`

        The name of the function to call.

- `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

    - `file_ids: optional array of 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.

  - `file_search: optional object { vector_store_ids }`

    - `vector_store_ids: optional array of 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.

- `tools: optional array of CodeInterpreterTool or FileSearchTool or FunctionTool or null`

  Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.

  - `CodeInterpreterTool object { type }`

  - `FileSearchTool object { type, file_search }`

    - `type: "file_search"`

      The type of tool being defined: `file_search`

      - `"file_search"`

    - `file_search: optional object { max_num_results, ranking_options }`

      Overrides for the file search tool.

      - `max_num_results: optional 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.

      - `ranking_options: optional object { score_threshold, ranker }`

        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.

        - `ranker: optional "auto" or "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 object { function, type }`

    - `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: optional string`

        A description of what the function does, used by the model to choose when and how to call the function.

      - `parameters: optional 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: optional boolean or 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: optional number or 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.

- `truncation_strategy: optional object { type, last_messages }  or 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" or "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: optional number or null`

    The number of most recent messages from the thread when constructing the context for the run.

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/runs \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "assistant_id": "assistant_id",
          "model": "gpt-4.1",
          "temperature": 1,
          "top_p": 1
        }'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
      "assistant_id": "asst_abc123",
      "thread": {
        "messages": [
          {"role": "user", "content": "Explain deep learning to a 5 year old."}
        ]
      }
    }'
```

#### Response

```json
{
  "id": "run_abc123",
  "object": "thread.run",
  "created_at": 1699076792,
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "status": "queued",
  "started_at": null,
  "expires_at": 1699077392,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": null,
  "required_action": null,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You are a helpful assistant.",
  "tools": [],
  "tool_resources": {},
  "metadata": {},
  "temperature": 1.0,
  "top_p": 1.0,
  "max_completion_tokens": null,
  "max_prompt_tokens": null,
  "truncation_strategy": {
    "type": "auto",
    "last_messages": null
  },
  "incomplete_details": null,
  "usage": null,
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true
}
```

### Streaming

```http
curl https://api.openai.com/v1/threads/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "assistant_id": "asst_123",
    "thread": {
      "messages": [
        {"role": "user", "content": "Hello"}
      ]
    },
    "stream": true
  }'
```

#### Response

```json
event: thread.created
data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{},"tool_resources":{}}

event: thread.run.created
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.queued
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.in_progress
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.step.created
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.in_progress
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.message.created
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{},"attachments":[]}

event: thread.message.in_progress
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[], "metadata":{},"attachments":[]}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}}

: Intermediate Assistant events omitted.

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}}

event: thread.message.completed
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}], "metadata":{},"attachments":[]}

event: thread.run.step.completed
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"expired_at":null,"metadata":{}}

event: thread.run.completed
data: {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: done
data: [DONE]

```

### Streaming with Functions

```http
curl https://api.openai.com/v1/threads/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "assistant_id": "asst_abc123",
    "thread": {
      "messages": [
        {"role": "user", "content": "What is the weather like in San Francisco?"}
      ]
    },
    "tools": [
      {
        "type": "function",
        "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"]
          }
        }
      }
    ],
    "stream": true
  }'
```

#### Response

```json
event: thread.created
data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{},"tool_resources":{}}

event: thread.run.created
data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.queued
data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.in_progress
data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.step.created
data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.in_progress
data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.delta
data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"","output":null}}]}}}

event: thread.run.step.delta
data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"{\""}}]}}}

event: thread.run.step.delta
data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"location"}}]}}}

: Intermediate Assistant events omitted.

event: thread.run.step.delta
data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"ahrenheit"}}]}}}

event: thread.run.step.delta
data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}}

event: thread.run.requires_action
data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: done
data: [DONE]

```

## Delete thread

**delete** `/threads/{thread_id}`

Delete a thread.

### Path Parameters

- `thread_id: string`

### Returns

- `ThreadDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "thread.deleted"`

    - `"thread.deleted"`

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID \
    -X DELETE \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "thread.deleted"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -X DELETE
```

#### Response

```json
{
  "id": "thread_abc123",
  "object": "thread.deleted",
  "deleted": true
}
```

## Retrieve thread

**get** `/threads/{thread_id}`

Retrieves a thread.

### Path Parameters

- `thread_id: string`

### Returns

- `Thread object { id, created_at, metadata, 2 more }`

  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.

  - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "thread",
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  }
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "id": "thread_abc123",
  "object": "thread",
  "created_at": 1699014083,
  "metadata": {},
  "tool_resources": {
    "code_interpreter": {
      "file_ids": []
    }
  }
}
```

## Modify thread

**post** `/threads/{thread_id}`

Modifies a thread.

### Path Parameters

- `thread_id: string`

### Body Parameters

- `metadata: optional Metadata or 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.

- `tool_resources: optional object { code_interpreter, file_search }  or 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: optional object { file_ids }`

    - `file_ids: optional array of 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.

  - `file_search: optional object { vector_store_ids }`

    - `vector_store_ids: optional array of 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.

### Returns

- `Thread object { id, created_at, metadata, 2 more }`

  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.

  - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "object": "thread",
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "string"
      ]
    },
    "file_search": {
      "vector_store_ids": [
        "string"
      ]
    }
  }
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
      "metadata": {
        "modified": "true",
        "user": "abc123"
      }
    }'
```

#### Response

```json
{
  "id": "thread_abc123",
  "object": "thread",
  "created_at": 1699014083,
  "metadata": {
    "modified": "true",
    "user": "abc123"
  },
  "tool_resources": {}
}
```

## Domain Types

### Assistant Response Format Option

- `AssistantResponseFormatOption = "auto" or ResponseFormatText or ResponseFormatJSONObject or ResponseFormatJSONSchema`

  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` is the default value

    - `"auto"`

  - `ResponseFormatText object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `ResponseFormatJSONObject object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

  - `ResponseFormatJSONSchema object { json_schema, type }`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `json_schema: object { name, description, schema, strict }`

      Structured Outputs configuration options, including a JSON Schema.

      - `name: string`

        The name of the response format. Must be a-z, A-Z, 0-9, or contain
        underscores and dashes, with a maximum length of 64.

      - `description: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `schema: optional map[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: optional boolean or 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"`

### Assistant Tool Choice

- `AssistantToolChoice object { type, function }`

  Specifies a tool the model should use. Use to force the model to call a specific tool.

  - `type: "function" or "code_interpreter" or "file_search"`

    The type of the tool. If type is `function`, the function name must be set

    - `"function"`

    - `"code_interpreter"`

    - `"file_search"`

  - `function: optional AssistantToolChoiceFunction`

    - `name: string`

      The name of the function to call.

### Assistant Tool Choice Function

- `AssistantToolChoiceFunction object { name }`

  - `name: string`

    The name of the function to call.

### Assistant Tool Choice Option

- `AssistantToolChoiceOption = "none" or "auto" or "required" or AssistantToolChoice`

  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" or "auto" or "required"`

    `none` means the model will not call any tools 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 before responding to the user.

    - `"none"`

    - `"auto"`

    - `"required"`

  - `AssistantToolChoice object { type, function }`

    Specifies a tool the model should use. Use to force the model to call a specific tool.

    - `type: "function" or "code_interpreter" or "file_search"`

      The type of the tool. If type is `function`, the function name must be set

      - `"function"`

      - `"code_interpreter"`

      - `"file_search"`

    - `function: optional AssistantToolChoiceFunction`

      - `name: string`

        The name of the function to call.

### Thread

- `Thread object { id, created_at, metadata, 2 more }`

  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.

  - `metadata: Metadata or 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: object { code_interpreter, file_search }  or 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: optional object { file_ids }`

      - `file_ids: optional array of 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.

    - `file_search: optional object { vector_store_ids }`

      - `vector_store_ids: optional array of 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.

### Thread Deleted

- `ThreadDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "thread.deleted"`

    - `"thread.deleted"`

# Messages

## Create message

**post** `/threads/{thread_id}/messages`

Create a message.

### Path Parameters

- `thread_id: string`

### Body Parameters

- `content: string or array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

  The text contents of the message.

  - `TextContent = string`

    The text contents of the message.

  - `ArrayOfContentParts = array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

    An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/api/docs/models).

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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"`

    - `TextContentBlockParam object { text, type }`

      The text content that is part of a message.

      - `text: string`

        Text content to be sent to the model

      - `type: "text"`

        Always `text`.

        - `"text"`

- `role: "user" or "assistant"`

  The role of the entity that is creating the message. Allowed values include:

  - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
  - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.

  - `"user"`

  - `"assistant"`

- `attachments: optional array of object { file_id, tools }  or null`

  A list of files attached to the message, and the tools they should be added to.

  - `file_id: optional string`

    The ID of the file to attach to the message.

  - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

    The tools to add this file to.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

- `metadata: optional Metadata or 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.

### Returns

- `Message object { id, assistant_id, attachments, 11 more }`

  Represents a message within a [thread](/api/docs/assistants/migration).

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `assistant_id: string or null`

    If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

  - `attachments: array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they were added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the message was completed.

  - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

    The content of the message in array of text and/or images.

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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 object { text, type }`

      The text content that is part of a message.

      - `text: Text`

        - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

          - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `end_index: number`

            - `file_citation: object { file_id }`

              - `file_id: string`

                The ID of the specific File the citation is from.

            - `start_index: number`

            - `text: string`

              The text in the message content that needs to be replaced.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

          - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `end_index: number`

            - `file_path: object { file_id }`

              - `file_id: string`

                The ID of the file that was generated.

            - `start_index: number`

            - `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 object { refusal, type }`

      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.

  - `incomplete_at: number or null`

    The Unix timestamp (in seconds) for when the message was marked as incomplete.

  - `incomplete_details: object { reason }  or null`

    On an incomplete message, details about why the message is incomplete.

    - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

      The reason the message is incomplete.

      - `"content_filter"`

      - `"max_tokens"`

      - `"run_cancelled"`

      - `"run_expired"`

      - `"run_failed"`

  - `metadata: Metadata or 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" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

  - `run_id: string or 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" or "incomplete" or "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.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/messages \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "content": "string",
          "role": "user"
        }'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "attachments": [
    {
      "file_id": "file_id",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ]
    }
  ],
  "completed_at": 0,
  "content": [
    {
      "image_file": {
        "file_id": "file_id",
        "detail": "auto"
      },
      "type": "image_file"
    }
  ],
  "created_at": 0,
  "incomplete_at": 0,
  "incomplete_details": {
    "reason": "content_filter"
  },
  "metadata": {
    "foo": "string"
  },
  "object": "thread.message",
  "role": "user",
  "run_id": "run_id",
  "status": "in_progress",
  "thread_id": "thread_id"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
      "role": "user",
      "content": "How does AI work? Explain it in simple terms."
    }'
```

#### Response

```json
{
  "id": "msg_abc123",
  "object": "thread.message",
  "created_at": 1713226573,
  "assistant_id": null,
  "thread_id": "thread_abc123",
  "run_id": null,
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": {
        "value": "How does AI work? Explain it in simple terms.",
        "annotations": []
      }
    }
  ],
  "attachments": [],
  "metadata": {},
  "status": "completed",
  "completed_at": 1713226573,
  "incomplete_at": null,
  "incomplete_details": null
}
```

## Delete message

**delete** `/threads/{thread_id}/messages/{message_id}`

Deletes a message.

### Path Parameters

- `thread_id: string`

- `message_id: string`

### Returns

- `MessageDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "thread.message.deleted"`

    - `"thread.message.deleted"`

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/messages/$MESSAGE_ID \
    -X DELETE \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "thread.message.deleted"
}
```

### Example

```http
curl -X DELETE https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "id": "msg_abc123",
  "object": "thread.message.deleted",
  "deleted": true
}
```

## List messages

**get** `/threads/{thread_id}/messages`

Returns a list of messages for a given thread.

### Path Parameters

- `thread_id: string`

### Query Parameters

- `after: optional 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: optional 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: optional number`

  A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

- `order: optional "asc" or "desc"`

  Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

  - `"asc"`

  - `"desc"`

- `run_id: optional string`

  Filter messages by the run ID that generated them.

### Returns

- `data: array of Message`

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `assistant_id: string or null`

    If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

  - `attachments: array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they were added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the message was completed.

  - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

    The content of the message in array of text and/or images.

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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 object { text, type }`

      The text content that is part of a message.

      - `text: Text`

        - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

          - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `end_index: number`

            - `file_citation: object { file_id }`

              - `file_id: string`

                The ID of the specific File the citation is from.

            - `start_index: number`

            - `text: string`

              The text in the message content that needs to be replaced.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

          - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `end_index: number`

            - `file_path: object { file_id }`

              - `file_id: string`

                The ID of the file that was generated.

            - `start_index: number`

            - `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 object { refusal, type }`

      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.

  - `incomplete_at: number or null`

    The Unix timestamp (in seconds) for when the message was marked as incomplete.

  - `incomplete_details: object { reason }  or null`

    On an incomplete message, details about why the message is incomplete.

    - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

      The reason the message is incomplete.

      - `"content_filter"`

      - `"max_tokens"`

      - `"run_cancelled"`

      - `"run_expired"`

      - `"run_failed"`

  - `metadata: Metadata or 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" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

  - `run_id: string or 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" or "incomplete" or "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.

- `first_id: string`

- `has_more: boolean`

- `last_id: string`

- `object: string`

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/messages \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "assistant_id": "assistant_id",
      "attachments": [
        {
          "file_id": "file_id",
          "tools": [
            {
              "type": "code_interpreter"
            }
          ]
        }
      ],
      "completed_at": 0,
      "content": [
        {
          "image_file": {
            "file_id": "file_id",
            "detail": "auto"
          },
          "type": "image_file"
        }
      ],
      "created_at": 0,
      "incomplete_at": 0,
      "incomplete_details": {
        "reason": "content_filter"
      },
      "metadata": {
        "foo": "string"
      },
      "object": "thread.message",
      "role": "user",
      "run_id": "run_id",
      "status": "in_progress",
      "thread_id": "thread_id"
    }
  ],
  "first_id": "msg_abc123",
  "has_more": false,
  "last_id": "msg_abc123",
  "object": "list"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "msg_abc123",
      "object": "thread.message",
      "created_at": 1699016383,
      "assistant_id": null,
      "thread_id": "thread_abc123",
      "run_id": null,
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": {
            "value": "How does AI work? Explain it in simple terms.",
            "annotations": []
          }
        }
      ],
      "attachments": [],
      "metadata": {},
      "status": "completed",
      "completed_at": 1699016383,
      "incomplete_at": null,
      "incomplete_details": null
    },
    {
      "id": "msg_abc456",
      "object": "thread.message",
      "created_at": 1699016383,
      "assistant_id": null,
      "thread_id": "thread_abc123",
      "run_id": null,
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": {
            "value": "Hello, what is AI?",
            "annotations": []
          }
        }
      ],
      "attachments": [],
      "metadata": {},
      "status": "completed",
      "completed_at": 1699016383,
      "incomplete_at": null,
      "incomplete_details": null
    }
  ],
  "first_id": "msg_abc123",
  "last_id": "msg_abc456",
  "has_more": false
}
```

## Retrieve message

**get** `/threads/{thread_id}/messages/{message_id}`

Retrieve a message.

### Path Parameters

- `thread_id: string`

- `message_id: string`

### Returns

- `Message object { id, assistant_id, attachments, 11 more }`

  Represents a message within a [thread](/api/docs/assistants/migration).

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `assistant_id: string or null`

    If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

  - `attachments: array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they were added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the message was completed.

  - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

    The content of the message in array of text and/or images.

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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 object { text, type }`

      The text content that is part of a message.

      - `text: Text`

        - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

          - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `end_index: number`

            - `file_citation: object { file_id }`

              - `file_id: string`

                The ID of the specific File the citation is from.

            - `start_index: number`

            - `text: string`

              The text in the message content that needs to be replaced.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

          - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `end_index: number`

            - `file_path: object { file_id }`

              - `file_id: string`

                The ID of the file that was generated.

            - `start_index: number`

            - `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 object { refusal, type }`

      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.

  - `incomplete_at: number or null`

    The Unix timestamp (in seconds) for when the message was marked as incomplete.

  - `incomplete_details: object { reason }  or null`

    On an incomplete message, details about why the message is incomplete.

    - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

      The reason the message is incomplete.

      - `"content_filter"`

      - `"max_tokens"`

      - `"run_cancelled"`

      - `"run_expired"`

      - `"run_failed"`

  - `metadata: Metadata or 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" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

  - `run_id: string or 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" or "incomplete" or "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.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/messages/$MESSAGE_ID \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "attachments": [
    {
      "file_id": "file_id",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ]
    }
  ],
  "completed_at": 0,
  "content": [
    {
      "image_file": {
        "file_id": "file_id",
        "detail": "auto"
      },
      "type": "image_file"
    }
  ],
  "created_at": 0,
  "incomplete_at": 0,
  "incomplete_details": {
    "reason": "content_filter"
  },
  "metadata": {
    "foo": "string"
  },
  "object": "thread.message",
  "role": "user",
  "run_id": "run_id",
  "status": "in_progress",
  "thread_id": "thread_id"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "id": "msg_abc123",
  "object": "thread.message",
  "created_at": 1699017614,
  "assistant_id": null,
  "thread_id": "thread_abc123",
  "run_id": null,
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": {
        "value": "How does AI work? Explain it in simple terms.",
        "annotations": []
      }
    }
  ],
  "attachments": [],
  "metadata": {},
  "status": "completed",
  "completed_at": 1699017614,
  "incomplete_at": null,
  "incomplete_details": null
}
```

## Modify message

**post** `/threads/{thread_id}/messages/{message_id}`

Modifies a message.

### Path Parameters

- `thread_id: string`

- `message_id: string`

### Body Parameters

- `metadata: optional Metadata or 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.

### Returns

- `Message object { id, assistant_id, attachments, 11 more }`

  Represents a message within a [thread](/api/docs/assistants/migration).

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `assistant_id: string or null`

    If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

  - `attachments: array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they were added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the message was completed.

  - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

    The content of the message in array of text and/or images.

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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 object { text, type }`

      The text content that is part of a message.

      - `text: Text`

        - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

          - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `end_index: number`

            - `file_citation: object { file_id }`

              - `file_id: string`

                The ID of the specific File the citation is from.

            - `start_index: number`

            - `text: string`

              The text in the message content that needs to be replaced.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

          - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `end_index: number`

            - `file_path: object { file_id }`

              - `file_id: string`

                The ID of the file that was generated.

            - `start_index: number`

            - `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 object { refusal, type }`

      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.

  - `incomplete_at: number or null`

    The Unix timestamp (in seconds) for when the message was marked as incomplete.

  - `incomplete_details: object { reason }  or null`

    On an incomplete message, details about why the message is incomplete.

    - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

      The reason the message is incomplete.

      - `"content_filter"`

      - `"max_tokens"`

      - `"run_cancelled"`

      - `"run_expired"`

      - `"run_failed"`

  - `metadata: Metadata or 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" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

  - `run_id: string or 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" or "incomplete" or "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.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/messages/$MESSAGE_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "attachments": [
    {
      "file_id": "file_id",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ]
    }
  ],
  "completed_at": 0,
  "content": [
    {
      "image_file": {
        "file_id": "file_id",
        "detail": "auto"
      },
      "type": "image_file"
    }
  ],
  "created_at": 0,
  "incomplete_at": 0,
  "incomplete_details": {
    "reason": "content_filter"
  },
  "metadata": {
    "foo": "string"
  },
  "object": "thread.message",
  "role": "user",
  "run_id": "run_id",
  "status": "in_progress",
  "thread_id": "thread_id"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/messages/msg_abc123 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
      "metadata": {
        "modified": "true",
        "user": "abc123"
      }
    }'
```

#### Response

```json
{
  "id": "msg_abc123",
  "object": "thread.message",
  "created_at": 1699017614,
  "assistant_id": null,
  "thread_id": "thread_abc123",
  "run_id": null,
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": {
        "value": "How does AI work? Explain it in simple terms.",
        "annotations": []
      }
    }
  ],
  "metadata": {
    "modified": "true",
    "user": "abc123"
  },
  "status": "completed",
  "completed_at": 1699017614,
  "incomplete_at": null,
  "incomplete_details": null,
  "attachments": []
}
```

## Domain Types

### File Citation Annotation

- `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

  A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

  - `end_index: number`

  - `file_citation: object { file_id }`

    - `file_id: string`

      The ID of the specific File the citation is from.

  - `start_index: number`

  - `text: string`

    The text in the message content that needs to be replaced.

  - `type: "file_citation"`

    Always `file_citation`.

    - `"file_citation"`

### File Citation Delta Annotation

- `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

  A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

  - `index: number`

    The index of the annotation in the text content part.

  - `type: "file_citation"`

    Always `file_citation`.

    - `"file_citation"`

  - `end_index: optional number`

  - `file_citation: optional object { file_id, quote }`

    - `file_id: optional string`

      The ID of the specific File the citation is from.

    - `quote: optional string`

      The specific quote in the file.

  - `start_index: optional number`

  - `text: optional string`

    The text in the message content that needs to be replaced.

### File Path Annotation

- `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

  A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

  - `end_index: number`

  - `file_path: object { file_id }`

    - `file_id: string`

      The ID of the file that was generated.

  - `start_index: number`

  - `text: string`

    The text in the message content that needs to be replaced.

  - `type: "file_path"`

    Always `file_path`.

    - `"file_path"`

### File Path Delta Annotation

- `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

  A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

  - `index: number`

    The index of the annotation in the text content part.

  - `type: "file_path"`

    Always `file_path`.

    - `"file_path"`

  - `end_index: optional number`

  - `file_path: optional object { file_id }`

    - `file_id: optional string`

      The ID of the file that was generated.

  - `start_index: optional number`

  - `text: optional string`

    The text in the message content that needs to be replaced.

### Image File

- `ImageFile object { file_id, detail }`

  - `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: optional "auto" or "low" or "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"`

### Image File Content Block

- `ImageFileContentBlock object { image_file, type }`

  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: optional "auto" or "low" or "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"`

### Image File Delta

- `ImageFileDelta object { detail, file_id }`

  - `detail: optional "auto" or "low" or "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: optional 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.

### Image File Delta Block

- `ImageFileDeltaBlock object { index, type, image_file }`

  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: optional ImageFileDelta`

    - `detail: optional "auto" or "low" or "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: optional 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.

### Image URL

- `ImageURL object { url, detail }`

  - `url: string`

    The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

  - `detail: optional "auto" or "low" or "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"`

### Image URL Content Block

- `ImageURLContentBlock object { image_url, type }`

  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.

    - `detail: optional "auto" or "low" or "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"`

### Image URL Delta

- `ImageURLDelta object { detail, url }`

  - `detail: optional "auto" or "low" or "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: optional string`

    The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

### Image URL Delta Block

- `ImageURLDeltaBlock object { index, type, image_url }`

  References an image URL in the content of a message.

  - `index: number`

    The index of the content part in the message.

  - `type: "image_url"`

    Always `image_url`.

    - `"image_url"`

  - `image_url: optional ImageURLDelta`

    - `detail: optional "auto" or "low" or "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: optional string`

      The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

### Message

- `Message object { id, assistant_id, attachments, 11 more }`

  Represents a message within a [thread](/api/docs/assistants/migration).

  - `id: string`

    The identifier, which can be referenced in API endpoints.

  - `assistant_id: string or null`

    If applicable, the ID of the [assistant](/api/docs/assistants/migration) that authored this message.

  - `attachments: array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they were added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the message was completed.

  - `content: array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlock or RefusalContentBlock`

    The content of the message in array of text and/or images.

    - `ImageFileContentBlock object { image_file, type }`

      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: optional "auto" or "low" or "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 object { image_url, type }`

      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.

        - `detail: optional "auto" or "low" or "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 object { text, type }`

      The text content that is part of a message.

      - `text: Text`

        - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

          - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `end_index: number`

            - `file_citation: object { file_id }`

              - `file_id: string`

                The ID of the specific File the citation is from.

            - `start_index: number`

            - `text: string`

              The text in the message content that needs to be replaced.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

          - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `end_index: number`

            - `file_path: object { file_id }`

              - `file_id: string`

                The ID of the file that was generated.

            - `start_index: number`

            - `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 object { refusal, type }`

      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.

  - `incomplete_at: number or null`

    The Unix timestamp (in seconds) for when the message was marked as incomplete.

  - `incomplete_details: object { reason }  or null`

    On an incomplete message, details about why the message is incomplete.

    - `reason: "content_filter" or "max_tokens" or "run_cancelled" or 2 more`

      The reason the message is incomplete.

      - `"content_filter"`

      - `"max_tokens"`

      - `"run_cancelled"`

      - `"run_expired"`

      - `"run_failed"`

  - `metadata: Metadata or 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" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

  - `run_id: string or 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" or "incomplete" or "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.

### Message Deleted

- `MessageDeleted object { id, deleted, object }`

  - `id: string`

  - `deleted: boolean`

  - `object: "thread.message.deleted"`

    - `"thread.message.deleted"`

### Message Delta

- `MessageDelta object { content, role }`

  The delta containing the fields that have changed on the Message.

  - `content: optional array of ImageFileDeltaBlock or TextDeltaBlock or RefusalDeltaBlock or ImageURLDeltaBlock`

    The content of the message in array of text and/or images.

    - `ImageFileDeltaBlock object { index, type, image_file }`

      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: optional ImageFileDelta`

        - `detail: optional "auto" or "low" or "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: optional 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 object { index, type, text }`

      The text content that is part of a message.

      - `index: number`

        The index of the content part in the message.

      - `type: "text"`

        Always `text`.

        - `"text"`

      - `text: optional TextDelta`

        - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

          - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

            A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

            - `index: number`

              The index of the annotation in the text content part.

            - `type: "file_citation"`

              Always `file_citation`.

              - `"file_citation"`

            - `end_index: optional number`

            - `file_citation: optional object { file_id, quote }`

              - `file_id: optional string`

                The ID of the specific File the citation is from.

              - `quote: optional string`

                The specific quote in the file.

            - `start_index: optional number`

            - `text: optional string`

              The text in the message content that needs to be replaced.

          - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

            A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

            - `index: number`

              The index of the annotation in the text content part.

            - `type: "file_path"`

              Always `file_path`.

              - `"file_path"`

            - `end_index: optional number`

            - `file_path: optional object { file_id }`

              - `file_id: optional string`

                The ID of the file that was generated.

            - `start_index: optional number`

            - `text: optional string`

              The text in the message content that needs to be replaced.

        - `value: optional string`

          The data that makes up the text.

    - `RefusalDeltaBlock object { index, type, refusal }`

      The refusal content that is part of a message.

      - `index: number`

        The index of the refusal part in the message.

      - `type: "refusal"`

        Always `refusal`.

        - `"refusal"`

      - `refusal: optional string`

    - `ImageURLDeltaBlock object { index, type, image_url }`

      References an image URL in the content of a message.

      - `index: number`

        The index of the content part in the message.

      - `type: "image_url"`

        Always `image_url`.

        - `"image_url"`

      - `image_url: optional ImageURLDelta`

        - `detail: optional "auto" or "low" or "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: optional string`

          The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

  - `role: optional "user" or "assistant"`

    The entity that produced the message. One of `user` or `assistant`.

    - `"user"`

    - `"assistant"`

### Message Delta Event

- `MessageDeltaEvent object { id, delta, object }`

  Represents a message delta i.e. any changed fields on a message during streaming.

  - `id: string`

    The identifier of the message, which can be referenced in API endpoints.

  - `delta: MessageDelta`

    The delta containing the fields that have changed on the Message.

    - `content: optional array of ImageFileDeltaBlock or TextDeltaBlock or RefusalDeltaBlock or ImageURLDeltaBlock`

      The content of the message in array of text and/or images.

      - `ImageFileDeltaBlock object { index, type, image_file }`

        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: optional ImageFileDelta`

          - `detail: optional "auto" or "low" or "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: optional 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 object { index, type, text }`

        The text content that is part of a message.

        - `index: number`

          The index of the content part in the message.

        - `type: "text"`

          Always `text`.

          - `"text"`

        - `text: optional TextDelta`

          - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

            - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

              A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

              - `index: number`

                The index of the annotation in the text content part.

              - `type: "file_citation"`

                Always `file_citation`.

                - `"file_citation"`

              - `end_index: optional number`

              - `file_citation: optional object { file_id, quote }`

                - `file_id: optional string`

                  The ID of the specific File the citation is from.

                - `quote: optional string`

                  The specific quote in the file.

              - `start_index: optional number`

              - `text: optional string`

                The text in the message content that needs to be replaced.

            - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

              A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

              - `index: number`

                The index of the annotation in the text content part.

              - `type: "file_path"`

                Always `file_path`.

                - `"file_path"`

              - `end_index: optional number`

              - `file_path: optional object { file_id }`

                - `file_id: optional string`

                  The ID of the file that was generated.

              - `start_index: optional number`

              - `text: optional string`

                The text in the message content that needs to be replaced.

          - `value: optional string`

            The data that makes up the text.

      - `RefusalDeltaBlock object { index, type, refusal }`

        The refusal content that is part of a message.

        - `index: number`

          The index of the refusal part in the message.

        - `type: "refusal"`

          Always `refusal`.

          - `"refusal"`

        - `refusal: optional string`

      - `ImageURLDeltaBlock object { index, type, image_url }`

        References an image URL in the content of a message.

        - `index: number`

          The index of the content part in the message.

        - `type: "image_url"`

          Always `image_url`.

          - `"image_url"`

        - `image_url: optional ImageURLDelta`

          - `detail: optional "auto" or "low" or "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: optional string`

            The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.

    - `role: optional "user" or "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"`

### Refusal Content Block

- `RefusalContentBlock object { refusal, type }`

  The refusal content generated by the assistant.

  - `refusal: string`

  - `type: "refusal"`

    Always `refusal`.

    - `"refusal"`

### Refusal Delta Block

- `RefusalDeltaBlock object { index, type, refusal }`

  The refusal content that is part of a message.

  - `index: number`

    The index of the refusal part in the message.

  - `type: "refusal"`

    Always `refusal`.

    - `"refusal"`

  - `refusal: optional string`

### Text

- `Text object { annotations, value }`

  - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

    - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

      A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

      - `end_index: number`

      - `file_citation: object { file_id }`

        - `file_id: string`

          The ID of the specific File the citation is from.

      - `start_index: number`

      - `text: string`

        The text in the message content that needs to be replaced.

      - `type: "file_citation"`

        Always `file_citation`.

        - `"file_citation"`

    - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

      A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

      - `end_index: number`

      - `file_path: object { file_id }`

        - `file_id: string`

          The ID of the file that was generated.

      - `start_index: number`

      - `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.

### Text Content Block

- `TextContentBlock object { text, type }`

  The text content that is part of a message.

  - `text: Text`

    - `annotations: array of FileCitationAnnotation or FilePathAnnotation`

      - `FileCitationAnnotation object { end_index, file_citation, start_index, 2 more }`

        A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

        - `end_index: number`

        - `file_citation: object { file_id }`

          - `file_id: string`

            The ID of the specific File the citation is from.

        - `start_index: number`

        - `text: string`

          The text in the message content that needs to be replaced.

        - `type: "file_citation"`

          Always `file_citation`.

          - `"file_citation"`

      - `FilePathAnnotation object { end_index, file_path, start_index, 2 more }`

        A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

        - `end_index: number`

        - `file_path: object { file_id }`

          - `file_id: string`

            The ID of the file that was generated.

        - `start_index: number`

        - `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"`

### Text Content Block Param

- `TextContentBlockParam object { text, type }`

  The text content that is part of a message.

  - `text: string`

    Text content to be sent to the model

  - `type: "text"`

    Always `text`.

    - `"text"`

### Text Delta

- `TextDelta object { annotations, value }`

  - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

    - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

      A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

      - `index: number`

        The index of the annotation in the text content part.

      - `type: "file_citation"`

        Always `file_citation`.

        - `"file_citation"`

      - `end_index: optional number`

      - `file_citation: optional object { file_id, quote }`

        - `file_id: optional string`

          The ID of the specific File the citation is from.

        - `quote: optional string`

          The specific quote in the file.

      - `start_index: optional number`

      - `text: optional string`

        The text in the message content that needs to be replaced.

    - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

      A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

      - `index: number`

        The index of the annotation in the text content part.

      - `type: "file_path"`

        Always `file_path`.

        - `"file_path"`

      - `end_index: optional number`

      - `file_path: optional object { file_id }`

        - `file_id: optional string`

          The ID of the file that was generated.

      - `start_index: optional number`

      - `text: optional string`

        The text in the message content that needs to be replaced.

  - `value: optional string`

    The data that makes up the text.

### Text Delta Block

- `TextDeltaBlock object { index, type, text }`

  The text content that is part of a message.

  - `index: number`

    The index of the content part in the message.

  - `type: "text"`

    Always `text`.

    - `"text"`

  - `text: optional TextDelta`

    - `annotations: optional array of FileCitationDeltaAnnotation or FilePathDeltaAnnotation`

      - `FileCitationDeltaAnnotation object { index, type, end_index, 3 more }`

        A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files.

        - `index: number`

          The index of the annotation in the text content part.

        - `type: "file_citation"`

          Always `file_citation`.

          - `"file_citation"`

        - `end_index: optional number`

        - `file_citation: optional object { file_id, quote }`

          - `file_id: optional string`

            The ID of the specific File the citation is from.

          - `quote: optional string`

            The specific quote in the file.

        - `start_index: optional number`

        - `text: optional string`

          The text in the message content that needs to be replaced.

      - `FilePathDeltaAnnotation object { index, type, end_index, 3 more }`

        A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file.

        - `index: number`

          The index of the annotation in the text content part.

        - `type: "file_path"`

          Always `file_path`.

          - `"file_path"`

        - `end_index: optional number`

        - `file_path: optional object { file_id }`

          - `file_id: optional string`

            The ID of the file that was generated.

        - `start_index: optional number`

        - `text: optional string`

          The text in the message content that needs to be replaced.

    - `value: optional string`

      The data that makes up the text.

# Runs

## Cancel a run

**post** `/threads/{thread_id}/runs/{run_id}/cancel`

Cancels a run that is `in_progress`.

### Path Parameters

- `thread_id: string`

- `run_id: string`

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID/cancel \
    -X POST \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/cancel \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2" \
  -X POST
```

#### Response

```json
{
  "id": "run_abc123",
  "object": "thread.run",
  "created_at": 1699076126,
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "status": "cancelling",
  "started_at": 1699076126,
  "expires_at": 1699076726,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": null,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You summarize books.",
  "tools": [
    {
      "type": "file_search"
    }
  ],
  "tool_resources": {
    "file_search": {
      "vector_store_ids": ["vs_123"]
    }
  },
  "metadata": {},
  "usage": null,
  "temperature": 1.0,
  "top_p": 1.0,
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "required_action": null,
  "incomplete_details": null,
  "max_prompt_tokens": null,
  "max_completion_tokens": null,
  "truncation_strategy": {
    "type": "auto"
  }
}
```

## Create run

**post** `/threads/{thread_id}/runs`

Create a run.

### Path Parameters

- `thread_id: string`

### Query Parameters

- `include: optional array of RunStepInclude`

  A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.

  See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

  - `"step_details.tool_calls[*].file_search.results[*].content"`

### Body Parameters

- `assistant_id: string`

  The ID of the [assistant](/api/docs/assistants/migration) to use to execute this run.

- `additional_instructions: optional string or null`

  Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.

- `additional_messages: optional array of object { content, role, attachments, metadata }  or null`

  Adds additional messages to the thread before creating the run.

  - `content: string or array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

    The text contents of the message.

    - `TextContent = string`

      The text contents of the message.

    - `ArrayOfContentParts = array of ImageFileContentBlock or ImageURLContentBlock or TextContentBlockParam`

      An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](/api/docs/models).

      - `ImageFileContentBlock object { image_file, type }`

        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: optional "auto" or "low" or "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 object { image_url, type }`

        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.

          - `detail: optional "auto" or "low" or "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"`

      - `TextContentBlockParam object { text, type }`

        The text content that is part of a message.

        - `text: string`

          Text content to be sent to the model

        - `type: "text"`

          Always `text`.

          - `"text"`

  - `role: "user" or "assistant"`

    The role of the entity that is creating the message. Allowed values include:

    - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
    - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.

    - `"user"`

    - `"assistant"`

  - `attachments: optional array of object { file_id, tools }  or null`

    A list of files attached to the message, and the tools they should be added to.

    - `file_id: optional string`

      The ID of the file to attach to the message.

    - `tools: optional array of CodeInterpreterTool or FileSearchTool { type }`

      The tools to add this file to.

      - `CodeInterpreterTool object { type }`

        - `type: "code_interpreter"`

          The type of tool being defined: `code_interpreter`

          - `"code_interpreter"`

      - `FileSearchTool object { type }`

        - `type: "file_search"`

          The type of tool being defined: `file_search`

          - `"file_search"`

  - `metadata: optional Metadata or 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.

- `instructions: optional string or null`

  Overrides the [instructions](/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis.

- `max_completion_tokens: optional number or null`

  The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.

- `max_prompt_tokens: optional number or null`

  The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.

- `metadata: optional Metadata or 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: optional string or "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 39 more or null`

  The ID of the [Model](/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

  - `string`

  - `AssistantSupportedModels = "gpt-5" or "gpt-5-mini" or "gpt-5-nano" or 39 more`

    The ID of the [Model](/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.

    - `"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"`

- `parallel_tool_calls: optional boolean`

  Whether to enable [parallel function calling](/api/docs/guides/function-calling#parallel-function-calling) during tool use.

- `reasoning_effort: optional ReasoningEffort or 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: optional AssistantResponseFormatOption or 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` is the default value

    - `"auto"`

  - `ResponseFormatText object { type }`

    Default response format. Used to generate text responses.

    - `type: "text"`

      The type of response format being defined. Always `text`.

      - `"text"`

  - `ResponseFormatJSONObject object { type }`

    JSON object response format. An older method of generating JSON responses.
    Using `json_schema` is recommended for models that support it. Note that the
    model will not generate JSON without a system or user message instructing it
    to do so.

    - `type: "json_object"`

      The type of response format being defined. Always `json_object`.

      - `"json_object"`

  - `ResponseFormatJSONSchema object { json_schema, type }`

    JSON Schema response format. Used to generate structured JSON responses.
    Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

    - `json_schema: object { name, description, schema, strict }`

      Structured Outputs configuration options, including a JSON Schema.

      - `name: string`

        The name of the response format. Must be a-z, A-Z, 0-9, or contain
        underscores and dashes, with a maximum length of 64.

      - `description: optional string`

        A description of what the response format is for, used by the model to
        determine how to respond in the format.

      - `schema: optional map[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: optional boolean or 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"`

- `stream: optional boolean or null`

  If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.

- `temperature: optional number or 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.

- `tool_choice: optional AssistantToolChoiceOption or 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" or "auto" or "required"`

    `none` means the model will not call any tools 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 before responding to the user.

    - `"none"`

    - `"auto"`

    - `"required"`

  - `AssistantToolChoice object { type, function }`

    Specifies a tool the model should use. Use to force the model to call a specific tool.

    - `type: "function" or "code_interpreter" or "file_search"`

      The type of the tool. If type is `function`, the function name must be set

      - `"function"`

      - `"code_interpreter"`

      - `"file_search"`

    - `function: optional AssistantToolChoiceFunction`

      - `name: string`

        The name of the function to call.

- `tools: optional array of CodeInterpreterTool or FileSearchTool or FunctionTool or null`

  Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.

  - `CodeInterpreterTool object { type }`

  - `FileSearchTool object { type, file_search }`

    - `type: "file_search"`

      The type of tool being defined: `file_search`

      - `"file_search"`

    - `file_search: optional object { max_num_results, ranking_options }`

      Overrides for the file search tool.

      - `max_num_results: optional 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.

      - `ranking_options: optional object { score_threshold, ranker }`

        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.

        - `ranker: optional "auto" or "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 object { function, type }`

    - `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: optional string`

        A description of what the function does, used by the model to choose when and how to call the function.

      - `parameters: optional 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: optional boolean or 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: optional number or 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.

- `truncation_strategy: optional object { type, last_messages }  or 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" or "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: optional number or null`

    The number of most recent messages from the thread when constructing the context for the run.

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "assistant_id": "assistant_id",
          "model": "gpt-4.1",
          "temperature": 1,
          "top_p": 1
        }'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "assistant_id": "asst_abc123",
    "instructions": "You are a helpful assistant."
  }'
```

#### Response

```json
{
  "id": "run_abc123",
  "object": "thread.run",
  "created_at": 1699063290,
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "status": "queued",
  "started_at": null,
  "expires_at": null,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": null,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You are a helpful assistant.",
  "incomplete_details": null,
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "metadata": {},
  "usage": null,
  "temperature": 1.0,
  "top_p": 1.0,
  "max_prompt_tokens": 1000,
  "max_completion_tokens": 1000,
  "truncation_strategy": {
    "type": "auto"
  },
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "required_action": null
}
```

### Streaming

```http
curl https://api.openai.com/v1/threads/thread_123/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "assistant_id": "asst_123",
    "stream": true
  }'
```

#### Response

```json
event: thread.run.created
data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.queued
data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.in_progress
data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.step.created
data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.in_progress
data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.message.created
data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.in_progress
data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}}

: Intermediate Assistant events omitted.

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}}

event: thread.message.completed
data: {"id":"msg_001","object":"thread.message","created_at":1710330641,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710330642,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{},"attachments":[]}

event: thread.run.step.completed
data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"expired_at":null,"metadata":{}}

event: thread.run.completed
data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: done
data: [DONE]

```

### Streaming with Functions

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "assistant_id": "asst_abc123",
    "tools": [
      {
        "type": "function",
        "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"]
          }
        }
      }
    ],
    "stream": true
  }'
```

#### Response

```json
event: thread.run.created
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.queued
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.in_progress
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.step.created
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.in_progress
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.message.created
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.in_progress
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}}

: Intermediate Assistant events omitted.

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}}

event: thread.message.delta
data: {"id":"msg_001","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}}

event: thread.message.completed
data: {"id":"msg_001","object":"thread.message","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710348077,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! How can I assist you today?","annotations":[]}}],"metadata":{},"attachments":[]}

event: thread.run.step.completed
data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"expired_at":null,"metadata":{}}

event: thread.run.completed
data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: done
data: [DONE]

```

## List runs

**get** `/threads/{thread_id}/runs`

Returns a list of runs belonging to a thread.

### Path Parameters

- `thread_id: string`

### Query Parameters

- `after: optional 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: optional 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: optional number`

  A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

- `order: optional "asc" or "desc"`

  Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

  - `"asc"`

  - `"desc"`

### Returns

- `data: array of Run`

  - `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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

- `first_id: string`

- `has_more: boolean`

- `last_id: string`

- `object: string`

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "assistant_id": "assistant_id",
      "cancelled_at": 0,
      "completed_at": 0,
      "created_at": 0,
      "expires_at": 0,
      "failed_at": 0,
      "incomplete_details": {
        "reason": "max_completion_tokens"
      },
      "instructions": "instructions",
      "last_error": {
        "code": "server_error",
        "message": "message"
      },
      "max_completion_tokens": 256,
      "max_prompt_tokens": 256,
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "object": "thread.run",
      "parallel_tool_calls": true,
      "required_action": {
        "submit_tool_outputs": {
          "tool_calls": [
            {
              "id": "id",
              "function": {
                "arguments": "arguments",
                "name": "name"
              },
              "type": "function"
            }
          ]
        },
        "type": "submit_tool_outputs"
      },
      "response_format": "auto",
      "started_at": 0,
      "status": "queued",
      "thread_id": "thread_id",
      "tool_choice": "none",
      "tools": [
        {
          "type": "code_interpreter"
        }
      ],
      "truncation_strategy": {
        "type": "auto",
        "last_messages": 1
      },
      "usage": {
        "completion_tokens": 0,
        "prompt_tokens": 0,
        "total_tokens": 0
      },
      "temperature": 0,
      "top_p": 0
    }
  ],
  "first_id": "run_abc123",
  "has_more": false,
  "last_id": "run_abc456",
  "object": "list"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "run_abc123",
      "object": "thread.run",
      "created_at": 1699075072,
      "assistant_id": "asst_abc123",
      "thread_id": "thread_abc123",
      "status": "completed",
      "started_at": 1699075072,
      "expires_at": null,
      "cancelled_at": null,
      "failed_at": null,
      "completed_at": 1699075073,
      "last_error": null,
      "model": "gpt-4.1",
      "instructions": "You are a helpful assistant.",
      "incomplete_details": null,
      "tools": [
        {
          "type": "code_interpreter"
        }
      ],
      "tool_resources": {
        "code_interpreter": {
          "file_ids": [
            "file-abc123",
            "file-abc456"
          ]
        }
      },
      "metadata": {},
      "usage": {
        "prompt_tokens": 123,
        "completion_tokens": 456,
        "total_tokens": 579
      },
      "temperature": 1.0,
      "top_p": 1.0,
      "max_prompt_tokens": 1000,
      "max_completion_tokens": 1000,
      "truncation_strategy": {
        "type": "auto"
      },
      "response_format": "auto",
      "tool_choice": "auto",
      "parallel_tool_calls": true,
      "required_action": null
    },
    {
      "id": "run_abc456",
      "object": "thread.run",
      "created_at": 1699063290,
      "assistant_id": "asst_abc123",
      "thread_id": "thread_abc123",
      "status": "completed",
      "started_at": 1699063290,
      "expires_at": null,
      "cancelled_at": null,
      "failed_at": null,
      "completed_at": 1699063291,
      "last_error": null,
      "model": "gpt-4.1",
      "instructions": "You are a helpful assistant.",
      "incomplete_details": null,
      "tools": [
        {
          "type": "code_interpreter"
        }
      ],
      "tool_resources": {
        "code_interpreter": {
          "file_ids": [
            "file-abc123",
            "file-abc456"
          ]
        }
      },
      "metadata": {},
      "usage": {
        "prompt_tokens": 123,
        "completion_tokens": 456,
        "total_tokens": 579
      },
      "temperature": 1.0,
      "top_p": 1.0,
      "max_prompt_tokens": 1000,
      "max_completion_tokens": 1000,
      "truncation_strategy": {
        "type": "auto"
      },
      "response_format": "auto",
      "tool_choice": "auto",
      "parallel_tool_calls": true,
      "required_action": null
    }
  ],
  "first_id": "run_abc123",
  "last_id": "run_abc456",
  "has_more": false
}
```

## Retrieve run

**get** `/threads/{thread_id}/runs/{run_id}`

Retrieves a run.

### Path Parameters

- `thread_id: string`

- `run_id: string`

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "id": "run_abc123",
  "object": "thread.run",
  "created_at": 1699075072,
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "status": "completed",
  "started_at": 1699075072,
  "expires_at": null,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": 1699075073,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You are a helpful assistant.",
  "incomplete_details": null,
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "metadata": {},
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 456,
    "total_tokens": 579
  },
  "temperature": 1.0,
  "top_p": 1.0,
  "max_prompt_tokens": 1000,
  "max_completion_tokens": 1000,
  "truncation_strategy": {
    "type": "auto"
  },
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "required_action": null
}
```

## Submit tool outputs to run

**post** `/threads/{thread_id}/runs/{run_id}/submit_tool_outputs`

When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.

### Path Parameters

- `thread_id: string`

- `run_id: string`

### Body Parameters

- `tool_outputs: array of object { output, tool_call_id }`

  A list of tools for which the outputs are being submitted.

  - `output: optional string`

    The output of the tool call to be submitted to continue the run.

  - `tool_call_id: optional string`

    The ID of the tool call in the `required_action` object within the run object the output is being submitted for.

- `stream: optional boolean or null`

  If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message.

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID/submit_tool_outputs \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "tool_outputs": [
            {}
          ]
        }'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "tool_outputs": [
      {
        "tool_call_id": "call_001",
        "output": "70 degrees and sunny."
      }
    ]
  }'
```

#### Response

```json
{
  "id": "run_123",
  "object": "thread.run",
  "created_at": 1699075592,
  "assistant_id": "asst_123",
  "thread_id": "thread_123",
  "status": "queued",
  "started_at": 1699075592,
  "expires_at": 1699076192,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": null,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You are a helpful assistant.",
  "tools": [
    {
      "type": "function",
      "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"]
        }
      }
    }
  ],
  "metadata": {},
  "usage": null,
  "temperature": 1.0,
  "top_p": 1.0,
  "max_prompt_tokens": 1000,
  "max_completion_tokens": 1000,
  "truncation_strategy": {
    "type": "auto"
  },
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "required_action": null,
  "incomplete_details": null
}
```

### Streaming

```http
curl https://api.openai.com/v1/threads/thread_123/runs/run_123/submit_tool_outputs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "tool_outputs": [
      {
        "tool_call_id": "call_001",
        "output": "70 degrees and sunny."
      }
    ],
    "stream": true
  }'
```

#### Response

```json
event: thread.run.step.completed
data: {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315},"expired_at":null,"metadata":{}}

event: thread.run.queued
data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.in_progress
data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: thread.run.step.created
data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.run.step.in_progress
data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null,"expired_at":null,"metadata":{}}

event: thread.message.created
data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.in_progress
data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"metadata":{},"attachments":[]}

event: thread.message.delta
data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"The","annotations":[]}}]}}

event: thread.message.delta
data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" current"}}]}}

event: thread.message.delta
data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" weather"}}]}}

: Intermediate Assistant events omitted.

event: thread.message.delta
data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" sunny"}}]}}

event: thread.message.delta
data: {"id":"msg_002","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}}

event: thread.message.completed
data: {"id":"msg_002","object":"thread.message","created_at":1710352476,"assistant_id":"asst_123","thread_id":"thread_123","run_id":"run_123","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1710352477,"role":"assistant","content":[{"type":"text","text":{"value":"The current weather in San Francisco, CA is 70 degrees Fahrenheit and sunny.","annotations":[]}}],"metadata":{},"attachments":[]}

event: thread.run.step.completed
data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347},"expired_at":null,"metadata":{}}

event: thread.run.completed
data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4.1","instructions":"You are a helpful assistant.","tools":[{"type":"function","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"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto"},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}

event: done
data: [DONE]

```

## Modify run

**post** `/threads/{thread_id}/runs/{run_id}`

Modifies a run.

### Path Parameters

- `thread_id: string`

- `run_id: string`

### Body Parameters

- `metadata: optional Metadata or 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.

### Returns

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID \
    -H 'Content-Type: application/json' \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expires_at": 0,
  "failed_at": 0,
  "incomplete_details": {
    "reason": "max_completion_tokens"
  },
  "instructions": "instructions",
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "max_completion_tokens": 256,
  "max_prompt_tokens": 256,
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "object": "thread.run",
  "parallel_tool_calls": true,
  "required_action": {
    "submit_tool_outputs": {
      "tool_calls": [
        {
          "id": "id",
          "function": {
            "arguments": "arguments",
            "name": "name"
          },
          "type": "function"
        }
      ]
    },
    "type": "submit_tool_outputs"
  },
  "response_format": "auto",
  "started_at": 0,
  "status": "queued",
  "thread_id": "thread_id",
  "tool_choice": "none",
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "truncation_strategy": {
    "type": "auto",
    "last_messages": 1
  },
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  },
  "temperature": 0,
  "top_p": 0
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2" \
  -d '{
    "metadata": {
      "user_id": "user_abc123"
    }
  }'
```

#### Response

```json
{
  "id": "run_abc123",
  "object": "thread.run",
  "created_at": 1699075072,
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "status": "completed",
  "started_at": 1699075072,
  "expires_at": null,
  "cancelled_at": null,
  "failed_at": null,
  "completed_at": 1699075073,
  "last_error": null,
  "model": "gpt-4.1",
  "instructions": "You are a helpful assistant.",
  "incomplete_details": null,
  "tools": [
    {
      "type": "code_interpreter"
    }
  ],
  "tool_resources": {
    "code_interpreter": {
      "file_ids": [
        "file-abc123",
        "file-abc456"
      ]
    }
  },
  "metadata": {
    "user_id": "user_abc123"
  },
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 456,
    "total_tokens": 579
  },
  "temperature": 1.0,
  "top_p": 1.0,
  "max_prompt_tokens": 1000,
  "max_completion_tokens": 1000,
  "truncation_strategy": {
    "type": "auto"
  },
  "response_format": "auto",
  "tool_choice": "auto",
  "parallel_tool_calls": true,
  "required_action": null
}
```

## Domain Types

### Required Action Function Tool Call

- `RequiredActionFunctionToolCall object { id, function, type }`

  Tool call objects

  - `id: string`

    The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/api/docs/assistants/migration) endpoint.

  - `function: object { arguments, name }`

    The function definition.

    - `arguments: string`

      The arguments that the model expects you to pass to the function.

    - `name: string`

      The name of the function.

  - `type: "function"`

    The type of tool call the output is required for. For now, this is always `function`.

    - `"function"`

### Run

- `Run object { id, assistant_id, cancelled_at, 24 more }`

  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 or null`

    The Unix timestamp (in seconds) for when the run was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run was completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run was created.

  - `expires_at: number or null`

    The Unix timestamp (in seconds) for when the run will expire.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run failed.

  - `incomplete_details: object { reason }  or null`

    Details on why the run is incomplete. Will be `null` if the run is not incomplete.

    - `reason: optional "max_completion_tokens" or "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: object { code, message }  or null`

    The last error associated with this run. Will be `null` if there are no errors.

    - `code: "server_error" or "rate_limit_exceeded" or "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 or null`

    The maximum number of completion tokens specified to have been used over the course of the run.

  - `max_prompt_tokens: number or null`

    The maximum number of prompt tokens specified to have been used over the course of the run.

  - `metadata: Metadata or 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: object { submit_tool_outputs, type }  or null`

    Details on the action required to continue the run. Will be `null` if no action is required.

    - `submit_tool_outputs: object { tool_calls }`

      Details on the tool outputs needed for this run to continue.

      - `tool_calls: array of 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: object { arguments, name }`

          The function definition.

          - `arguments: string`

            The arguments that the model expects you to pass to the function.

          - `name: string`

            The name of the function.

        - `type: "function"`

          The type of tool call the output is required for. For now, this is always `function`.

          - `"function"`

    - `type: "submit_tool_outputs"`

      For now, this is always `submit_tool_outputs`.

      - `"submit_tool_outputs"`

  - `response_format: AssistantResponseFormatOption or 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` is the default value

      - `"auto"`

    - `ResponseFormatText object { type }`

      Default response format. Used to generate text responses.

      - `type: "text"`

        The type of response format being defined. Always `text`.

        - `"text"`

    - `ResponseFormatJSONObject object { type }`

      JSON object response format. An older method of generating JSON responses.
      Using `json_schema` is recommended for models that support it. Note that the
      model will not generate JSON without a system or user message instructing it
      to do so.

      - `type: "json_object"`

        The type of response format being defined. Always `json_object`.

        - `"json_object"`

    - `ResponseFormatJSONSchema object { json_schema, type }`

      JSON Schema response format. Used to generate structured JSON responses.
      Learn more about [Structured Outputs](/api/docs/guides/structured-outputs).

      - `json_schema: object { name, description, schema, strict }`

        Structured Outputs configuration options, including a JSON Schema.

        - `name: string`

          The name of the response format. Must be a-z, A-Z, 0-9, or contain
          underscores and dashes, with a maximum length of 64.

        - `description: optional string`

          A description of what the response format is for, used by the model to
          determine how to respond in the format.

        - `schema: optional map[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: optional boolean or 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 or null`

    The Unix timestamp (in seconds) for when the run was started.

  - `status: "queued" or "in_progress" or "requires_action" or 6 more`

    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 or 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" or "auto" or "required"`

      `none` means the model will not call any tools 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 before responding to the user.

      - `"none"`

      - `"auto"`

      - `"required"`

    - `AssistantToolChoice object { type, function }`

      Specifies a tool the model should use. Use to force the model to call a specific tool.

      - `type: "function" or "code_interpreter" or "file_search"`

        The type of the tool. If type is `function`, the function name must be set

        - `"function"`

        - `"code_interpreter"`

        - `"file_search"`

      - `function: optional AssistantToolChoiceFunction`

        - `name: string`

          The name of the function to call.

  - `tools: array of CodeInterpreterTool or FileSearchTool or FunctionTool`

    The list of tools that the [assistant](/api/docs/assistants/migration) used for this run.

    - `CodeInterpreterTool object { type }`

      - `type: "code_interpreter"`

        The type of tool being defined: `code_interpreter`

        - `"code_interpreter"`

    - `FileSearchTool object { type, file_search }`

      - `type: "file_search"`

        The type of tool being defined: `file_search`

        - `"file_search"`

      - `file_search: optional object { max_num_results, ranking_options }`

        Overrides for the file search tool.

        - `max_num_results: optional 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.

        - `ranking_options: optional object { score_threshold, ranker }`

          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.

          - `ranker: optional "auto" or "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 object { function, type }`

      - `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: optional string`

          A description of what the function does, used by the model to choose when and how to call the function.

        - `parameters: optional 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: optional boolean or 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: object { type, last_messages }  or 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" or "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: optional number or null`

      The number of most recent messages from the thread when constructing the context for the run.

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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: optional number or null`

    The sampling temperature used for this run. If not set, defaults to 1.

  - `top_p: optional number or null`

    The nucleus sampling value used for this run. If not set, defaults to 1.

# Steps

## List run steps

**get** `/threads/{thread_id}/runs/{run_id}/steps`

Returns a list of run steps belonging to a run.

### Path Parameters

- `thread_id: string`

- `run_id: string`

### Query Parameters

- `after: optional 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: optional 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.

- `include: optional array of RunStepInclude`

  A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.

  See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

  - `"step_details.tool_calls[*].file_search.results[*].content"`

- `limit: optional number`

  A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

- `order: optional "asc" or "desc"`

  Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.

  - `"asc"`

  - `"desc"`

### Returns

- `data: array of RunStep`

  - `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 or null`

    The Unix timestamp (in seconds) for when the run step was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run step completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run step was created.

  - `expired_at: number or null`

    The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run step failed.

  - `last_error: object { code, message }  or null`

    The last error associated with this run step. Will be `null` if there are no errors.

    - `code: "server_error" or "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 or 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" or "cancelled" or "failed" or 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 or ToolCallsStepDetails`

    The details of the run step.

    - `MessageCreationStepDetails object { message_creation, type }`

      Details of the message creation by the run step.

      - `message_creation: object { message_id }`

        - `message_id: string`

          The ID of the message that was created by this run step.

      - `type: "message_creation"`

        Always `message_creation`.

        - `"message_creation"`

    - `ToolCallsStepDetails object { tool_calls, type }`

      Details of the tool call.

      - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

        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 object { id, code_interpreter, type }`

          Details of the Code Interpreter tool call the run step was involved in.

          - `id: string`

            The ID of the tool call.

          - `code_interpreter: object { input, outputs }`

            The Code Interpreter tool call definition.

            - `input: string`

              The input to the Code Interpreter tool call.

            - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

              The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

              - `CodeInterpreterLogOutput object { logs, type }`

                Text output from the Code Interpreter tool call as part of a run step.

                - `logs: string`

                  The text output from the Code Interpreter tool call.

                - `type: "logs"`

                  Always `logs`.

                  - `"logs"`

              - `CodeInterpreterImageOutput object { image, type }`

                - `image: object { file_id }`

                  - `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 object { id, file_search, type }`

          - `id: string`

            The ID of the tool call object.

          - `file_search: object { ranking_options, results }`

            For now, this is always going to be an empty object.

            - `ranking_options: optional object { ranker, score_threshold }`

              The ranking options for the file search.

              - `ranker: "auto" or "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.

            - `results: optional array of object { file_id, file_name, score, content }`

              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.

              - `content: optional array of object { text, type }`

                The content of the result that was found. The content is only included if requested via the include query parameter.

                - `text: optional string`

                  The text content of the file.

                - `type: optional "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 object { id, function, type }`

          - `id: string`

            The ID of the tool call object.

          - `function: object { arguments, name, output }`

            The definition of the function that was called.

            - `arguments: string`

              The arguments passed to the function.

            - `name: string`

              The name of the function.

            - `output: string or 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" or "tool_calls"`

    The type of run step, which can be either `message_creation` or `tool_calls`.

    - `"message_creation"`

    - `"tool_calls"`

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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).

- `first_id: string`

- `has_more: boolean`

- `last_id: string`

- `object: string`

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID/steps \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "assistant_id": "assistant_id",
      "cancelled_at": 0,
      "completed_at": 0,
      "created_at": 0,
      "expired_at": 0,
      "failed_at": 0,
      "last_error": {
        "code": "server_error",
        "message": "message"
      },
      "metadata": {
        "foo": "string"
      },
      "object": "thread.run.step",
      "run_id": "run_id",
      "status": "in_progress",
      "step_details": {
        "message_creation": {
          "message_id": "message_id"
        },
        "type": "message_creation"
      },
      "thread_id": "thread_id",
      "type": "message_creation",
      "usage": {
        "completion_tokens": 0,
        "prompt_tokens": 0,
        "total_tokens": 0
      }
    }
  ],
  "first_id": "step_abc123",
  "has_more": false,
  "last_id": "step_abc456",
  "object": "list"
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "step_abc123",
      "object": "thread.run.step",
      "created_at": 1699063291,
      "run_id": "run_abc123",
      "assistant_id": "asst_abc123",
      "thread_id": "thread_abc123",
      "type": "message_creation",
      "status": "completed",
      "cancelled_at": null,
      "completed_at": 1699063291,
      "expired_at": null,
      "failed_at": null,
      "last_error": null,
      "step_details": {
        "type": "message_creation",
        "message_creation": {
          "message_id": "msg_abc123"
        }
      },
      "usage": {
        "prompt_tokens": 123,
        "completion_tokens": 456,
        "total_tokens": 579
      },
      "metadata": {}
    }
  ],
  "first_id": "step_abc123",
  "last_id": "step_abc123",
  "has_more": false
}
```

## Retrieve run step

**get** `/threads/{thread_id}/runs/{run_id}/steps/{step_id}`

Retrieves a run step.

### Path Parameters

- `thread_id: string`

- `run_id: string`

- `step_id: string`

### Query Parameters

- `include: optional array of RunStepInclude`

  A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.

  See the [file search tool documentation](/api/docs/guides/tools-file-search#retrieval-customization) for more information.

  - `"step_details.tool_calls[*].file_search.results[*].content"`

### Returns

- `RunStep object { id, assistant_id, cancelled_at, 13 more }`

  Represents a step in execution of a run.

  - `id: string`

    The identifier of the run step, which can be referenced in API endpoints.

  - `assistant_id: string`

    The ID of the [assistant](/api/docs/assistants/migration) associated with the run step.

  - `cancelled_at: number or null`

    The Unix timestamp (in seconds) for when the run step was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run step completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run step was created.

  - `expired_at: number or null`

    The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run step failed.

  - `last_error: object { code, message }  or null`

    The last error associated with this run step. Will be `null` if there are no errors.

    - `code: "server_error" or "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 or 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" or "cancelled" or "failed" or 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 or ToolCallsStepDetails`

    The details of the run step.

    - `MessageCreationStepDetails object { message_creation, type }`

      Details of the message creation by the run step.

      - `message_creation: object { message_id }`

        - `message_id: string`

          The ID of the message that was created by this run step.

      - `type: "message_creation"`

        Always `message_creation`.

        - `"message_creation"`

    - `ToolCallsStepDetails object { tool_calls, type }`

      Details of the tool call.

      - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

        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 object { id, code_interpreter, type }`

          Details of the Code Interpreter tool call the run step was involved in.

          - `id: string`

            The ID of the tool call.

          - `code_interpreter: object { input, outputs }`

            The Code Interpreter tool call definition.

            - `input: string`

              The input to the Code Interpreter tool call.

            - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

              The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

              - `CodeInterpreterLogOutput object { logs, type }`

                Text output from the Code Interpreter tool call as part of a run step.

                - `logs: string`

                  The text output from the Code Interpreter tool call.

                - `type: "logs"`

                  Always `logs`.

                  - `"logs"`

              - `CodeInterpreterImageOutput object { image, type }`

                - `image: object { file_id }`

                  - `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 object { id, file_search, type }`

          - `id: string`

            The ID of the tool call object.

          - `file_search: object { ranking_options, results }`

            For now, this is always going to be an empty object.

            - `ranking_options: optional object { ranker, score_threshold }`

              The ranking options for the file search.

              - `ranker: "auto" or "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.

            - `results: optional array of object { file_id, file_name, score, content }`

              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.

              - `content: optional array of object { text, type }`

                The content of the result that was found. The content is only included if requested via the include query parameter.

                - `text: optional string`

                  The text content of the file.

                - `type: optional "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 object { id, function, type }`

          - `id: string`

            The ID of the tool call object.

          - `function: object { arguments, name, output }`

            The definition of the function that was called.

            - `arguments: string`

              The arguments passed to the function.

            - `name: string`

              The name of the function.

            - `output: string or 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" or "tool_calls"`

    The type of run step, which can be either `message_creation` or `tool_calls`.

    - `"message_creation"`

    - `"tool_calls"`

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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).

### Example

```http
curl https://api.openai.com/v1/threads/$THREAD_ID/runs/$RUN_ID/steps/$STEP_ID \
    -H 'OpenAI-Beta: assistants=v2' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
```

#### Response

```json
{
  "id": "id",
  "assistant_id": "assistant_id",
  "cancelled_at": 0,
  "completed_at": 0,
  "created_at": 0,
  "expired_at": 0,
  "failed_at": 0,
  "last_error": {
    "code": "server_error",
    "message": "message"
  },
  "metadata": {
    "foo": "string"
  },
  "object": "thread.run.step",
  "run_id": "run_id",
  "status": "in_progress",
  "step_details": {
    "message_creation": {
      "message_id": "message_id"
    },
    "type": "message_creation"
  },
  "thread_id": "thread_id",
  "type": "message_creation",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  }
}
```

### Example

```http
curl https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2"
```

#### Response

```json
{
  "id": "step_abc123",
  "object": "thread.run.step",
  "created_at": 1699063291,
  "run_id": "run_abc123",
  "assistant_id": "asst_abc123",
  "thread_id": "thread_abc123",
  "type": "message_creation",
  "status": "completed",
  "cancelled_at": null,
  "completed_at": 1699063291,
  "expired_at": null,
  "failed_at": null,
  "last_error": null,
  "step_details": {
    "type": "message_creation",
    "message_creation": {
      "message_id": "msg_abc123"
    }
  },
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 456,
    "total_tokens": 579
  },
  "metadata": {}
}
```

## Domain Types

### Code Interpreter Logs

- `CodeInterpreterLogs object { index, type, logs }`

  Text output from the Code Interpreter tool call as part of a run step.

  - `index: number`

    The index of the output in the outputs array.

  - `type: "logs"`

    Always `logs`.

    - `"logs"`

  - `logs: optional string`

    The text output from the Code Interpreter tool call.

### Code Interpreter Output Image

- `CodeInterpreterOutputImage object { index, type, image }`

  - `index: number`

    The index of the output in the outputs array.

  - `type: "image"`

    Always `image`.

    - `"image"`

  - `image: optional object { file_id }`

    - `file_id: optional string`

      The [file](/api/reference/resources/files) ID of the image.

### Code Interpreter Tool Call

- `CodeInterpreterToolCall object { id, code_interpreter, type }`

  Details of the Code Interpreter tool call the run step was involved in.

  - `id: string`

    The ID of the tool call.

  - `code_interpreter: object { input, outputs }`

    The Code Interpreter tool call definition.

    - `input: string`

      The input to the Code Interpreter tool call.

    - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

      The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

      - `CodeInterpreterLogOutput object { logs, type }`

        Text output from the Code Interpreter tool call as part of a run step.

        - `logs: string`

          The text output from the Code Interpreter tool call.

        - `type: "logs"`

          Always `logs`.

          - `"logs"`

      - `CodeInterpreterImageOutput object { image, type }`

        - `image: object { file_id }`

          - `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"`

### Code Interpreter Tool Call Delta

- `CodeInterpreterToolCallDelta object { index, type, id, code_interpreter }`

  Details of the Code Interpreter tool call the run step was involved in.

  - `index: number`

    The index of the tool call in the tool calls array.

  - `type: "code_interpreter"`

    The type of tool call. This is always going to be `code_interpreter` for this type of tool call.

    - `"code_interpreter"`

  - `id: optional string`

    The ID of the tool call.

  - `code_interpreter: optional object { input, outputs }`

    The Code Interpreter tool call definition.

    - `input: optional string`

      The input to the Code Interpreter tool call.

    - `outputs: optional array of CodeInterpreterLogs or 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 object { index, type, logs }`

        Text output from the Code Interpreter tool call as part of a run step.

        - `index: number`

          The index of the output in the outputs array.

        - `type: "logs"`

          Always `logs`.

          - `"logs"`

        - `logs: optional string`

          The text output from the Code Interpreter tool call.

      - `CodeInterpreterOutputImage object { index, type, image }`

        - `index: number`

          The index of the output in the outputs array.

        - `type: "image"`

          Always `image`.

          - `"image"`

        - `image: optional object { file_id }`

          - `file_id: optional string`

            The [file](/api/reference/resources/files) ID of the image.

### File Search Tool Call

- `FileSearchToolCall object { id, file_search, type }`

  - `id: string`

    The ID of the tool call object.

  - `file_search: object { ranking_options, results }`

    For now, this is always going to be an empty object.

    - `ranking_options: optional object { ranker, score_threshold }`

      The ranking options for the file search.

      - `ranker: "auto" or "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.

    - `results: optional array of object { file_id, file_name, score, content }`

      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.

      - `content: optional array of object { text, type }`

        The content of the result that was found. The content is only included if requested via the include query parameter.

        - `text: optional string`

          The text content of the file.

        - `type: optional "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"`

### File Search Tool Call Delta

- `FileSearchToolCallDelta object { file_search, index, type, id }`

  - `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: optional string`

    The ID of the tool call object.

### Function Tool Call

- `FunctionToolCall object { id, function, type }`

  - `id: string`

    The ID of the tool call object.

  - `function: object { arguments, name, output }`

    The definition of the function that was called.

    - `arguments: string`

      The arguments passed to the function.

    - `name: string`

      The name of the function.

    - `output: string or 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"`

### Function Tool Call Delta

- `FunctionToolCallDelta object { index, type, id, function }`

  - `index: number`

    The index of the tool call in the tool calls array.

  - `type: "function"`

    The type of tool call. This is always going to be `function` for this type of tool call.

    - `"function"`

  - `id: optional string`

    The ID of the tool call object.

  - `function: optional object { arguments, name, output }`

    The definition of the function that was called.

    - `arguments: optional string`

      The arguments passed to the function.

    - `name: optional string`

      The name of the function.

    - `output: optional string or null`

      The output of the function. This will be `null` if the outputs have not been [submitted](/api/docs/assistants/migration) yet.

### Message Creation Step Details

- `MessageCreationStepDetails object { message_creation, type }`

  Details of the message creation by the run step.

  - `message_creation: object { message_id }`

    - `message_id: string`

      The ID of the message that was created by this run step.

  - `type: "message_creation"`

    Always `message_creation`.

    - `"message_creation"`

### Run Step

- `RunStep object { id, assistant_id, cancelled_at, 13 more }`

  Represents a step in execution of a run.

  - `id: string`

    The identifier of the run step, which can be referenced in API endpoints.

  - `assistant_id: string`

    The ID of the [assistant](/api/docs/assistants/migration) associated with the run step.

  - `cancelled_at: number or null`

    The Unix timestamp (in seconds) for when the run step was cancelled.

  - `completed_at: number or null`

    The Unix timestamp (in seconds) for when the run step completed.

  - `created_at: number`

    The Unix timestamp (in seconds) for when the run step was created.

  - `expired_at: number or null`

    The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired.

  - `failed_at: number or null`

    The Unix timestamp (in seconds) for when the run step failed.

  - `last_error: object { code, message }  or null`

    The last error associated with this run step. Will be `null` if there are no errors.

    - `code: "server_error" or "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 or 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" or "cancelled" or "failed" or 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 or ToolCallsStepDetails`

    The details of the run step.

    - `MessageCreationStepDetails object { message_creation, type }`

      Details of the message creation by the run step.

      - `message_creation: object { message_id }`

        - `message_id: string`

          The ID of the message that was created by this run step.

      - `type: "message_creation"`

        Always `message_creation`.

        - `"message_creation"`

    - `ToolCallsStepDetails object { tool_calls, type }`

      Details of the tool call.

      - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

        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 object { id, code_interpreter, type }`

          Details of the Code Interpreter tool call the run step was involved in.

          - `id: string`

            The ID of the tool call.

          - `code_interpreter: object { input, outputs }`

            The Code Interpreter tool call definition.

            - `input: string`

              The input to the Code Interpreter tool call.

            - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

              The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

              - `CodeInterpreterLogOutput object { logs, type }`

                Text output from the Code Interpreter tool call as part of a run step.

                - `logs: string`

                  The text output from the Code Interpreter tool call.

                - `type: "logs"`

                  Always `logs`.

                  - `"logs"`

              - `CodeInterpreterImageOutput object { image, type }`

                - `image: object { file_id }`

                  - `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 object { id, file_search, type }`

          - `id: string`

            The ID of the tool call object.

          - `file_search: object { ranking_options, results }`

            For now, this is always going to be an empty object.

            - `ranking_options: optional object { ranker, score_threshold }`

              The ranking options for the file search.

              - `ranker: "auto" or "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.

            - `results: optional array of object { file_id, file_name, score, content }`

              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.

              - `content: optional array of object { text, type }`

                The content of the result that was found. The content is only included if requested via the include query parameter.

                - `text: optional string`

                  The text content of the file.

                - `type: optional "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 object { id, function, type }`

          - `id: string`

            The ID of the tool call object.

          - `function: object { arguments, name, output }`

            The definition of the function that was called.

            - `arguments: string`

              The arguments passed to the function.

            - `name: string`

              The name of the function.

            - `output: string or 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" or "tool_calls"`

    The type of run step, which can be either `message_creation` or `tool_calls`.

    - `"message_creation"`

    - `"tool_calls"`

  - `usage: object { completion_tokens, prompt_tokens, total_tokens }  or 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).

### Run Step Delta Event

- `RunStepDeltaEvent object { id, delta, object }`

  Represents a run step delta i.e. any changed fields on a run step during streaming.

  - `id: string`

    The identifier of the run step, which can be referenced in API endpoints.

  - `delta: object { step_details }`

    The delta containing the fields that have changed on the run step.

    - `step_details: optional RunStepDeltaMessageDelta or ToolCallDeltaObject`

      The details of the run step.

      - `RunStepDeltaMessageDelta object { type, message_creation }`

        Details of the message creation by the run step.

        - `type: "message_creation"`

          Always `message_creation`.

          - `"message_creation"`

        - `message_creation: optional object { message_id }`

          - `message_id: optional string`

            The ID of the message that was created by this run step.

      - `ToolCallDeltaObject object { type, tool_calls }`

        Details of the tool call.

        - `type: "tool_calls"`

          Always `tool_calls`.

          - `"tool_calls"`

        - `tool_calls: optional array of CodeInterpreterToolCallDelta or FileSearchToolCallDelta or FunctionToolCallDelta`

          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 object { index, type, id, code_interpreter }`

            Details of the Code Interpreter tool call the run step was involved in.

            - `index: number`

              The index of the tool call in the tool calls array.

            - `type: "code_interpreter"`

              The type of tool call. This is always going to be `code_interpreter` for this type of tool call.

              - `"code_interpreter"`

            - `id: optional string`

              The ID of the tool call.

            - `code_interpreter: optional object { input, outputs }`

              The Code Interpreter tool call definition.

              - `input: optional string`

                The input to the Code Interpreter tool call.

              - `outputs: optional array of CodeInterpreterLogs or 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 object { index, type, logs }`

                  Text output from the Code Interpreter tool call as part of a run step.

                  - `index: number`

                    The index of the output in the outputs array.

                  - `type: "logs"`

                    Always `logs`.

                    - `"logs"`

                  - `logs: optional string`

                    The text output from the Code Interpreter tool call.

                - `CodeInterpreterOutputImage object { index, type, image }`

                  - `index: number`

                    The index of the output in the outputs array.

                  - `type: "image"`

                    Always `image`.

                    - `"image"`

                  - `image: optional object { file_id }`

                    - `file_id: optional string`

                      The [file](/api/reference/resources/files) ID of the image.

          - `FileSearchToolCallDelta object { file_search, index, type, id }`

            - `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: optional string`

              The ID of the tool call object.

          - `FunctionToolCallDelta object { index, type, id, function }`

            - `index: number`

              The index of the tool call in the tool calls array.

            - `type: "function"`

              The type of tool call. This is always going to be `function` for this type of tool call.

              - `"function"`

            - `id: optional string`

              The ID of the tool call object.

            - `function: optional object { arguments, name, output }`

              The definition of the function that was called.

              - `arguments: optional string`

                The arguments passed to the function.

              - `name: optional string`

                The name of the function.

              - `output: optional string or 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"`

### Run Step Delta Message Delta

- `RunStepDeltaMessageDelta object { type, message_creation }`

  Details of the message creation by the run step.

  - `type: "message_creation"`

    Always `message_creation`.

    - `"message_creation"`

  - `message_creation: optional object { message_id }`

    - `message_id: optional string`

      The ID of the message that was created by this run step.

### Run Step Include

- `RunStepInclude = "step_details.tool_calls[*].file_search.results[*].content"`

  - `"step_details.tool_calls[*].file_search.results[*].content"`

### Tool Call Delta Object

- `ToolCallDeltaObject object { type, tool_calls }`

  Details of the tool call.

  - `type: "tool_calls"`

    Always `tool_calls`.

    - `"tool_calls"`

  - `tool_calls: optional array of CodeInterpreterToolCallDelta or FileSearchToolCallDelta or FunctionToolCallDelta`

    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 object { index, type, id, code_interpreter }`

      Details of the Code Interpreter tool call the run step was involved in.

      - `index: number`

        The index of the tool call in the tool calls array.

      - `type: "code_interpreter"`

        The type of tool call. This is always going to be `code_interpreter` for this type of tool call.

        - `"code_interpreter"`

      - `id: optional string`

        The ID of the tool call.

      - `code_interpreter: optional object { input, outputs }`

        The Code Interpreter tool call definition.

        - `input: optional string`

          The input to the Code Interpreter tool call.

        - `outputs: optional array of CodeInterpreterLogs or 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 object { index, type, logs }`

            Text output from the Code Interpreter tool call as part of a run step.

            - `index: number`

              The index of the output in the outputs array.

            - `type: "logs"`

              Always `logs`.

              - `"logs"`

            - `logs: optional string`

              The text output from the Code Interpreter tool call.

          - `CodeInterpreterOutputImage object { index, type, image }`

            - `index: number`

              The index of the output in the outputs array.

            - `type: "image"`

              Always `image`.

              - `"image"`

            - `image: optional object { file_id }`

              - `file_id: optional string`

                The [file](/api/reference/resources/files) ID of the image.

    - `FileSearchToolCallDelta object { file_search, index, type, id }`

      - `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: optional string`

        The ID of the tool call object.

    - `FunctionToolCallDelta object { index, type, id, function }`

      - `index: number`

        The index of the tool call in the tool calls array.

      - `type: "function"`

        The type of tool call. This is always going to be `function` for this type of tool call.

        - `"function"`

      - `id: optional string`

        The ID of the tool call object.

      - `function: optional object { arguments, name, output }`

        The definition of the function that was called.

        - `arguments: optional string`

          The arguments passed to the function.

        - `name: optional string`

          The name of the function.

        - `output: optional string or null`

          The output of the function. This will be `null` if the outputs have not been [submitted](/api/docs/assistants/migration) yet.

### Tool Calls Step Details

- `ToolCallsStepDetails object { tool_calls, type }`

  Details of the tool call.

  - `tool_calls: array of CodeInterpreterToolCall or FileSearchToolCall or FunctionToolCall`

    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 object { id, code_interpreter, type }`

      Details of the Code Interpreter tool call the run step was involved in.

      - `id: string`

        The ID of the tool call.

      - `code_interpreter: object { input, outputs }`

        The Code Interpreter tool call definition.

        - `input: string`

          The input to the Code Interpreter tool call.

        - `outputs: array of CodeInterpreterLogOutput { logs, type }  or CodeInterpreterImageOutput { image, type }`

          The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type.

          - `CodeInterpreterLogOutput object { logs, type }`

            Text output from the Code Interpreter tool call as part of a run step.

            - `logs: string`

              The text output from the Code Interpreter tool call.

            - `type: "logs"`

              Always `logs`.

              - `"logs"`

          - `CodeInterpreterImageOutput object { image, type }`

            - `image: object { file_id }`

              - `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 object { id, file_search, type }`

      - `id: string`

        The ID of the tool call object.

      - `file_search: object { ranking_options, results }`

        For now, this is always going to be an empty object.

        - `ranking_options: optional object { ranker, score_threshold }`

          The ranking options for the file search.

          - `ranker: "auto" or "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.

        - `results: optional array of object { file_id, file_name, score, content }`

          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.

          - `content: optional array of object { text, type }`

            The content of the result that was found. The content is only included if requested via the include query parameter.

            - `text: optional string`

              The text content of the file.

            - `type: optional "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 object { id, function, type }`

      - `id: string`

        The ID of the tool call object.

      - `function: object { arguments, name, output }`

        The definition of the function that was called.

        - `arguments: string`

          The arguments passed to the function.

        - `name: string`

          The name of the function.

        - `output: string or 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"`
