> ## Documentation Index
> Fetch the complete documentation index at: https://oma-codex-339-workspace-permissions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建消息

> 通过 OMA API 创建消息。

<Info>OMA 会将请求转发到已配置的模型上游；可用的 Beta 字段取决于该上游。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json post /v1/messages
openapi: 3.1.0
info:
  title: OMA API 参考
  version: 1.0.0
  description: Open Managed Agents 应用 API 参考。
servers:
  - url: http://localhost:38080
    description: 本地 OMA 服务器
security:
  - omaApiKey: []
  - omaBearer: []
paths:
  /v1/messages:
    post:
      summary: 创建消息
      description: 通过 OMA API 创建消息。
      operationId: beta_messages_post
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: anthropic-beta
          in: header
          required: false
          schema:
            type: string
            items:
              type: string
            description: |-
              用于指定要使用的 beta 版本的可选请求头。

              要使用多个 beta，请使用逗号分隔的列表（如 `beta1,beta2`），或为每个 beta 分别指定该请求头。
            title: Anthropic-Beta
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: 用于指定一个或多个 Beta 版本的可选请求头。
              items:
                $ref: '#/components/schemas/AnthropicBeta'
          description: |-
            用于指定要使用的 beta 版本的可选请求头。

            要使用多个 beta，请使用逗号分隔的列表（如 `beta1,beta2`），或为每个 beta 分别指定该请求头。
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
            description: |-
              你想使用的 OMA API 版本。

              在此处阅读更多关于版本控制和我们版本历史的信息。
            title: Anthropic-Version
          description: |-
            你想使用的 OMA API 版本。

            在此处阅读更多关于版本控制和我们版本历史的信息。
        - name: anthropic-user-profile-id
          in: header
          required: false
          schema:
            type: string
            description: 用于归属此请求的用户资料 ID。在代表你的组织以外的当事方行事时使用。需要 `user-profiles` Beta 请求头。
            title: Anthropic-User-Profile-Id
            x-stainless-param: user_profile_id
          description: 用于归属此请求的用户资料 ID。在代表你的组织以外的当事方行事时使用。需要 `user-profiles` Beta 请求头。
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BetaCreateMessageParams'
        required: true
      responses:
        '200':
          description: 消息对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaMessage'
        4XX:
          description: |-
            错误响应。

            详见我们的错误文档。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
components:
  schemas:
    BetaCreateMessageParams:
      additionalProperties: false
      example:
        max_tokens: 1024
        messages:
          - content: Hello, world
            role: user
        model: claude-opus-4-6
      properties:
        model:
          $ref: '#/components/schemas/Model'
        messages:
          description: >-
            输入消息。


            我们的模型经过训练，会在交替的 `user` 和 `assistant` 对话轮次上进行工作。创建新的 `Message` 时，你通过
            `messages` 参数指定先前的对话轮次，模型随后会生成对话中的下一个 `Message`。请求中连续的 `user` 或
            `assistant` 轮次会被合并为一个轮次。


            每条输入消息都必须是一个包含 `role` 和 `content` 的对象。你可以指定一条 `user` 角色的消息，也可以包含多条
            `user` 和 `assistant` 消息。


            如果最后一条消息使用 `assistant` 角色，响应内容将从该消息的内容直接继续。这可用于约束模型响应的部分内容。


            单条 `user` 消息示例：


            ```json

            [{"role": "user", "content": "Hello, the model"}]

            ```


            多个对话轮次示例：


            ```json

            [
              {"role": "user", "content": "Hello there."},
              {"role": "assistant", "content": "Hi, I'm the model. How can I help you?"},
              {"role": "user", "content": "Can you explain LLMs in plain English?"},
            ]

            ```


            模型部分填写的响应示例：


            ```json

            [
              {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
              {"role": "assistant", "content": "The best answer is ("},
            ]

            ```


            每条输入消息的 `content` 可以是单个 `string`，也可以是内容块数组，其中每个块都有特定的 `type`。对
            `content` 使用 `string` 是包含一个 `"text"` 类型内容块的数组的简写形式。以下输入消息是等价的：


            ```json

            {"role": "user", "content": "Hello, the model"}

            ```


            ```json

            {"role": "user", "content": [{"type": "text", "text": "Hello, the
            model"}]}

            ```


            参见输入示例。


            请注意，如果你想包含系统提示词，可以使用顶层的 `system` 参数——消息 API 的输入消息中没有 `"system"` 角色。


            单个请求最多允许 100,000 条消息。
          items:
            $ref: '#/components/schemas/BetaInputMessage'
          title: 消息
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 顶层缓存控制会自动将 cache_control 标记应用于请求中最后一个可缓存的块。
          title: 缓存控制
        container:
          anyOf:
            - $ref: '#/components/schemas/BetaContainerParams'
            - type: string
            - type: 'null'
          description: 用于跨请求复用的容器标识符。
          title: 容器
        context_management:
          anyOf:
            - $ref: '#/components/schemas/BetaContextManagementConfig'
            - type: 'null'
          description: |-
            上下文管理配置。

            它允许你控制模型如何在多个请求之间管理上下文，例如是否清除函数结果。
        diagnostics:
          anyOf:
            - $ref: '#/components/schemas/BetaDiagnosticsParam'
            - type: 'null'
          description: >-
            请求级诊断信息。提供 `previous_message_id` 后，响应将包含
            `diagnostics.cache_miss_reason`，说明提示缓存与该先前请求之间的任何差异。
        fallback_credit_token:
          anyOf:
            - maxLength: 2048
              minLength: 1
              type: string
            - $ref: '#/components/schemas/BetaFallbackCreditTokenParam'
            - type: 'null'
          description: >-
            来自先前拒绝的 `stop_details` 中的 `fallback_credit_token`。


            当前序请求被拒绝并返回了 `fallback_credit_token`
            时，在重试中通过此处传入该代码，使重试中针对被拒绝模型上已预热前缀的缓存创建令牌按缓存读取费率计费。必须由相同的组织和工作区使用相同的请求正文兑换（可选地追加一条
            `assistant` 消息进行扩展，其内容为部分文本——最终 text 块末尾的空白已被去除——以及拒绝前流式输出的配对
            server-tool 块；设置了 `output_format` 或强制 `tool_choice`
            的请求不能使用追加助手的形式），在符合条件的 fallback 模型上、在相同的 platform 上、且在拒绝发生 5
            分钟内完成；不匹配则为 400。在 server-tool
            循环中途签发且其部分内容可续写的令牌，只能以追加助手的形式兑换——如果完全同正文的重试被 400
            拒绝并提示必须通过继续部分响应来兑换该令牌，则改用追加助手的形式重试。


            当在通常禁止助手回合 prefill 的模型上使用追加助手的形式时，该令牌还会授权该次 prefill。
          title: 回退额度令牌
        fallbacks:
          anyOf:
            - items:
                $ref: '#/components/schemas/BetaFallbackConfigV2'
              maxItems: 3
              minItems: 1
              type: array
            - const: default
              type: string
              title: 默认回退配置
              x-stainless-variantName: Default
            - type: 'null'
          description: >-
            可选启用的服务端重试：当所请求的模型出于策略原因拒绝时，改用一个或多个替代模型重试。按顺序尝试：如果第一个条目也被拒绝，则尝试第二个，依此类推。字符串
            "default" 表示请求使用所请求模型的服务端定义的默认回退配置。
          title: 回退配置
        inference_geo:
          anyOf:
            - type: string
            - type: 'null'
          description: 指定推理处理所使用的地理区域。未指定时，使用工作区的 `default_inference_geo`。
          title: 推理区域
        max_tokens:
          description: |-
            停止前最多生成的令牌数。

            请注意，模型可能在达到该上限_之前_停止。此参数只指定要生成的令牌的绝对上限。

            设为 `0` 可在不生成响应的情况下填充提示缓存。

            不同模型的此参数最大值不同。请参阅[模型列表](/docs/zh/api/models/list-models)。
          examples:
            - 1024
          minimum: 0
          title: 最大令牌数
          type: integer
        mcp_servers:
          description: 本次请求中要使用的 MCP 服务器
          items:
            $ref: '#/components/schemas/BetaRequestMCPServerURLDefinition'
          maxItems: 20
          title: MCP 服务器
          type: array
        metadata:
          $ref: '#/components/schemas/BetaMetadata'
          description: 描述请求元数据的对象。
        output_config:
          $ref: '#/components/schemas/BetaOutputConfig'
          description: 模型输出的配置选项，例如输出格式。
        output_format:
          anyOf:
            - $ref: '#/components/schemas/BetaJsonOutputFormat'
            - type: 'null'
          deprecated: true
          description: |-
            已弃用：请改用 `output_config.format`。参见结构化输出。

            用于指定模型响应的输出格式架构。该参数将在未来版本中移除。
        service_tier:
          description: |-
            决定该请求使用优先容量（如可用）还是标准容量。

            OMA 为你的 API 请求提供不同级别的服务。详见 service-tiers。
          enum:
            - auto
            - standard_only
          title: 服务层级
          type: string
        speed:
          anyOf:
            - $ref: '#/components/schemas/BetaSpeed'
            - type: 'null'
          description: 此请求的推理速度模式。`"fast"` 启用每秒高输出令牌数的推理。
        stop_sequences:
          description: >-
            会使模型停止生成的自定义文本序列。


            我们的模型通常会在自然完成回合时停止，此时响应的 `stop_reason` 为 `"end_turn"`。


            如果你希望模型在遇到自定义文本序列时停止生成，可以使用 `stop_sequences` 参数。如果模型遇到其中一个自定义序列，响应的
            `stop_reason` 值将为 `"stop_sequence"`，响应的 `stop_sequence`
            值将包含匹配到的停止序列。
          items:
            type: string
          title: 停止序列
          type: array
        stream:
          description: |-
            是否使用服务器发送事件增量流式返回响应。

            详情请参阅 streaming。
          title: 流式传输
          type: boolean
          example: false
        system:
          anyOf:
            - type: string
              x-stainless-skip:
                - go
            - items:
                $ref: '#/components/schemas/BetaRequestTextBlock'
              type: array
          description: |-
            系统提示词。

            系统提示词用于向模型提供上下文和指令，例如指定特定的目标或角色。请参阅我们的系统提示词指南。
          examples:
            - - text: Today's date is 2024-06-01.
                type: text
            - Today's date is 2023-01-01.
          title: 系统指令
        temperature:
          deprecated: true
          description: >-
            注入到响应中的随机程度。


            默认为 `1.0`。取值范围为 `0.0` 到 `1.0`。分析 / 多选类任务建议使用更接近 `0.0` 的
            `temperature`，创意和生成类任务建议使用更接近 `1.0` 的值。


            请注意，即使 `temperature` 为 `0.0`，结果也不会完全确定。
          examples:
            - 1
          maximum: 1
          minimum: 0
          title: 温度
          type: number
          x-stainless-deprecation-message: 已弃用。Opus 4.6 之后发布的模型不支持设置 temperature。为保持向后兼容，仍接受 1.0；其他值将返回 400 错误。
        thinking:
          $ref: '#/components/schemas/BetaThinkingConfigParam'
        tool_choice:
          $ref: '#/components/schemas/BetaToolChoice'
        tools:
          description: >+
            模型可以使用的工具的定义。


            如果你在 API 请求中包含 `tools`，模型可能会返回表示模型使用这些工具的 `tool_use`
            内容块。你可以使用模型生成的工具输入来运行这些工具，然后可以选择通过 `tool_result` 内容块将结果返回给模型。


            工具有两种类型：**客户端工具**和**服务器工具**。下面描述的行为适用于客户端工具。服务器工具请参见各自的文档，因为每种工具都有自己的行为（例如
            web 搜索工具）。


            每个工具定义包含：


            * `name`：工具的名称。

            * `description`：可选但强烈建议提供的工具描述。

            * `input_schema`：模型将在 `tool_use` 输出内容块中生成的工具 `input` 结构的 [JSON
            架构](https://json-schema.org/draft/2020-12)。


            例如，如果你将 `tools` 定义为：


            ```json

            [
              {
                "name": "get_stock_price",
                "description": "Get the current stock price for a given ticker symbol.",
                "input_schema": {
                  "type": "object",
                  "properties": {
                    "ticker": {
                      "type": "string",
                      "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
                    }
                  },
                  "required": ["ticker"]
                }
              }
            ]

            ```


            然后询问模型 "What's the S&P 500 at today?"，模型可能会在响应中生成如下 `tool_use` 内容块：


            ```json

            [
              {
                "type": "tool_use",
                "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
                "name": "get_stock_price",
                "input": { "ticker": "^GSPC" }
              }
            ]

            ```


            随后你可以使用 `{"ticker": "^GSPC"}` 作为输入来运行你的 `get_stock_price` 工具，并在后续的
            `user` 消息中将以下内容返回给模型：


            ```json

            [
              {
                "type": "tool_result",
                "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
                "content": "259.75 USD"
              }
            ]

            ```


            工具可用于包含运行客户端工具和函数的工作流，或者更普遍地说，每当你希望模型生成特定 JSON 结构的输出时都可以使用。

          examples:
            - description: 获取给定位置的当前天气
              input_schema:
                properties:
                  location:
                    description: 城市与州，例如 San Francisco, CA
                    type: string
                  unit:
                    description: 输出的单位 - (celsius, fahrenheit) 之一
                    type: string
                required:
                  - location
                type: object
              name: get_weather
          items:
            oneOf:
              - $ref: '#/components/schemas/BetaTool'
              - $ref: '#/components/schemas/BetaBashTool_20241022'
              - $ref: '#/components/schemas/BetaBashTool_20250124'
              - $ref: '#/components/schemas/BetaCodeExecutionTool_20250522'
              - $ref: '#/components/schemas/BetaCodeExecutionTool_20250825'
              - $ref: '#/components/schemas/BetaCodeExecutionTool_20260120'
              - $ref: '#/components/schemas/BetaCodeExecutionTool_20260521'
              - $ref: '#/components/schemas/BetaComputerUseTool_20241022'
              - $ref: '#/components/schemas/BetaMemoryTool_20250818'
              - $ref: '#/components/schemas/BetaComputerUseTool_20250124'
              - $ref: '#/components/schemas/BetaTextEditor_20241022'
              - $ref: '#/components/schemas/BetaComputerUseTool_20251124'
              - $ref: '#/components/schemas/BetaTextEditor_20250124'
              - $ref: '#/components/schemas/BetaTextEditor_20250429'
              - $ref: '#/components/schemas/BetaTextEditor_20250728'
              - $ref: '#/components/schemas/BetaWebSearchTool_20250305'
              - $ref: '#/components/schemas/BetaWebFetchTool_20250910'
              - $ref: '#/components/schemas/BetaWebSearchTool_20260209'
              - $ref: '#/components/schemas/BetaWebFetchTool_20260209'
              - $ref: '#/components/schemas/BetaWebFetchTool_20260309'
              - $ref: '#/components/schemas/BetaWebSearchTool_20260318'
              - $ref: '#/components/schemas/BetaWebFetchTool_20260318'
              - $ref: '#/components/schemas/BetaAdvisorTool_20260301'
              - $ref: '#/components/schemas/BetaToolSearchToolBM25_20251119'
              - $ref: '#/components/schemas/BetaToolSearchToolRegex_20251119'
              - $ref: '#/components/schemas/BetaMCPToolset'
          title: 工具
          type: array
        top_k:
          deprecated: true
          description: >-
            对每个后续令牌仅从概率最高的 K 个选项中采样。


            用于消除"长尾"低概率响应。[在此了解更多技术细节](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277)。


            仅建议高级用例使用。
          examples:
            - 5
          minimum: 0
          title: Top K
          type: integer
          x-stainless-deprecation-message: 已弃用。Opus 4.6 之后发布的模型不接受 top_k；设置任何值都会返回 400 错误。
        top_p:
          deprecated: true
          description: |-
            使用核采样。

            在核采样中，我们按概率从高到低对每个后续令牌的所有选项计算累积分布，并在达到由 `top_p` 指定的特定概率时截断。

            仅建议高级用例使用。
          examples:
            - 0.7
          maximum: 1
          minimum: 0
          title: Top P
          type: number
          x-stainless-deprecation-message: >-
            已弃用。Opus 4.6 之后发布的模型不支持设置 top_p。为保持向后兼容，仍接受大于或等于 0.99 的值；其他值将返回 400
            错误。
      required:
        - model
        - messages
        - max_tokens
      title: CreateMessageParams
      type: object
    BetaMessage:
      examples:
        - content:
            - citations: null
              text: 你好！我是你的智能助手。
              type: text
          id: msg_013Zva2CMHLNnXjNJJKqJ2EF
          model: claude-opus-4-6
          role: assistant
          stop_details: null
          stop_reason: end_turn
          stop_sequence: null
          type: message
          usage:
            input_tokens: 2095
            output_tokens: 503
      properties:
        id:
          description: |-
            唯一的对象标识符。

            ID 的格式和长度可能会随时间变化。
          examples:
            - msg_013Zva2CMHLNnXjNJJKqJ2EF
          title: ID
          type: string
        type:
          const: message
          default: message
          description: |-
            对象类型。

            对于消息，此值始终为 `"message"`。
          title: 类型
          type: string
        role:
          const: assistant
          default: assistant
          description: |-
            所生成消息的对话角色。

            该值始终为 `"assistant"`。
          title: 角色
          type: string
        content:
          description: >-
            模型生成的内容。


            这是一个内容块数组，每个块都有一个决定其结构的 `type`。


            示例：


            ```json

            [{"type": "text", "text": "Hi, I'm the model."}]

            ```


            如果请求输入的 `messages` 以一个 `assistant` 回合结尾，则响应的 `content`
            会直接从最后一个回合继续。你可以利用这一点来约束模型的输出。


            例如，如果输入的 `messages` 为：

            ```json

            [
              {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"},
              {"role": "assistant", "content": "The best answer is ("}
            ]

            ```


            那么响应的 `content` 可能为：


            ```json

            [{"type": "text", "text": "B)"}]

            ```
          examples:
            - - citations: null
                text: 你好！我是你的智能助手。
                type: text
          items:
            $ref: '#/components/schemas/BetaContentBlock'
          title: 内容
          type: array
        model:
          $ref: '#/components/schemas/Model'
        stop_reason:
          anyOf:
            - $ref: '#/components/schemas/BetaStopReason'
            - type: 'null'
          description: |-
            停止的原因。

            这可能是以下值之一：
            * `"end_turn"`：模型到达了自然停止点
            * `"max_tokens"`：超出了请求的 `max_tokens` 或模型的最大值
            * `"stop_sequence"`：生成了你提供的某个自定义 `stop_sequences`
            * `"tool_use"`：模型调用了一个或多个工具
            * `"pause_turn"`：我们暂停了一个长时间运行的回合。你可以在后续请求中原样提供该响应，让模型继续。
            * `"refusal"`：流式分类器介入以处理潜在的违反政策行为时
            * `"model_context_window_exceeded"`：超出了模型的上下文窗口

            在非流式模式下，该值始终非 null。在流式模式下，它在 `message_start` 事件中为 null，其他情况下非 null。
          title: 停止原因
        stop_sequence:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: |-
            若有自定义停止序列被生成，指明是哪一个。

            如果生成了你的某个自定义停止序列，该值将为非 null 字符串。
          title: 停止序列
        stop_details:
          anyOf:
            - $ref: '#/components/schemas/BetaRefusalStopDetails'
            - type: 'null'
          default: null
          description: |-
            关于模型输出为何停止的结构化信息。

            当 `stop_reason` 没有更多细节可报告时，该值为 `null`。
        usage:
          $ref: '#/components/schemas/BetaUsage'
          description: >-
            计费与速率限制用量。


            OMA API 按令牌数量计费和限速，因为令牌代表了系统的底层成本。


            在底层，API 会将请求转换为适合模型的格式。模型的输出随后会经过解析阶段，再成为 API 响应。因此，`usage` 中的令牌数与
            API 请求或响应的可见内容不会一一对应。


            例如，即使模型的响应是空字符串，`output_tokens` 也不会为零。


            请求的输入令牌总数是 `input_tokens`、`cache_creation_input_tokens` 与
            `cache_read_input_tokens` 之和。
          examples:
            - input_tokens: 2095
              output_tokens: 503
        diagnostics:
          anyOf:
            - $ref: '#/components/schemas/BetaDiagnostics'
            - type: 'null'
          default: null
          description: 请求级诊断信息。仅当请求中提供了 `diagnostics` 时才会返回；未检测到提示缓存差异时为 `null`。
        context_management:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseContextManagement'
            - type: 'null'
          default: null
          description: |-
            上下文管理响应。

            关于请求期间所应用的上下文管理策略的信息。
        container:
          anyOf:
            - $ref: '#/components/schemas/BetaContainer'
            - type: 'null'
          default: null
          description: |-
            本次请求中所用容器的信息。

            如果使用了容器工具（例如代码执行），则该字段非 null。
      required:
        - id
        - type
        - role
        - content
        - model
        - stop_reason
        - stop_sequence
        - stop_details
        - usage
        - diagnostics
        - context_management
        - container
      title: Message
      type: object
      x-stainless-python-custom-imports:
        - from .beta_content_block import BetaContentBlock as BetaContentBlock
    BetaErrorResponse:
      properties:
        error:
          discriminator:
            mapping:
              api_error:
                $ref: '#/components/schemas/BetaAPIError'
              authentication_error:
                $ref: '#/components/schemas/BetaAuthenticationError'
              billing_error:
                $ref: '#/components/schemas/BetaBillingError'
              invalid_request_error:
                $ref: '#/components/schemas/BetaInvalidRequestError'
              not_found_error:
                $ref: '#/components/schemas/BetaNotFoundError'
              overloaded_error:
                $ref: '#/components/schemas/BetaOverloadedError'
              permission_error:
                $ref: '#/components/schemas/BetaPermissionError'
              rate_limit_error:
                $ref: '#/components/schemas/BetaRateLimitError'
              timeout_error:
                $ref: '#/components/schemas/BetaGatewayTimeoutError'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaInvalidRequestError'
            - $ref: '#/components/schemas/BetaAuthenticationError'
            - $ref: '#/components/schemas/BetaBillingError'
            - $ref: '#/components/schemas/BetaPermissionError'
            - $ref: '#/components/schemas/BetaNotFoundError'
            - $ref: '#/components/schemas/BetaRateLimitError'
            - $ref: '#/components/schemas/BetaGatewayTimeoutError'
            - $ref: '#/components/schemas/BetaAPIError'
            - $ref: '#/components/schemas/BetaOverloadedError'
          title: 错误
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 请求 ID
        type:
          const: error
          default: error
          title: 类型
          type: string
      required:
        - error
        - request_id
        - type
      title: ErrorResponse
      type: object
    Model:
      title: Model
      description: |-
        将完成你的提示的模型。

        更多详情和选项请参阅[模型列表](/docs/zh/api/models/list-models)。
      anyOf:
        - type: string
        - const: claude-sonnet-5
          description: 面向编程与智能体的高性能模型
          x-stainless-nominal: false
        - const: claude-fable-5
          description: 面向最艰难的知识工作与编程问题的下一代智能
          x-stainless-nominal: false
        - const: claude-mythos-5
          description: 网络安全和生物学研究方面能力最强的模型
          x-stainless-nominal: false
        - const: claude-opus-5
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-8
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-7
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-mythos-preview
          description: 新级别的智能，在编程和网络安全方面最强
          x-stainless-nominal: false
          deprecated: true
          x-stainless-deprecation-message: 将于 2026 年 6 月 30 日停止支持。请迁移至 `claude-mythos-5`。
        - const: claude-opus-4-6
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-sonnet-4-6
          description: 速度与智能的最佳组合
          x-stainless-nominal: false
        - const: claude-haiku-4-5
          description: 具备接近前沿智能的最快模型
          x-stainless-nominal: false
        - const: claude-haiku-4-5-20251001
          description: 具备接近前沿智能的最快模型
          x-stainless-nominal: false
        - const: claude-opus-4-5
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-5-20251101
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-sonnet-4-5
          description: 面向智能体与编程的高性能模型
          x-stainless-nominal: false
        - const: claude-sonnet-4-5-20250929
          description: 面向智能体与编程的高性能模型
          x-stainless-nominal: false
    BetaInputMessage:
      additionalProperties: false
      properties:
        content:
          anyOf:
            - type: string
              x-stainless-skip:
                - go
                - cli
            - items:
                $ref: '#/components/schemas/BetaInputContentBlock'
              type: array
              example:
                - type: text
                  text: What is a quaternion?
          title: 内容
        role:
          enum:
            - user
            - assistant
            - system
          title: 角色
          type: string
      required:
        - content
        - role
      title: InputMessage
      type: object
      discriminator:
        propertyName: role
    BetaCacheControlEphemeral:
      additionalProperties: false
      properties:
        ttl:
          description: |-
            缓存控制断点的存活时间。

            可以是以下值之一：
            - `5m`：5 分钟
            - `1h`：1 小时

            默认为 `5m`。请参阅提示缓存说明。
          enum:
            - 5m
            - 1h
          title: TTL
          type: string
          x-stainless-renameMap:
            ttl_5m: 5m
            ttl_1h: 1h
        type:
          const: ephemeral
          title: 类型
          type: string
      required:
        - type
      title: CacheControlEphemeral
      type: object
      x-stainless-go-constant-constructor: true
    BetaContainerParams:
      additionalProperties: false
      description: 包含要加载的技能的容器参数。
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          description: 容器 ID
          title: ID
        skills:
          anyOf:
            - items:
                $ref: '#/components/schemas/BetaSkillParams'
              maxItems: 8
              type: array
            - type: 'null'
          description: 要加载到容器中的技能列表
          title: 技能
      title: ContainerParams
      type: object
    BetaContextManagementConfig:
      additionalProperties: false
      properties:
        edits:
          description: 要应用的上下文管理编辑列表
          items:
            discriminator:
              mapping:
                clear_thinking_20251015:
                  $ref: '#/components/schemas/BetaClearThinking20251015'
                clear_tool_uses_20250919:
                  $ref: '#/components/schemas/BetaClearToolUses20250919'
                compact_20260112:
                  $ref: '#/components/schemas/BetaCompact20260112'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/BetaClearToolUses20250919'
              - $ref: '#/components/schemas/BetaClearThinking20251015'
              - $ref: '#/components/schemas/BetaCompact20260112'
          minItems: 0
          title: 编辑项
          type: array
      title: ContextManagementConfig
      type: object
    BetaDiagnosticsParam:
      additionalProperties: false
      description: |-
        请求级诊断信息。当前携带用于提示缓存差异报告的先前响应
        ID。
      properties:
        previous_message_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          description: >-
            该客户端上一次 /v1/messages 响应中的
            `id`（`msg_...`）。服务器会将该请求的提示指纹与本次请求进行比对，当提示缓存前缀无法复用时返回
            `diagnostics.cache_miss_reason`。首轮请传入 `null`，以在没有可比较的前序消息的情况下启用该功能。
          title: 上一条消息 ID
      title: DiagnosticsParam
      type: object
    BetaFallbackCreditTokenParam:
      additionalProperties: false
      description: |-
        ``fallback_credit_token`` 的对象形式：令牌加上兑换
        模式。

        需要 ``anthropic-beta: fallback-credit-2026-07-01``；没有该
        请求头时，此字段仅接受裸字符串。裸字符串与不带模式的对象
        等价（二者都选择 ``strict``），因此把现有令牌包装成对象
        本身不会改变任何行为。
      properties:
        mode:
          description: >-
            失败的令牌对重试的影响。`strict`（默认值，也是裸字符串形式的行为）：兑换失败会返回
            400，不提供重试。`best_effort`：无论如何都会提供重试——令牌层面的失败不再拒绝请求；重试按正常价格继续，结果会报告在响应的
            `usage.fallback_credit` 中。两种失败在两种模式下都仍然是硬性错误：格式错误的令牌，以及将
            `fallback_credit_token` 与 `fallbacks` 组合使用。
          enum:
            - strict
            - best_effort
          title: 模式
          type: string
        token:
          description: >-
            来自先前拒绝响应的 `stop_details` 中的不透明 `fallback_credit_token` ——
            与裸字符串形式所携带的字符串相同。
          maxLength: 2048
          minLength: 1
          title: 令牌
          type: string
      required:
        - token
      title: FallbackCreditTokenParam
      type: object
    BetaFallbackConfigV2:
      additionalProperties: true
      description: |-
        `/v1/messages` 请求中 `fallbacks` 链的一个条目。

        `model` 为必填。覆盖字段（`max_tokens`、`thinking`、
        `output_config` 和 `speed`）仅针对本次尝试设置相应参数，并按照请求发往 `model` 的标准进行校验。
        其他任何键都会在解析时被拒绝。
      properties:
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: 最大令牌数
        model:
          $ref: '#/components/schemas/Model'
        output_config:
          anyOf:
            - $ref: '#/components/schemas/BetaOutputConfig'
            - type: 'null'
        speed:
          anyOf:
            - $ref: '#/components/schemas/BetaSpeed'
            - type: 'null'
        thinking:
          anyOf:
            - discriminator:
                mapping:
                  adaptive:
                    $ref: '#/components/schemas/BetaThinkingConfigAdaptive'
                  disabled:
                    $ref: '#/components/schemas/BetaThinkingConfigDisabled'
                  enabled:
                    $ref: '#/components/schemas/BetaThinkingConfigEnabled'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaThinkingConfigEnabled'
                - $ref: '#/components/schemas/BetaThinkingConfigDisabled'
                - $ref: '#/components/schemas/BetaThinkingConfigAdaptive'
            - type: 'null'
          title: 思考
      required:
        - model
      title: FallbackConfigV2
      type: object
    BetaRequestMCPServerURLDefinition:
      additionalProperties: false
      properties:
        authorization_token:
          anyOf:
            - type: string
            - type: 'null'
          title: 授权令牌
        name:
          title: 名称
          type: string
        tool_configuration:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestMCPServerToolConfiguration'
            - type: 'null'
        type:
          const: url
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - name
        - type
        - url
      title: RequestMCPServerURLDefinition
      type: object
    BetaMetadata:
      additionalProperties: false
      properties:
        user_id:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          description: >-
            与该请求关联的用户的外部标识符。


            该值应为 uuid、哈希值或其他不透明标识符。OMA 可能使用此 ID
            协助检测滥用行为。不要包含任何可识别身份的信息，例如姓名、电子邮件地址或电话号码。
          examples:
            - 13803d75-b4b5-4c3e-b2a2-6f21399b021b
          title: 用户 ID
      title: Metadata
      type: object
    BetaOutputConfig:
      additionalProperties: false
      properties:
        effort:
          anyOf:
            - $ref: '#/components/schemas/BetaEffortLevel'
            - type: 'null'
          description: |-
            模型应在其响应中投入的努力程度。更高的努力程度可能带来更深入的分析，但耗时更长。

            有效值为 `low`、`medium`、`high`、`xhigh` 或 `max`。
        format:
          anyOf:
            - $ref: '#/components/schemas/BetaJsonOutputFormat'
            - type: 'null'
          description: 用于指定模型响应的输出格式架构。参见结构化输出
        task_budget:
          anyOf:
            - $ref: '#/components/schemas/BetaTokenTaskBudget'
            - type: 'null'
          description: 跨上下文的令牌预算跟踪配置。
      title: OutputConfig
      type: object
    BetaJsonOutputFormat:
      additionalProperties: false
      properties:
        schema:
          additionalProperties: true
          description: 格式的 JSON 架构
          title: 架构
          type: object
        type:
          const: json_schema
          title: 类型
          type: string
      required:
        - schema
        - type
      title: JsonOutputFormat
      type: object
    BetaSpeed:
      type: string
      description: 推理速度模式。`fast` 以较高价格提供显著更快的输出令牌生成速度。并非所有模型都支持 `fast`；无效组合会在创建时被拒绝。
      enum:
        - standard
        - fast
    BetaRequestTextBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - items:
                discriminator:
                  mapping:
                    char_location:
                      $ref: '#/components/schemas/BetaRequestCharLocationCitation'
                    content_block_location:
                      $ref: >-
                        #/components/schemas/BetaRequestContentBlockLocationCitation
                    page_location:
                      $ref: '#/components/schemas/BetaRequestPageLocationCitation'
                    search_result_location:
                      $ref: >-
                        #/components/schemas/BetaRequestSearchResultLocationCitation
                    web_search_result_location:
                      $ref: >-
                        #/components/schemas/BetaRequestWebSearchResultLocationCitation
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/BetaRequestCharLocationCitation'
                  - $ref: '#/components/schemas/BetaRequestPageLocationCitation'
                  - $ref: >-
                      #/components/schemas/BetaRequestContentBlockLocationCitation
                  - $ref: >-
                      #/components/schemas/BetaRequestWebSearchResultLocationCitation
                  - $ref: >-
                      #/components/schemas/BetaRequestSearchResultLocationCitation
              type: array
            - type: 'null'
          title: 引用
        text:
          minLength: 1
          title: 文本
          type: string
        type:
          const: text
          title: 类型
          type: string
      required:
        - text
        - type
      title: RequestTextBlock
      type: object
    BetaThinkingConfigParam:
      description: >-
        用于启用模型扩展思考的配置。


        启用后，响应中会包含 `thinking` 内容块，展示模型在给出最终答案之前的思考过程。至少需要 1,024 个令牌的预算，并计入你的
        `max_tokens` 限制。


        详见扩展思考。
      discriminator:
        mapping:
          adaptive:
            $ref: '#/components/schemas/BetaThinkingConfigAdaptive'
          disabled:
            $ref: '#/components/schemas/BetaThinkingConfigDisabled'
          enabled:
            $ref: '#/components/schemas/BetaThinkingConfigEnabled'
        propertyName: type
      examples:
        - type: adaptive
      oneOf:
        - $ref: '#/components/schemas/BetaThinkingConfigEnabled'
        - $ref: '#/components/schemas/BetaThinkingConfigDisabled'
        - $ref: '#/components/schemas/BetaThinkingConfigAdaptive'
      title: Thinking
    BetaToolChoice:
      description: 模型应如何使用所提供的工具。模型可以使用特定工具、任意可用工具、自行决定，或完全不使用工具。
      discriminator:
        mapping:
          any:
            $ref: '#/components/schemas/BetaToolChoiceAny'
          auto:
            $ref: '#/components/schemas/BetaToolChoiceAuto'
          none:
            $ref: '#/components/schemas/BetaToolChoiceNone'
          tool:
            $ref: '#/components/schemas/BetaToolChoiceTool'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/BetaToolChoiceAuto'
        - $ref: '#/components/schemas/BetaToolChoiceAny'
        - $ref: '#/components/schemas/BetaToolChoiceTool'
        - $ref: '#/components/schemas/BetaToolChoiceNone'
      title: Tool Choice
    BetaTool:
      additionalProperties: false
      properties:
        type:
          anyOf:
            - type: 'null'
            - const: custom
              type: string
          title: 类型
        description:
          description: >-
            对该工具功能的描述。


            工具描述应尽可能详尽。模型掌握的关于该工具是什么以及如何使用它的信息越多，其表现就越好。你可以使用自然语言描述来强调工具输入 JSON
            架构的重要方面。
          examples:
            - 获取指定位置的当前天气
          title: 描述
          type: string
        name:
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          maxLength: 128
          minLength: 1
          pattern: ^[a-zA-Z0-9_-]{1,128}$
          title: 名称
          type: string
        input_schema:
          $ref: '#/components/schemas/BetaInputSchema'
          description: |-
            此工具输入的 [JSON 架构](https://json-schema.org/draft/2020-12)。

            它定义了你的工具所接受、且模型将生成的 `input` 的结构。
          examples:
            - properties:
                location:
                  description: 城市与州，例如 San Francisco, CA
                  type: string
                unit:
                  description: 输出的单位 - (celsius, fahrenheit) 之一
                  type: string
              required:
                - location
              type: object
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        eager_input_streaming:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            为该工具启用即时输入流式传输。为 true 时，工具的输入参数会在生成时增量流式传输，类型即时推断，而不是缓冲完整的 JSON 输出。为
            false 时，即使 fine-grained-tool-streaming beta 已启用，该工具也禁用流式传输。为
            null（默认）时，使用基于 beta 请求头的默认行为。
          title: 提前流式传输输入
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
      required:
        - name
        - input_schema
      title: Tool
      type: object
    BetaBashTool_20241022:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: bash
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: bash_20241022
          title: 类型
          type: string
      required:
        - name
        - type
      title: BashTool_20241022
      type: object
    BetaBashTool_20250124:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: bash
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: bash_20250124
          title: 类型
          type: string
      required:
        - name
        - type
      title: BashTool_20250124
      type: object
    BetaCodeExecutionTool_20250522:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: code_execution
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: code_execution_20250522
          title: 类型
          type: string
      required:
        - name
        - type
      title: CodeExecutionTool_20250522
      type: object
    BetaCodeExecutionTool_20250825:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: code_execution
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: code_execution_20250825
          title: 类型
          type: string
      required:
        - name
        - type
      title: CodeExecutionTool_20250825
      type: object
    BetaCodeExecutionTool_20260120:
      additionalProperties: false
      description: 支持 REPL 状态持久化的代码执行工具（daemon 模式 + gVisor checkpoint）。
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: code_execution
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: code_execution_20260120
          title: 类型
          type: string
      required:
        - name
        - type
      title: CodeExecutionTool_20260120
      type: object
    BetaCodeExecutionTool_20260521:
      additionalProperties: false
      description: 支持 REPL 状态持久化的代码执行工具。
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: code_execution
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: code_execution_20260521
          title: 类型
          type: string
      required:
        - name
        - type
      title: CodeExecutionTool_20260521
      type: object
    BetaComputerUseTool_20241022:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        display_height_px:
          description: 显示区域的高度（像素）。
          minimum: 1
          title: 显示高度（像素）
          type: integer
        display_number:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          description: 该显示器的 X11 显示编号（例如 0、1）。
          title: 显示器编号
        display_width_px:
          description: 显示区域的宽度（像素）。
          minimum: 1
          title: 显示宽度（像素）
          type: integer
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: computer
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: computer_20241022
          title: 类型
          type: string
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      title: ComputerUseTool_20241022
      type: object
    BetaMemoryTool_20250818:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: memory
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: memory_20250818
          title: 类型
          type: string
      required:
        - name
        - type
      title: MemoryTool_20250818
      type: object
    BetaComputerUseTool_20250124:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        display_height_px:
          description: 显示区域的高度（像素）。
          minimum: 1
          title: 显示高度（像素）
          type: integer
        display_number:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          description: 该显示器的 X11 显示编号（例如 0、1）。
          title: 显示器编号
        display_width_px:
          description: 显示区域的宽度（像素）。
          minimum: 1
          title: 显示宽度（像素）
          type: integer
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: computer
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: computer_20250124
          title: 类型
          type: string
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      title: ComputerUseTool_20250124
      type: object
    BetaTextEditor_20241022:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: str_replace_editor
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: text_editor_20241022
          title: 类型
          type: string
      required:
        - name
        - type
      title: TextEditor_20241022
      type: object
    BetaComputerUseTool_20251124:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        display_height_px:
          description: 显示区域的高度（像素）。
          minimum: 1
          title: 显示高度（像素）
          type: integer
        display_number:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          description: 该显示器的 X11 显示编号（例如 0、1）。
          title: 显示器编号
        display_width_px:
          description: 显示区域的宽度（像素）。
          minimum: 1
          title: 显示宽度（像素）
          type: integer
        enable_zoom:
          description: 是否启用对屏幕进行放大截图的操作。
          title: 启用缩放
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: computer
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: computer_20251124
          title: 类型
          type: string
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      title: ComputerUseTool_20251124
      type: object
    BetaTextEditor_20250124:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: str_replace_editor
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: text_editor_20250124
          title: 类型
          type: string
      required:
        - name
        - type
      title: TextEditor_20250124
      type: object
    BetaTextEditor_20250429:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        name:
          const: str_replace_based_edit_tool
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: text_editor_20250429
          title: 类型
          type: string
      required:
        - name
        - type
      title: TextEditor_20250429
      type: object
    BetaTextEditor_20250728:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        input_examples:
          items:
            additionalProperties:
              $ref: '#/components/schemas/BetaJsonValue'
            type: object
          title: 输入示例
          type: array
        max_characters:
          anyOf:
            - minimum: 1
              type: integer
            - type: 'null'
          description: 查看文件时显示的最大字符数。未指定时，默认显示完整文件。
          title: 最大字符数
        name:
          const: str_replace_based_edit_tool
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: text_editor_20250728
          title: 类型
          type: string
      required:
        - name
        - type
      title: TextEditor_20250728
      type: object
    BetaWebSearchTool_20250305:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，结果中将只包含这些域名。不能与 `blocked_domains` 同时使用。
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，这些域名将不会出现在结果中。不能与 `allowed_domains` 同时使用。
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_search
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_search_20250305
          title: 类型
          type: string
        user_location:
          anyOf:
            - $ref: '#/components/schemas/BetaUserLocation'
            - type: 'null'
          description: 用户位置的参数。用于提供更相关的搜索结果。
      required:
        - name
        - type
      title: WebSearchTool_20250305
      type: object
    BetaWebFetchTool_20250910:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 允许抓取的域名列表
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 禁止抓取的域名列表
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCitationsConfig'
            - type: 'null'
          description: 已获取文档的引用配置。引用默认禁用。
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_content_tokens:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 将网页文本内容纳入上下文所使用的最大令牌数。该限制是近似的，且不适用于 PDF 等二进制内容。
          title: 最大内容令牌数
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_fetch
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_fetch_20250910
          title: 类型
          type: string
      required:
        - name
        - type
      title: WebFetchTool_20250910
      type: object
    BetaWebSearchTool_20260209:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，结果中将只包含这些域名。不能与 `blocked_domains` 同时使用。
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，这些域名将不会出现在结果中。不能与 `allowed_domains` 同时使用。
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_search
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_search_20260209
          title: 类型
          type: string
        user_location:
          anyOf:
            - $ref: '#/components/schemas/BetaUserLocation'
            - type: 'null'
          description: 用户位置的参数。用于提供更相关的搜索结果。
      required:
        - name
        - type
      title: WebSearchTool_20260209
      type: object
    BetaWebFetchTool_20260209:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 允许抓取的域名列表
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 禁止抓取的域名列表
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCitationsConfig'
            - type: 'null'
          description: 已获取文档的引用配置。引用默认禁用。
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_content_tokens:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 将网页文本内容纳入上下文所使用的最大令牌数。该限制是近似的，且不适用于 PDF 等二进制内容。
          title: 最大内容令牌数
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_fetch
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_fetch_20260209
          title: 类型
          type: string
      required:
        - name
        - type
      title: WebFetchTool_20260209
      type: object
    BetaWebFetchTool_20260309:
      additionalProperties: false
      description: 带有 use_cache 参数用于绕过缓存内容的网页抓取工具。
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 允许抓取的域名列表
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 禁止抓取的域名列表
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCitationsConfig'
            - type: 'null'
          description: 已获取文档的引用配置。引用默认禁用。
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_content_tokens:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 将网页文本内容纳入上下文所使用的最大令牌数。该限制是近似的，且不适用于 PDF 等二进制内容。
          title: 最大内容令牌数
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_fetch
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_fetch_20260309
          title: 类型
          type: string
        use_cache:
          description: 是否使用缓存内容。设为 false 可绕过缓存并获取最新内容。仅当用户明确要求最新内容或抓取快速变化的来源时才设为 false。
          title: 使用缓存
          type: boolean
      required:
        - name
        - type
      title: WebFetchTool_20260309
      type: object
    BetaWebSearchTool_20260318:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，结果中将只包含这些域名。不能与 `blocked_domains` 同时使用。
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 若提供，这些域名将不会出现在结果中。不能与 `allowed_domains` 同时使用。
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_search
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        response_inclusion:
          description: >-
            当本工具的结果在同一轮中被一次已完成的 code_execution 调用消费时，其结果块在 API 响应中的呈现方式。'full'
            返回完整内容（默认）。'excluded' 完全丢弃嵌套的 server_tool_use
            与结果块对。来自直接调用的结果，或来自完成前被暂停的 code_execution 调用的结果，始终完整返回，以便在下一轮传回。
          enum:
            - full
            - excluded
          title: 响应包含方式
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_search_20260318
          title: 类型
          type: string
        user_location:
          anyOf:
            - $ref: '#/components/schemas/BetaUserLocation'
            - type: 'null'
          description: 用户位置的参数。用于提供更相关的搜索结果。
      required:
        - name
        - type
      title: WebSearchTool_20260318
      type: object
    BetaWebFetchTool_20260318:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        allowed_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 允许抓取的域名列表
          title: 允许的域名
        blocked_domains:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 禁止抓取的域名列表
          title: 阻止的域名
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCitationsConfig'
            - type: 'null'
          description: 已获取文档的引用配置。引用默认禁用。
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_content_tokens:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 将网页文本内容纳入上下文所使用的最大令牌数。该限制是近似的，且不适用于 PDF 等二进制内容。
          title: 最大内容令牌数
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        name:
          const: web_fetch
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        response_inclusion:
          description: >-
            当本工具的结果在同一轮中被一次已完成的 code_execution 调用消费时，其结果块在 API 响应中的呈现方式。'full'
            返回完整内容（默认）。'excluded' 完全丢弃嵌套的 server_tool_use
            与结果块对。来自直接调用的结果，或来自完成前被暂停的 code_execution 调用的结果，始终完整返回，以便在下一轮传回。
          enum:
            - full
            - excluded
          title: 响应包含方式
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: web_fetch_20260318
          title: 类型
          type: string
        use_cache:
          description: 是否使用缓存内容。设为 false 可绕过缓存并获取最新内容。仅当用户明确要求最新内容或抓取快速变化的来源时才设为 false。
          title: 使用缓存
          type: boolean
      required:
        - name
        - type
      title: WebFetchTool_20260318
      type: object
    BetaAdvisorTool_20260301:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        caching:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: >-
            针对顾问自身提示的缓存。设置后，每次顾问调用都会以给定的 TTL
            写入一个缓存条目，以便同一会话中的后续调用读取稳定前缀。省略时，顾问提示不会被缓存。
          title: 缓存配置
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        max_tokens:
          anyOf:
            - minimum: 1024
              type: integer
            - type: 'null'
          description: >-
            限制顾问每次调用的总输出（思考 + text）。当顾问达到该上限时，返回的 advisor_result 或
            advisor_redacted_result 块会携带 stop_reason='max_tokens'，并在 worker
            模型看到的建议文本末尾追加一条截断说明（在已脱敏模式下位于加密数据块内部）。设置该项时，服务器还会在顾问的提示中发出一个剩余令牌预算块，使顾问自行向该上限收敛。省略时，应用顾问模型的默认输出上限，且不发出预算块。
          title: 最大令牌数
        max_uses:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          description: 工具在 API 请求中可使用的最大次数。
          title: 最大使用次数
        model:
          $ref: '#/components/schemas/Model'
        name:
          const: advisor
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          const: advisor_20260301
          title: 类型
          type: string
      required:
        - model
        - name
        - type
      title: AdvisorTool_20260301
      type: object
    BetaToolSearchToolBM25_20251119:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: tool_search_tool_bm25
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          enum:
            - tool_search_tool_bm25_20251119
            - tool_search_tool_bm25
          title: 类型
          type: string
      required:
        - name
        - type
      title: ToolSearchToolBM25_20251119
      type: object
    BetaToolSearchToolRegex_20251119:
      additionalProperties: false
      properties:
        allowed_callers:
          items:
            $ref: '#/components/schemas/BetaAllowedCaller'
          title: 允许的调用方
          type: array
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        defer_loading:
          description: >-
            如果为 true，该工具将不包含在初始系统提示词中。仅当通过 tool search 以 tool_reference
            形式返回时才加载。
          title: 延迟加载
          type: boolean
        name:
          const: tool_search_tool_regex
          description: |-
            工具的名称。

            模型以及在 `tool_use` 块中将按此名称调用该工具。
          title: 名称
          type: string
        strict:
          description: 为 `true` 时，保证对工具名称和输入进行架构校验
          title: 严格模式
          type: boolean
        type:
          enum:
            - tool_search_tool_regex_20251119
            - tool_search_tool_regex
          title: 类型
          type: string
      required:
        - name
        - type
      title: ToolSearchToolRegex_20251119
      type: object
    BetaMCPToolset:
      additionalProperties: false
      description: |-
        对来自某个 MCP 服务器的一组工具的配置。

        允许为来自该 MCP 服务器的所有工具配置启用状态和 defer_loading，
        并可选地按工具单独覆盖。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        configs:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/BetaMCPToolConfig'
              type: object
            - type: 'null'
          description: 针对特定工具的配置覆盖，以工具名称为键
          title: 配置
        default_config:
          $ref: '#/components/schemas/BetaMCPToolDefaultConfig'
          description: 应用于该服务器所有工具的默认配置
        mcp_server_name:
          description: 要配置工具的 MCP 服务器名称
          maxLength: 255
          minLength: 1
          title: MCP 服务器名称
          type: string
        type:
          const: mcp_toolset
          title: 类型
          type: string
      required:
        - mcp_server_name
        - type
      title: MCPToolset
      type: object
    BetaContentBlock:
      discriminator:
        mapping:
          advisor_tool_result:
            $ref: '#/components/schemas/BetaResponseAdvisorToolResultBlock'
          bash_code_execution_tool_result:
            $ref: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock'
          code_execution_tool_result:
            $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock'
          compaction:
            $ref: '#/components/schemas/BetaResponseCompactionBlock'
          container_upload:
            $ref: '#/components/schemas/BetaResponseContainerUploadBlock'
          fallback:
            $ref: '#/components/schemas/BetaResponseFallbackBlock'
          mcp_tool_result:
            $ref: '#/components/schemas/BetaResponseMCPToolResultBlock'
          mcp_tool_use:
            $ref: '#/components/schemas/BetaResponseMCPToolUseBlock'
          redacted_thinking:
            $ref: '#/components/schemas/BetaResponseRedactedThinkingBlock'
          server_tool_use:
            $ref: '#/components/schemas/BetaResponseServerToolUseBlock'
          text:
            $ref: '#/components/schemas/BetaResponseTextBlock'
          text_editor_code_execution_tool_result:
            $ref: >-
              #/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock
          thinking:
            $ref: '#/components/schemas/BetaResponseThinkingBlock'
          tool_search_tool_result:
            $ref: '#/components/schemas/BetaResponseToolSearchToolResultBlock'
          tool_use:
            $ref: '#/components/schemas/BetaResponseToolUseBlock'
          web_fetch_tool_result:
            $ref: '#/components/schemas/BetaResponseWebFetchToolResultBlock'
          web_search_tool_result:
            $ref: '#/components/schemas/BetaResponseWebSearchToolResultBlock'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/BetaResponseTextBlock'
        - $ref: '#/components/schemas/BetaResponseThinkingBlock'
        - $ref: '#/components/schemas/BetaResponseRedactedThinkingBlock'
        - $ref: '#/components/schemas/BetaResponseToolUseBlock'
        - $ref: '#/components/schemas/BetaResponseServerToolUseBlock'
        - $ref: '#/components/schemas/BetaResponseWebSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseWebFetchToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseAdvisorToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock'
        - $ref: >-
            #/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock
        - $ref: '#/components/schemas/BetaResponseToolSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseMCPToolUseBlock'
        - $ref: '#/components/schemas/BetaResponseMCPToolResultBlock'
        - $ref: '#/components/schemas/BetaResponseContainerUploadBlock'
        - $ref: '#/components/schemas/BetaResponseCompactionBlock'
        - $ref: '#/components/schemas/BetaResponseFallbackBlock'
    BetaStopReason:
      enum:
        - end_turn
        - max_tokens
        - stop_sequence
        - tool_use
        - pause_turn
        - compaction
        - refusal
        - model_context_window_exceeded
      type: string
    BetaRefusalStopDetails:
      description: 关于拒绝的结构化信息。
      properties:
        category:
          anyOf:
            - $ref: '#/components/schemas/BetaRefusalCategory'
            - type: 'null'
          default: null
          description: |-
            触发拒绝的策略类别。

            当该拒绝不对应任何具名类别时为 `null`。
        explanation:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: |-
            对拒绝原因的人类可读说明。

            不保证该文本保持稳定。当该类别没有可用说明时为 `null`。
          examples:
            - 该请求因违反使用政策而被拒绝。
          title: 说明
        fallback_credit_token:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            在 fallback 模型上重试该被拒绝请求时，用于退还缓存未命中成本的不透明代码。在重试请求中将其作为
            `fallback_credit_token` 传入。在拒绝发生 5 分钟后过期。


            重试时可以使用相同的请求正文（`system`、`messages`、`tools`
            以及其他影响渲染的字段）发送，或者使用相同的正文外加一条追加的 `assistant` 消息发送，该消息的内容为部分文本（最终 text
            块末尾的空白已被去除）以及来自此次拒绝的配对 server-tool 块——这也授权该追加回合作为助手-prefill
            续写，即使在通常禁止 prefill 的模型上。在 server-tool
            循环中途签发且其部分内容可续写的令牌，只能以第二种方式兑换——如果同正文重试被 400
            拒绝并提示必须通过继续部分响应来兑换该令牌，则改用第二种方式重试。无论哪种方式：相同的工作区、相同的 platform；不匹配则为
            400。允许对已预热的前缀重发令牌，但不会获得额外 credit。


            当被拒绝的模型不符合 fallback credit 资格时，为 `null`。
          examples:
            - QW50aHJvcGljL0NsYXVkZQ==
          title: 回退额度令牌
        fallback_has_prefill_claim:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: >-
            附带的 `fallback_credit_token` 是否可以通过追加 `assistant` 消息的重试形式来兑换。仅在存在
            `fallback_credit_token` 时设置。


            `true`：通过重新发送相同的请求体并附加一条 `assistant` 消息进行重试，同时附带该令牌。该消息的内容为本响应的
            `content`，其中最后一个文本块的尾部空白会被去除，未配对的 `tool_use` 块会被省略（与
            `fallback_credit_token`
            中描述的追加轮次形式相同）。`false`：通过原封不动地重新发送原始请求体进行重试，同时附带该令牌——此次拒绝不支持追加
            `assistant` 消息的形式（没有可继续的部分内容，或者请求使用了 `output_format` 或强制工具使用的
            `tool_choice`）。一个例外：当请求使用了 `output_format` 或强制的
            `tool_choice`，且拒绝发生在服务器工具（包括 MCP
            连接器工具）已经执行之后时，该令牌可能无法通过任何一种重试形式兑换；如果此时原样请求体的重试被 400
            拒绝并提示必须通过继续部分响应来兑换令牌，请丢弃该令牌并在不附带它的情况下重试。


            提示：如果值为 `true` 时追加 `assistant` 消息的重试仍被 400 拒绝，请回退为重新发送附带该令牌的原始请求体。
          title: 回退是否包含预填充声明
        recommended_model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            服务端针对此次拒绝建议的重试目标。当无法发起回退尝试时（回退模型的速率限制已用尽，或其已过载）填充此字段，指明调用方可直接重试的回退模型。其他情况下为
            Null。
          examples:
            - claude-sonnet-4-6
          title: 推荐模型
        type:
          const: refusal
          default: refusal
          title: 类型
          type: string
      required:
        - category
        - explanation
        - fallback_credit_token
        - fallback_has_prefill_claim
        - recommended_model
        - type
      title: RefusalStopDetails
      type: object
    BetaUsage:
      properties:
        cache_creation:
          anyOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
            - type: 'null'
          default: null
          description: 按 TTL 划分的缓存令牌明细
        cache_creation_input_tokens:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: 用于创建缓存条目的输入令牌数。
          examples:
            - 2051
          title: 缓存创建输入令牌数
        cache_read_input_tokens:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          default: null
          description: 从缓存读取的输入令牌数。
          examples:
            - 2051
          title: 缓存读取输入令牌数
        fallback_credit:
          anyOf:
            - $ref: '#/components/schemas/BetaFallbackCreditUsage'
            - type: 'null'
          default: null
          description: >-
            此请求中提供的 `fallback_credit_token` 的结果。


            对于携带

            `fallback_credit_token`
            的非批次请求，无论处于哪种兑换模式，其每个响应中都存在此字段；其他情况下不存在（批次条目会接受并忽略该令牌，且不携带结果对象）。
        inference_geo:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 此请求执行推理所在的地理区域。
          examples:
            - global
          title: 推理区域
        input_tokens:
          description: 已使用的输入令牌数。
          examples:
            - 2095
          minimum: 0
          title: 输入令牌数
          type: integer
        iterations:
          $ref: '#/components/schemas/BetaIterationsUsage'
        output_tokens:
          description: 已使用的输出令牌数。
          examples:
            - 503
          minimum: 0
          title: 输出令牌数
          type: integer
        output_tokens_details:
          anyOf:
            - $ref: '#/components/schemas/BetaOutputTokensDetails'
            - type: 'null'
          default: null
          description: |-
            按类别划分的输出令牌明细。

            `output_tokens` 仍是包含全部的、用于计费的权威总量。
            此对象提供只读的分解，用于可观测性——例如，
            已计费的输出令牌中有多少用于内部推理，而这些推理在
            返回给你之前可能已被摘要化。
        server_tool_use:
          anyOf:
            - $ref: '#/components/schemas/BetaServerToolUsage'
            - type: 'null'
          default: null
          description: 服务器工具请求的数量。
        service_tier:
          anyOf:
            - enum:
                - standard
                - priority
                - batch
              type: string
            - type: 'null'
          default: null
          description: 该请求使用的是 priority、standard 还是 batch 层级。
          title: 服务层级
        speed:
          anyOf:
            - $ref: '#/components/schemas/BetaSpeed'
            - type: 'null'
          default: null
          description: 本次请求使用的推理速度模式。
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - fallback_credit
        - inference_geo
        - input_tokens
        - iterations
        - output_tokens
        - output_tokens_details
        - server_tool_use
        - service_tier
        - speed
      title: Usage
      type: object
    BetaDiagnostics:
      description: |-
        请求级诊断的响应封装。只要调用方在请求中提供了 `diagnostics`，
        该字段就会存在（可能为 null）。
      properties:
        cache_miss_reason:
          anyOf:
            - discriminator:
                mapping:
                  messages_changed:
                    $ref: '#/components/schemas/BetaCacheMissMessagesChanged'
                  model_changed:
                    $ref: '#/components/schemas/BetaCacheMissModelChanged'
                  previous_message_not_found:
                    $ref: '#/components/schemas/BetaCacheMissPreviousMessageNotFound'
                  system_changed:
                    $ref: '#/components/schemas/BetaCacheMissSystemChanged'
                  tools_changed:
                    $ref: '#/components/schemas/BetaCacheMissToolsChanged'
                  unavailable:
                    $ref: '#/components/schemas/BetaCacheMissUnavailable'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheMissModelChanged'
                - $ref: '#/components/schemas/BetaCacheMissSystemChanged'
                - $ref: '#/components/schemas/BetaCacheMissToolsChanged'
                - $ref: '#/components/schemas/BetaCacheMissMessagesChanged'
                - $ref: '#/components/schemas/BetaCacheMissPreviousMessageNotFound'
                - $ref: '#/components/schemas/BetaCacheMissUnavailable'
            - type: 'null'
          default: null
          description: >-
            说明提示缓存为何无法完整复用由 `diagnostics.previous_message_id` 标识的请求中的前缀。`null`
            表示诊断仍在进行中——响应在后台比对完成之前就已序列化。
          title: 缓存未命中原因
      required:
        - cache_miss_reason
      title: Diagnostics
      type: object
    BetaResponseContextManagement:
      properties:
        applied_edits:
          description: 已应用的上下文管理编辑列表。
          items:
            discriminator:
              mapping:
                clear_thinking_20251015:
                  $ref: '#/components/schemas/BetaResponseClearThinking20251015Edit'
                clear_tool_uses_20250919:
                  $ref: '#/components/schemas/BetaResponseClearToolUses20250919Edit'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/BetaResponseClearToolUses20250919Edit'
              - $ref: '#/components/schemas/BetaResponseClearThinking20251015Edit'
          title: 已应用的编辑
          type: array
      required:
        - applied_edits
      title: ResponseContextManagement
      type: object
    BetaContainer:
      description: 请求中所用容器的相关信息（用于代码执行工具）
      properties:
        expires_at:
          description: 容器到期的时间。
          format: date-time
          title: 过期时间
          type: string
        id:
          description: 本次请求中使用的容器的标识符
          examples:
            - container_011CpZohnwH4vuy7gazohgSP
          title: ID
          type: string
        skills:
          anyOf:
            - items:
                $ref: '#/components/schemas/BetaSkill'
              type: array
            - type: 'null'
          default: null
          description: 容器中已加载的技能
          title: 技能
      required:
        - expires_at
        - id
        - skills
      title: Container
      type: object
    BetaAPIError:
      properties:
        message:
          default: Internal server error
          title: 消息
          type: string
        type:
          const: api_error
          default: api_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: APIError
      type: object
    BetaAuthenticationError:
      properties:
        message:
          default: Authentication error
          title: 消息
          type: string
        type:
          const: authentication_error
          default: authentication_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: AuthenticationError
      type: object
    BetaBillingError:
      properties:
        message:
          default: Billing error
          title: 消息
          type: string
        type:
          const: billing_error
          default: billing_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: BillingError
      type: object
    BetaInvalidRequestError:
      properties:
        message:
          default: Invalid request
          title: 消息
          type: string
        type:
          const: invalid_request_error
          default: invalid_request_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: InvalidRequestError
      type: object
    BetaNotFoundError:
      properties:
        message:
          default: Not found
          title: 消息
          type: string
        type:
          const: not_found_error
          default: not_found_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: NotFoundError
      type: object
    BetaOverloadedError:
      properties:
        message:
          default: Overloaded
          title: 消息
          type: string
        type:
          const: overloaded_error
          default: overloaded_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: OverloadedError
      type: object
    BetaPermissionError:
      properties:
        message:
          default: Permission denied
          title: 消息
          type: string
        type:
          const: permission_error
          default: permission_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: PermissionError
      type: object
    BetaRateLimitError:
      properties:
        message:
          default: Rate limited
          title: 消息
          type: string
        type:
          const: rate_limit_error
          default: rate_limit_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: RateLimitError
      type: object
    BetaGatewayTimeoutError:
      properties:
        message:
          default: Request timeout
          title: 消息
          type: string
        type:
          const: timeout_error
          default: timeout_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: GatewayTimeoutError
      type: object
    BetaInputContentBlock:
      discriminator:
        mapping:
          advisor_tool_result:
            $ref: '#/components/schemas/BetaRequestAdvisorToolResultBlock'
          bash_code_execution_tool_result:
            $ref: '#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock'
          code_execution_tool_result:
            $ref: '#/components/schemas/BetaRequestCodeExecutionToolResultBlock'
          compaction:
            $ref: '#/components/schemas/BetaRequestCompactionBlock'
          container_upload:
            $ref: '#/components/schemas/BetaRequestContainerUploadBlock'
          document:
            $ref: '#/components/schemas/BetaRequestDocumentBlock'
          fallback:
            $ref: '#/components/schemas/BetaRequestFallbackBlock'
          image:
            $ref: '#/components/schemas/BetaRequestImageBlock'
          mcp_tool_result:
            $ref: '#/components/schemas/BetaRequestMCPToolResultBlock'
          mcp_tool_use:
            $ref: '#/components/schemas/BetaRequestMCPToolUseBlock'
          mid_conv_system:
            $ref: '#/components/schemas/BetaRequestMidConvSystemBlock'
          redacted_thinking:
            $ref: '#/components/schemas/BetaRequestRedactedThinkingBlock'
          search_result:
            $ref: '#/components/schemas/BetaRequestSearchResultBlock'
          server_tool_use:
            $ref: '#/components/schemas/BetaRequestServerToolUseBlock'
          text:
            $ref: '#/components/schemas/BetaRequestTextBlock'
          text_editor_code_execution_tool_result:
            $ref: >-
              #/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock
          thinking:
            $ref: '#/components/schemas/BetaRequestThinkingBlock'
          tool_addition:
            $ref: '#/components/schemas/BetaRequestToolAdditionBlock'
          tool_removal:
            $ref: '#/components/schemas/BetaRequestToolRemovalBlock'
          tool_result:
            $ref: '#/components/schemas/BetaRequestToolResultBlock'
          tool_search_tool_result:
            $ref: '#/components/schemas/BetaRequestToolSearchToolResultBlock'
          tool_use:
            $ref: '#/components/schemas/BetaRequestToolUseBlock'
          web_fetch_tool_result:
            $ref: '#/components/schemas/BetaRequestWebFetchToolResultBlock'
          web_search_tool_result:
            $ref: '#/components/schemas/BetaRequestWebSearchToolResultBlock'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/BetaRequestTextBlock'
          description: 普通文本内容。
        - $ref: '#/components/schemas/BetaRequestImageBlock'
          description: 直接以 base64 数据指定，或通过 URL 引用指定的图片内容。
        - $ref: '#/components/schemas/BetaRequestDocumentBlock'
          description: 文档内容，可直接指定为 base64 数据、文本，或通过 URL 引用。
        - $ref: '#/components/schemas/BetaRequestSearchResultBlock'
          description: 包含搜索操作返回的来源、标题和内容的搜索结果块。
        - $ref: '#/components/schemas/BetaRequestThinkingBlock'
          description: 指定模型内部思考的内容块。
        - $ref: '#/components/schemas/BetaRequestRedactedThinkingBlock'
          description: 用于指定模型进行内部、经删节思考的块。
        - $ref: '#/components/schemas/BetaRequestToolUseBlock'
          description: 表示模型工具调用的块。
        - $ref: '#/components/schemas/BetaRequestToolResultBlock'
          description: 指定模型工具使用结果的块。
        - $ref: '#/components/schemas/BetaRequestServerToolUseBlock'
        - $ref: '#/components/schemas/BetaRequestWebSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestWebFetchToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestAdvisorToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestCodeExecutionToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock'
        - $ref: >-
            #/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock
        - $ref: '#/components/schemas/BetaRequestToolSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestMCPToolUseBlock'
        - $ref: '#/components/schemas/BetaRequestMCPToolResultBlock'
        - $ref: '#/components/schemas/BetaRequestContainerUploadBlock'
        - $ref: '#/components/schemas/BetaRequestCompactionBlock'
        - $ref: '#/components/schemas/BetaRequestMidConvSystemBlock'
        - $ref: '#/components/schemas/BetaRequestToolAdditionBlock'
        - $ref: '#/components/schemas/BetaRequestToolRemovalBlock'
        - $ref: '#/components/schemas/BetaRequestFallbackBlock'
      x-stainless-go-variant-constructor:
        naming: new_beta_{variant}_block
    BetaSkillParams:
      additionalProperties: false
      description: 要在容器中加载的技能的规格说明（请求模型）。
      properties:
        skill_id:
          description: 技能 ID
          examples:
            - pdf
          maxLength: 64
          minLength: 1
          title: 技能 ID
          type: string
        type:
          description: 技能的类型 - 'anthropic'（内置）或 'custom'（用户自定义）
          enum:
            - anthropic
            - custom
          examples:
            - anthropic
          title: 类型
          type: string
        version:
          description: 技能版本，或 'latest' 表示最新版本
          examples:
            - latest
          maxLength: 64
          minLength: 1
          title: 版本
          type: string
      required:
        - skill_id
        - type
      title: SkillParams
      type: object
    BetaClearThinking20251015:
      additionalProperties: false
      properties:
        keep:
          anyOf:
            - discriminator:
                mapping:
                  all:
                    $ref: '#/components/schemas/BetaAllThinkingTurns'
                  thinking_turns:
                    $ref: '#/components/schemas/BetaThinkingTurns'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaThinkingTurns'
                - $ref: '#/components/schemas/BetaAllThinkingTurns'
            - const: all
              type: string
              x-stainless-naming:
                csharp:
                  type_name: All
          description: 保留思考块的最近助手轮次数量。更早轮次的思考块将被移除。
          title: 保留数量
        type:
          const: clear_thinking_20251015
          title: 类型
          type: string
      required:
        - type
      title: ClearThinking20251015
      type: object
    BetaClearToolUses20250919:
      additionalProperties: false
      properties:
        clear_at_least:
          anyOf:
            - $ref: '#/components/schemas/BetaInputTokensClearAtLeast'
            - type: 'null'
          description: 触发时必须清除的最少令牌数量。只有能移除至少这么多令牌时，才会修改上下文。
        clear_tool_inputs:
          anyOf:
            - type: boolean
            - items:
                type: string
              type: array
            - type: 'null'
          description: 是清除所有工具输入（bool），还是指定要清除的特定工具输入（list）
          title: 清除工具输入
        exclude_tools:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: 使用记录不会被清除的工具名称
          title: 排除的工具
        keep:
          description: 在对话中保留的工具使用数量
          discriminator:
            mapping:
              tool_uses:
                $ref: '#/components/schemas/BetaToolUsesKeep'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaToolUsesKeep'
          title: 保留数量
        trigger:
          description: 触发上下文管理策略的条件
          discriminator:
            mapping:
              input_tokens:
                $ref: '#/components/schemas/BetaInputTokensTrigger'
              tool_uses:
                $ref: '#/components/schemas/BetaToolUsesTrigger'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaInputTokensTrigger'
            - $ref: '#/components/schemas/BetaToolUsesTrigger'
          title: 触发条件
        type:
          const: clear_tool_uses_20250919
          title: 类型
          type: string
      required:
        - type
      title: ClearToolUses20250919
      type: object
    BetaCompact20260112:
      additionalProperties: false
      description: 在达到配置的触发阈值时自动压缩较旧的上下文。
      properties:
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          description: 用于摘要的附加指令。
          title: 指令
        pause_after_compaction:
          description: 是否在压缩后暂停并将压缩块返回给用户。
          title: 压缩后暂停
          type: boolean
        trigger:
          anyOf:
            - $ref: '#/components/schemas/BetaInputTokensTrigger'
            - type: 'null'
          description: 何时触发压缩。默认为 150000 个输入令牌。
        type:
          const: compact_20260112
          title: 类型
          type: string
      required:
        - type
      title: Compact20260112
      type: object
    BetaThinkingConfigAdaptive:
      additionalProperties: false
      properties:
        display:
          anyOf:
            - $ref: '#/components/schemas/BetaThinkingDisplayMode'
            - type: 'null'
          description: >-
            控制思考内容在响应中的呈现方式。设置为 `summarized` 时，思考内容正常返回。设置为 `omitted`
            时，思考内容会被删隐，但会返回一个签名以保持多轮对话的连续性。默认为 `summarized`。
        type:
          const: adaptive
          title: 类型
          type: string
      required:
        - type
      title: ThinkingConfigAdaptive
      type: object
    BetaThinkingConfigDisabled:
      additionalProperties: false
      properties:
        type:
          const: disabled
          title: 类型
          type: string
      required:
        - type
      title: ThinkingConfigDisabled
      type: object
      x-stainless-go-constant-constructor: true
    BetaThinkingConfigEnabled:
      additionalProperties: false
      properties:
        budget_tokens:
          description: |-
            决定模型可用于其内部推理过程的令牌数量。更大的预算可以让模型对复杂问题进行更深入的分析，从而提升响应质量。

            必须 ≥1024 且小于 `max_tokens`。

            详见扩展思考。
          minimum: 1024
          title: 预算令牌数
          type: integer
        display:
          anyOf:
            - $ref: '#/components/schemas/BetaThinkingDisplayMode'
            - type: 'null'
          description: >-
            控制思考内容在响应中的呈现方式。设置为 `summarized` 时，思考内容正常返回。设置为 `omitted`
            时，思考内容会被删隐，但会返回一个签名以保持多轮对话的连续性。默认为 `summarized`。
        type:
          const: enabled
          title: 类型
          type: string
      required:
        - budget_tokens
        - type
      title: ThinkingConfigEnabled
      type: object
    BetaRequestMCPServerToolConfiguration:
      additionalProperties: false
      properties:
        allowed_tools:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: 允许的工具
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: 已启用
      title: RequestMCPServerToolConfiguration
      type: object
    BetaEffortLevel:
      description: 所有可能的 effort 级别。
      enum:
        - low
        - medium
        - high
        - xhigh
        - max
      title: EffortLevel
      type: string
    BetaTokenTaskBudget:
      additionalProperties: false
      description: 用户可配置的跨上下文总令牌预算。
      properties:
        remaining:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          description: 预算中的剩余令牌数。在客户端实现压缩时，可用其跟踪跨上下文的使用情况。未提供时默认为 total。
          minimum: 0
          title: 剩余量
        total:
          description: 会话中所有上下文的总令牌预算。
          minimum: 1024
          title: 总数
          type: integer
        type:
          const: tokens
          description: 预算类型。目前仅支持 'tokens'。
          title: 类型
          type: string
      required:
        - total
        - type
      title: TokenTaskBudget
      type: object
    BetaRequestCharLocationCitation:
      additionalProperties: false
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          title: 文档标题
        end_char_index:
          title: 结束字符索引
          type: integer
        start_char_index:
          minimum: 0
          title: 起始字符索引
          type: integer
        type:
          const: char_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_char_index
        - start_char_index
        - type
      title: RequestCharLocationCitation
      type: object
    BetaRequestContentBlockLocationCitation:
      additionalProperties: false
      properties:
        cited_text:
          description: >-
            被引用的块范围的完整文本，拼接而成。


            始终等于 `content[start_block_index:end_block_index]`
            各段内容连接后的结果。文本块是最小的可引用单位；该字段不会是单个块的子串。不计入输出令牌，在后续轮次传回时也不计入输入令牌。
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          title: 文档标题
        end_block_index:
          description: >-
            所引用区块范围在源 `content` 数组中的排他性 0 基结束索引。


            始终大于 `start_block_index`；单区块引用的 `end_block_index = start_block_index
            + 1`。
          title: 结束内容块索引
          type: integer
        start_block_index:
          description: 来源的 `content` 数组中第一个被引用块的从 0 开始的索引。
          minimum: 0
          title: 起始内容块索引
          type: integer
        type:
          const: content_block_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_block_index
        - start_block_index
        - type
      title: RequestContentBlockLocationCitation
      type: object
    BetaRequestPageLocationCitation:
      additionalProperties: false
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          title: 文档标题
        end_page_number:
          title: 结束页码
          type: integer
        start_page_number:
          minimum: 1
          title: 起始页码
          type: integer
        type:
          const: page_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_page_number
        - start_page_number
        - type
      title: RequestPageLocationCitation
      type: object
    BetaRequestSearchResultLocationCitation:
      additionalProperties: false
      properties:
        cited_text:
          description: >-
            被引用的块范围的完整文本，拼接而成。


            始终等于 `content[start_block_index:end_block_index]`
            各段内容连接后的结果。文本块是最小的可引用单位；该字段不会是单个块的子串。不计入输出令牌，在后续轮次传回时也不计入输入令牌。
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        end_block_index:
          description: >-
            所引用区块范围在源 `content` 数组中的排他性 0 基结束索引。


            始终大于 `start_block_index`；单区块引用的 `end_block_index = start_block_index
            + 1`。
          title: 结束内容块索引
          type: integer
        search_result_index:
          description: |-
            被引用搜索结果在请求中所有 `search_result` 内容块中从 0 开始的索引，按其在各消息和工具结果中出现的顺序计。

            与 `document_index` 分开计数；服务端网页搜索结果不包含在此计数中。
          minimum: 0
          title: 搜索结果索引
          type: integer
        source:
          title: 来源
          type: string
        start_block_index:
          description: 来源的 `content` 数组中第一个被引用块的从 0 开始的索引。
          minimum: 0
          title: 起始内容块索引
          type: integer
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: 标题
        type:
          const: search_result_location
          title: 类型
          type: string
      required:
        - cited_text
        - end_block_index
        - search_result_index
        - source
        - start_block_index
        - title
        - type
      title: RequestSearchResultLocationCitation
      type: object
    BetaRequestWebSearchResultLocationCitation:
      additionalProperties: false
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        encrypted_index:
          title: 加密索引
          type: string
        title:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: 标题
        type:
          const: web_search_result_location
          title: 类型
          type: string
        url:
          minLength: 1
          title: URL
          type: string
      required:
        - cited_text
        - encrypted_index
        - title
        - type
        - url
      title: RequestWebSearchResultLocationCitation
      type: object
    BetaToolChoiceAny:
      additionalProperties: false
      description: 模型将使用任何可用的工具。
      properties:
        disable_parallel_tool_use:
          description: |-
            是否禁用并行工具使用。

            默认为 `false`。如果设为 `true`，模型将恰好输出一个 tool use。
          title: 禁用并行工具调用
          type: boolean
        type:
          const: any
          title: 类型
          type: string
      required:
        - type
      title: ToolChoiceAny
      type: object
    BetaToolChoiceAuto:
      additionalProperties: false
      description: 模型将自动决定是否使用工具。
      properties:
        disable_parallel_tool_use:
          description: |-
            是否禁用并行工具使用。

            默认为 `false`。如果设为 `true`，模型最多输出一个 tool use。
          title: 禁用并行工具调用
          type: boolean
        type:
          const: auto
          title: 类型
          type: string
      required:
        - type
      title: ToolChoiceAuto
      type: object
    BetaToolChoiceNone:
      additionalProperties: false
      description: 模型将不被允许使用工具。
      properties:
        type:
          const: none
          title: 类型
          type: string
      required:
        - type
      title: ToolChoiceNone
      type: object
      x-stainless-go-constant-constructor: true
    BetaToolChoiceTool:
      additionalProperties: false
      description: 模型将使用 `tool_choice.name` 指定的工具。
      properties:
        disable_parallel_tool_use:
          description: |-
            是否禁用并行工具使用。

            默认为 `false`。如果设为 `true`，模型将恰好输出一个 tool use。
          title: 禁用并行工具调用
          type: boolean
        name:
          description: 要使用的工具的名称。
          title: 名称
          type: string
        type:
          const: tool
          title: 类型
          type: string
      required:
        - name
        - type
      title: ToolChoiceTool
      type: object
    BetaInputSchema:
      additionalProperties: true
      properties:
        properties:
          anyOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: 属性
        required:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: 必填字段
        type:
          const: object
          title: 类型
          type: string
      required:
        - type
      title: InputSchema
      type: object
    BetaAllowedCaller:
      description: |-
        指定谁可以调用工具。

        取值：
            direct: 模型可以直接调用该工具。
            code_execution_20250825: 该工具可以从代码执行环境（v1）调用。
            code_execution_20260120: 该工具可以从代码执行环境（v2，带持久化）调用。
            code_execution_20260521: 该工具可以从代码执行环境（v2，带持久化）调用。
      enum:
        - direct
        - code_execution_20250825
        - code_execution_20260120
        - code_execution_20260521
      title: AllowedCaller
      type: string
    BetaJsonValue: {}
    BetaUserLocation:
      additionalProperties: false
      properties:
        city:
          anyOf:
            - maxLength: 255
              minLength: 1
              type: string
            - type: 'null'
          description: 用户所在的城市。
          examples:
            - New York
            - Tokyo
            - Los Angeles
          title: 城市
        country:
          anyOf:
            - maxLength: 2
              minLength: 2
              type: string
            - type: 'null'
          description: >-
            用户的两个字母 [ISO
            国家/地区代码](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)。
          examples:
            - US
            - JP
            - GB
          title: 国家或地区
        region:
          anyOf:
            - maxLength: 255
              minLength: 1
              type: string
            - type: 'null'
          description: 用户所在的地区。
          examples:
            - California
            - Ontario
            - Wales
          title: 地区
        timezone:
          anyOf:
            - maxLength: 255
              minLength: 1
              type: string
            - type: 'null'
          description: 用户的 [IANA 时区](https://nodatime.org/TimeZones)。
          examples:
            - America/New_York
            - Asia/Tokyo
            - Europe/London
          title: 时区
        type:
          const: approximate
          title: 类型
          type: string
      required:
        - type
      title: UserLocation
      type: object
    BetaRequestCitationsConfig:
      additionalProperties: false
      properties:
        enabled:
          title: 已启用
          type: boolean
      title: RequestCitationsConfig
      type: object
    BetaMCPToolConfig:
      additionalProperties: false
      description: MCP 工具集中特定工具的配置。
      properties:
        defer_loading:
          title: 延迟加载
          type: boolean
        enabled:
          title: 已启用
          type: boolean
      title: MCPToolConfig
      type: object
    BetaMCPToolDefaultConfig:
      additionalProperties: false
      description: MCP 工具集中工具的默认配置。
      properties:
        defer_loading:
          title: 延迟加载
          type: boolean
        enabled:
          title: 已启用
          type: boolean
      title: MCPToolDefaultConfig
      type: object
    BetaResponseAdvisorToolResultBlock:
      properties:
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseAdvisorToolResultError'
            - $ref: '#/components/schemas/BetaResponseAdvisorResultBlock'
            - $ref: '#/components/schemas/BetaResponseAdvisorRedactedResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: advisor_tool_result
          default: advisor_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseAdvisorToolResultBlock
      type: object
    BetaResponseBashCodeExecutionToolResultBlock:
      properties:
        content:
          anyOf:
            - $ref: >-
                #/components/schemas/BetaResponseBashCodeExecutionToolResultError
            - $ref: '#/components/schemas/BetaResponseBashCodeExecutionResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: bash_code_execution_tool_result
          default: bash_code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseBashCodeExecutionToolResultBlock
      type: object
    BetaResponseCodeExecutionToolResultBlock:
      properties:
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultError'
            - $ref: '#/components/schemas/BetaResponseCodeExecutionResultBlock'
            - $ref: >-
                #/components/schemas/BetaResponseEncryptedCodeExecutionResultBlock
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: code_execution_tool_result
          default: code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseCodeExecutionToolResultBlock
      type: object
    BetaResponseCompactionBlock:
      description: |-
        在触发自动压缩时返回的压缩块。

        当内容为 None 时，表示压缩未能生成有效的
        摘要（例如模型输出了格式错误的内容）。客户端可以将内容为 null 的压缩块原样回传；服务端将其视为无操作。
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          description: 压缩内容的摘要，压缩失败时为 null
          title: 内容
        encrypted_content:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 来自上一次压缩的不透明元数据，需原样回传
          title: 加密内容
        type:
          const: compaction
          default: compaction
          title: 类型
          type: string
      required:
        - content
        - encrypted_content
        - type
      title: ResponseCompactionBlock
      type: object
    BetaResponseContainerUploadBlock:
      description: 已上传到容器的文件的响应模型。
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: container_upload
          default: container_upload
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: ResponseContainerUploadBlock
      type: object
    BetaResponseFallbackBlock:
      description: >-
        标记 `content` 中一个模型的输出让位于下一个模型输出的位置。


        在本回合中确有前序模型运行并放弃的每个跳转处，会出现一个这样的块。没有前序模型运行并放弃的回合没有这样的边界，也不携带该块——判断是否由
        fallback 模型提供了响应的信号是 `usage.iterations` 中是否存在 `fallback_message`
        条目，而不是这个块。


        该块在流式传输中被视为 server-tool 内容块：它通过标准的 `content_block_start` /
        `content_block_stop`

        成对到达，且不携带任何增量。
      properties:
        from:
          $ref: '#/components/schemas/BetaResponseFallbackHopInfo'
          description: >-
            输出在此处终止的模型——即在这一跳拒绝的模型。当拒绝的这一跳是所请求的模型时，其 `model` 与调用方发送的顶层 `model`
            字符串一致（别名或规范名称）；当拒绝的这一跳是回退模型时，其 `model` 为该模型的规范 ID。
        to:
          $ref: '#/components/schemas/BetaResponseFallbackHopInfo'
          description: 产生此块之后内容的 fallback 模型。其 `model` 始终为规范 ID。
        trigger:
          $ref: '#/components/schemas/BetaFallbackRefusalTrigger'
          description: '`from` 模型在此跳转处进行移交的原因。'
        type:
          const: fallback
          default: fallback
          title: 类型
          type: string
      required:
        - from
        - to
        - trigger
        - type
      title: ResponseFallbackBlock
      type: object
    BetaResponseMCPToolResultBlock:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/BetaResponseTextBlock'
                title: beta_mcp_tool_result_block_content_item
              type: array
              title: beta_mcp_tool_result_block_content
          title: 内容
        is_error:
          default: false
          title: 是否为错误
          type: boolean
        tool_use_id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: 工具调用 ID
          type: string
        type:
          const: mcp_tool_result
          default: mcp_tool_result
          title: 类型
          type: string
      required:
        - content
        - is_error
        - tool_use_id
        - type
      title: ResponseMCPToolResultBlock
      type: object
    BetaResponseMCPToolUseBlock:
      properties:
        id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          description: MCP 工具的名称
          title: 名称
          type: string
        server_name:
          description: MCP 服务器的名称
          title: 服务器名称
          type: string
        type:
          const: mcp_tool_use
          default: mcp_tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - server_name
        - type
      title: ResponseMCPToolUseBlock
      type: object
    BetaResponseRedactedThinkingBlock:
      properties:
        data:
          description: |-
            此被脱敏思考块的内容，在模型的部分思考内容被安全脱敏时返回。该字段是不透明且加密的，没有可读内容。

            在继续多轮对话时，请将 `redacted_thinking` 块原样传回 API。

            详情参见扩展思考。
          title: 数据
          type: string
        type:
          const: redacted_thinking
          default: redacted_thinking
          title: 类型
          type: string
      required:
        - data
        - type
      title: ResponseRedactedThinkingBlock
      type: object
    BetaResponseServerToolUseBlock:
      properties:
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          enum:
            - advisor
            - web_search
            - web_fetch
            - code_execution
            - bash_code_execution
            - text_editor_code_execution
            - tool_search_tool_regex
            - tool_search_tool_bm25
          title: 名称
          type: string
        type:
          const: server_tool_use
          default: server_tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - type
      title: ResponseServerToolUseBlock
      type: object
    BetaResponseTextBlock:
      properties:
        citations:
          anyOf:
            - items:
                discriminator:
                  mapping:
                    char_location:
                      $ref: '#/components/schemas/BetaResponseCharLocationCitation'
                    content_block_location:
                      $ref: >-
                        #/components/schemas/BetaResponseContentBlockLocationCitation
                    page_location:
                      $ref: '#/components/schemas/BetaResponsePageLocationCitation'
                    search_result_location:
                      $ref: >-
                        #/components/schemas/BetaResponseSearchResultLocationCitation
                    web_search_result_location:
                      $ref: >-
                        #/components/schemas/BetaResponseWebSearchResultLocationCitation
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/BetaResponseCharLocationCitation'
                  - $ref: '#/components/schemas/BetaResponsePageLocationCitation'
                  - $ref: >-
                      #/components/schemas/BetaResponseContentBlockLocationCitation
                  - $ref: >-
                      #/components/schemas/BetaResponseWebSearchResultLocationCitation
                  - $ref: >-
                      #/components/schemas/BetaResponseSearchResultLocationCitation
              type: array
            - type: 'null'
          default: null
          description: >-
            支持该文本块的引用。


            返回的引用类型取决于被引用文档的类型。引用 PDF 返回 `page_location`，纯文本返回
            `char_location`，内容文档返回 `content_block_location`。
          title: 引用
        text:
          maxLength: 5000000
          minLength: 0
          title: 文本
          type: string
        type:
          const: text
          default: text
          title: 类型
          type: string
      required:
        - citations
        - text
        - type
      title: ResponseTextBlock
      type: object
    BetaResponseTextEditorCodeExecutionToolResultBlock:
      properties:
        content:
          anyOf:
            - $ref: >-
                #/components/schemas/BetaResponseTextEditorCodeExecutionToolResultError
            - $ref: >-
                #/components/schemas/BetaResponseTextEditorCodeExecutionViewResultBlock
            - $ref: >-
                #/components/schemas/BetaResponseTextEditorCodeExecutionCreateResultBlock
            - $ref: >-
                #/components/schemas/BetaResponseTextEditorCodeExecutionStrReplaceResultBlock
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: text_editor_code_execution_tool_result
          default: text_editor_code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseTextEditorCodeExecutionToolResultBlock
      type: object
    BetaResponseThinkingBlock:
      properties:
        signature:
          description: |-
            当该思考块被传回 API 时，用于验证其由模型生成的值。

            这是一个不透明字段，不应进行解释或解析。将思考块传回 API 时（在启用扩展思考使用工具时为必需），请原样传回，并保留此字段完整。

            详情参见扩展思考。
          title: 签名
          type: string
        thinking:
          description: 此块中模型思考过程的文本。
          title: 思考
          type: string
        type:
          const: thinking
          default: thinking
          title: 类型
          type: string
      required:
        - signature
        - thinking
        - type
      title: ResponseThinkingBlock
      type: object
    BetaResponseToolSearchToolResultBlock:
      properties:
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseToolSearchToolResultError'
            - $ref: '#/components/schemas/BetaResponseToolSearchToolSearchResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: tool_search_tool_result
          default: tool_search_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseToolSearchToolResultBlock
      type: object
    BetaResponseToolUseBlock:
      properties:
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          minLength: 1
          title: 名称
          type: string
        type:
          const: tool_use
          default: tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - type
      title: ResponseToolUseBlock
      type: object
    BetaResponseWebFetchToolResultBlock:
      properties:
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseWebFetchToolResultError'
            - $ref: '#/components/schemas/BetaResponseWebFetchResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: web_fetch_tool_result
          default: web_fetch_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseWebFetchToolResultBlock
      type: object
    BetaResponseWebSearchToolResultBlock:
      properties:
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseWebSearchToolResultError'
            - items:
                $ref: '#/components/schemas/BetaResponseWebSearchResultBlock'
              type: array
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: web_search_tool_result
          default: web_search_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: ResponseWebSearchToolResultBlock
      type: object
    BetaRefusalCategory:
      description: 触发拒绝的策略类别。
      enum:
        - cyber
        - bio
        - frontier_llm
        - reasoning_extraction
        - general_harms
      title: RefusalCategory
      type: string
      x-enum-descriptions:
        - 该请求可能助长网络危害，例如恶意软件或漏洞利用开发。正常的网络安全工作也可能触发此类别。
        - 该请求可能助长生物危害，例如危险的实验方法。有益的生命科学工作也可能触发此类别。
        - 该请求被判定为可能协助开发竞争性 AI 模型。正常的机器学习工作也可能触发此类别。
        - 该请求要求模型在响应文本中复现其内部推理。若要以结构化形式获取推理，请改用自适应思考。
        - 该请求可能涉及被判定为有害的领域。正常工作有时也可能触发此类别。
    BetaCacheCreation:
      properties:
        ephemeral_1h_input_tokens:
          default: 0
          description: 用于创建 1 小时缓存条目的输入令牌数量。
          minimum: 0
          title: 1 小时临时缓存输入令牌数
          type: integer
        ephemeral_5m_input_tokens:
          default: 0
          description: 用于创建 5 分钟缓存条目的输入令牌数量。
          minimum: 0
          title: 5 分钟临时缓存输入令牌数
          type: integer
      required:
        - ephemeral_1h_input_tokens
        - ephemeral_5m_input_tokens
      title: CacheCreation
      type: object
    BetaFallbackCreditUsage:
      description: 此请求中提供的 ``fallback_credit_token`` 的结果。
      properties:
        status:
          description: |-
            fallback credit 重新计价是否应用于本次响应的计费。

            一个按 `type` 判别的 union。`redeemed`：重试按对话一开始就使用重试模型计费——
            包括因没有可转移内容而导致差额为零的情况。`not_applied`：
            未应用重新计价；该分支的 `reason` 说明原因。
          discriminator:
            mapping:
              not_applied:
                $ref: '#/components/schemas/BetaFallbackCreditNotApplied'
              redeemed:
                $ref: '#/components/schemas/BetaFallbackCreditRedeemed'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaFallbackCreditRedeemed'
            - $ref: '#/components/schemas/BetaFallbackCreditNotApplied'
          title: 状态
      required:
        - status
      title: FallbackCreditUsage
      type: object
    BetaIterationsUsage:
      anyOf:
        - items:
            discriminator:
              mapping:
                advisor_message:
                  $ref: '#/components/schemas/BetaAdvisorMessageIterationUsage'
                compaction:
                  $ref: '#/components/schemas/BetaCompactionIterationUsage'
                fallback_message:
                  $ref: '#/components/schemas/BetaFallbackMessageIterationUsage'
                message:
                  $ref: '#/components/schemas/BetaMessageIterationUsage'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/BetaMessageIterationUsage'
              - $ref: '#/components/schemas/BetaCompactionIterationUsage'
              - $ref: '#/components/schemas/BetaAdvisorMessageIterationUsage'
              - $ref: '#/components/schemas/BetaFallbackMessageIterationUsage'
            x-stainless-naming:
              java:
                type_name: BetaIterationsUsageItems
              csharp:
                type_name: BetaIterationsUsageItems
          type: array
        - type: 'null'
      default: null
      description: |-
        每次迭代的令牌用量明细。

        每个条目代表一次采样迭代，拥有各自的输入/输出令牌数和缓存统计。这使你可以：
        - 判断哪些迭代超过了长上下文阈值（>=200k 令牌）
        - 根据最后一次迭代计算真实的上下文窗口大小
        - 了解服务端工具使用循环中的令牌累积情况
      title: Iterations
    BetaOutputTokensDetails:
      properties:
        thinking_tokens:
          default: 0
          description: |-
            模型作为内部推理生成的输出令牌数，包括
            思考块的分隔符令牌。

            反映模型产出的原始推理，而不是响应正文中返回的（可能更短的）
            摘要思考文本。通过对原始推理文本重新分词计算得出，
            因此可能与模型的实际生成数量相差少量令牌。始终 ≤ `output_tokens`；
            `output_tokens - thinking_tokens` 近似为非推理输出。
          minimum: 0
          title: 思考令牌数
          type: integer
      required:
        - thinking_tokens
      title: OutputTokensDetails
      type: object
    BetaServerToolUsage:
      properties:
        web_fetch_requests:
          default: 0
          description: web fetch 工具请求的数量。
          examples:
            - 2
          minimum: 0
          title: 网页获取请求数
          type: integer
        web_search_requests:
          default: 0
          description: 网页搜索工具的请求次数。
          examples:
            - 0
          minimum: 0
          title: 网页搜索请求数
          type: integer
      required:
        - web_fetch_requests
        - web_search_requests
      title: ServerToolUsage
      type: object
    BetaCacheMissMessagesChanged:
      properties:
        cache_missed_input_tokens:
          description: 如果前缀与上一个请求匹配，本可从缓存读取的输入令牌的近似数量。
          title: 缓存未命中输入令牌数
          type: integer
        type:
          const: messages_changed
          default: messages_changed
          title: 类型
          type: string
      required:
        - cache_missed_input_tokens
        - type
      title: CacheMissMessagesChanged
      type: object
    BetaCacheMissModelChanged:
      properties:
        cache_missed_input_tokens:
          description: 如果前缀与上一个请求匹配，本可从缓存读取的输入令牌的近似数量。
          title: 缓存未命中输入令牌数
          type: integer
        type:
          const: model_changed
          default: model_changed
          title: 类型
          type: string
      required:
        - cache_missed_input_tokens
        - type
      title: CacheMissModelChanged
      type: object
    BetaCacheMissPreviousMessageNotFound:
      properties:
        type:
          const: previous_message_not_found
          default: previous_message_not_found
          title: 类型
          type: string
      required:
        - type
      title: CacheMissPreviousMessageNotFound
      type: object
    BetaCacheMissSystemChanged:
      properties:
        cache_missed_input_tokens:
          description: 如果前缀与上一个请求匹配，本可从缓存读取的输入令牌的近似数量。
          title: 缓存未命中输入令牌数
          type: integer
        type:
          const: system_changed
          default: system_changed
          title: 类型
          type: string
      required:
        - cache_missed_input_tokens
        - type
      title: CacheMissSystemChanged
      type: object
    BetaCacheMissToolsChanged:
      properties:
        cache_missed_input_tokens:
          description: 如果前缀与上一个请求匹配，本可从缓存读取的输入令牌的近似数量。
          title: 缓存未命中输入令牌数
          type: integer
        type:
          const: tools_changed
          default: tools_changed
          title: 类型
          type: string
      required:
        - cache_missed_input_tokens
        - type
      title: CacheMissToolsChanged
      type: object
    BetaCacheMissUnavailable:
      properties:
        type:
          const: unavailable
          default: unavailable
          title: 类型
          type: string
      required:
        - type
      title: CacheMissUnavailable
      type: object
    BetaResponseClearThinking20251015Edit:
      properties:
        cleared_input_tokens:
          description: 本次编辑清除的输入令牌数。
          minimum: 0
          title: 已清除的输入令牌数
          type: integer
        cleared_thinking_turns:
          description: 被清除的思考轮次数。
          minimum: 0
          title: 已清除的思考轮次
          type: integer
        type:
          const: clear_thinking_20251015
          default: clear_thinking_20251015
          description: 所应用的上下文管理编辑的类型。
          title: 类型
          type: string
      required:
        - cleared_input_tokens
        - cleared_thinking_turns
        - type
      title: ResponseClearThinking20251015Edit
      type: object
    BetaResponseClearToolUses20250919Edit:
      properties:
        cleared_input_tokens:
          description: 本次编辑清除的输入令牌数。
          minimum: 0
          title: 已清除的输入令牌数
          type: integer
        cleared_tool_uses:
          description: 已清除的工具使用次数。
          minimum: 0
          title: 已清除的工具调用
          type: integer
        type:
          const: clear_tool_uses_20250919
          default: clear_tool_uses_20250919
          description: 所应用的上下文管理编辑的类型。
          title: 类型
          type: string
      required:
        - cleared_input_tokens
        - cleared_tool_uses
        - type
      title: ResponseClearToolUses20250919Edit
      type: object
    BetaSkill:
      description: 已加载到容器中的技能（响应模型）。
      properties:
        skill_id:
          description: 技能 ID
          examples:
            - pdf
          maxLength: 64
          minLength: 1
          title: 技能 ID
          type: string
        type:
          description: 技能的类型 - 'anthropic'（内置）或 'custom'（用户自定义）
          enum:
            - anthropic
            - custom
          examples:
            - anthropic
          title: 类型
          type: string
        version:
          description: 技能版本，或 'latest' 表示最新版本
          examples:
            - latest
          maxLength: 64
          minLength: 1
          title: 版本
          type: string
      required:
        - skill_id
        - type
        - version
      title: Skill
      type: object
    BetaRequestAdvisorToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestAdvisorToolResultError'
            - $ref: '#/components/schemas/BetaRequestAdvisorResultBlock'
            - $ref: '#/components/schemas/BetaRequestAdvisorRedactedResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: advisor_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestAdvisorToolResultBlock
      type: object
    BetaRequestBashCodeExecutionToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestBashCodeExecutionToolResultError'
            - $ref: '#/components/schemas/BetaRequestBashCodeExecutionResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: bash_code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestBashCodeExecutionToolResultBlock
      type: object
    BetaRequestCodeExecutionToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCodeExecutionToolResultError'
              x-stainless-naming:
                go:
                  variant_constructor: BetaNewCodeExecutionToolRequestError
            - $ref: '#/components/schemas/BetaRequestCodeExecutionResultBlock'
            - $ref: >-
                #/components/schemas/BetaRequestEncryptedCodeExecutionResultBlock
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestCodeExecutionToolResultBlock
      type: object
    BetaRequestCompactionBlock:
      additionalProperties: false
      description: |-
        包含先前上下文摘要的压缩（compaction）块。

        用户应将这些块从响应原样传回后续请求，
        以在压缩边界之间保持上下文。

        当内容为 None 时，该块表示一次失败的压缩。服务器
        将这些情况视为无操作。不允许内容为空字符串。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - type: string
            - type: 'null'
          description: 先前压缩内容的摘要；压缩失败时为 null
          title: 内容
        encrypted_content:
          anyOf:
            - type: string
            - type: 'null'
          description: 来自上一次压缩的不透明元数据，需原样回传
          title: 加密内容
        type:
          const: compaction
          title: 类型
          type: string
      required:
        - type
      title: RequestCompactionBlock
      type: object
    BetaRequestContainerUploadBlock:
      additionalProperties: false
      description: |-
        表示要上传到容器的文件的内容块。
        通过此块上传的文件可在容器的输入目录中使用。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        file_id:
          title: 文件 ID
          type: string
        type:
          const: container_upload
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: RequestContainerUploadBlock
      type: object
    BetaRequestDocumentBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestCitationsConfig'
            - type: 'null'
        context:
          anyOf:
            - minLength: 1
              type: string
            - type: 'null'
          title: 上下文
        source:
          discriminator:
            mapping:
              base64:
                $ref: '#/components/schemas/BetaBase64PDFSource'
              content:
                $ref: '#/components/schemas/BetaContentBlockSource'
              file:
                $ref: '#/components/schemas/BetaFileDocumentSource'
              text:
                $ref: '#/components/schemas/BetaPlainTextSource'
              url:
                $ref: '#/components/schemas/BetaURLPDFSource'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaBase64PDFSource'
            - $ref: '#/components/schemas/BetaPlainTextSource'
            - $ref: '#/components/schemas/BetaContentBlockSource'
            - $ref: '#/components/schemas/BetaURLPDFSource'
            - $ref: '#/components/schemas/BetaFileDocumentSource'
          title: 来源
        title:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          title: 标题
        type:
          const: document
          title: 类型
          type: string
      required:
        - source
        - type
      title: RequestDocumentBlock
      type: object
    BetaRequestFallbackBlock:
      additionalProperties: false
      description: >-
        从先前响应中原样回传的 `fallback` 块。


        在 `messages[].content` 中接受，但不会渲染进提示；不会针对请求的 `fallbacks` 链或顶层 `model`
        进行校验。


        请原样回传助手回合，包括位于其原始位置的这个块。该块标记了 fallback
        跳转前后所产生内容的边界，服务器依赖该边界来校验回合：当思考运行分列边界两侧时，省略该块会将它们合并为一个服务器无法校验的跨度（请求会被拒绝），将其移动到单次运行中间同样会被拒绝；在非思考块之间，该块的位置没有校验效果。
      properties:
        from:
          $ref: '#/components/schemas/BetaRequestFallbackHopInfo'
        to:
          $ref: '#/components/schemas/BetaRequestFallbackHopInfo'
        trigger:
          description: 响应块的 `trigger`，原样回显。服务器会接受但忽略该值；允许任意对象或 `null`。
          title: 触发条件
        type:
          const: fallback
          title: 类型
          type: string
      required:
        - from
        - to
        - type
      title: RequestFallbackBlock
      type: object
    BetaRequestImageBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        source:
          discriminator:
            mapping:
              base64:
                $ref: '#/components/schemas/BetaBase64ImageSource'
              file:
                $ref: '#/components/schemas/BetaFileImageSource'
              url:
                $ref: '#/components/schemas/BetaURLImageSource'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaBase64ImageSource'
            - $ref: '#/components/schemas/BetaURLImageSource'
            - $ref: '#/components/schemas/BetaFileImageSource'
          title: 来源
        type:
          const: image
          title: 类型
          type: string
      required:
        - source
        - type
      title: RequestImageBlock
      type: object
    BetaRequestMCPToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/BetaRequestTextBlock'
                title: beta_mcp_tool_result_block_param_content_item
              type: array
              title: beta_mcp_tool_result_block_param_content
          title: 内容
        is_error:
          title: 是否为错误
          type: boolean
        tool_use_id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: 工具调用 ID
          type: string
        type:
          const: mcp_tool_result
          title: 类型
          type: string
      required:
        - tool_use_id
        - type
      title: RequestMCPToolResultBlock
      type: object
    BetaRequestMCPToolUseBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          title: 名称
          type: string
        server_name:
          description: MCP 服务器的名称
          title: 服务器名称
          type: string
        type:
          const: mcp_tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - server_name
        - type
      title: RequestMCPToolUseBlock
      type: object
    BetaRequestMidConvSystemBlock:
      additionalProperties: false
      description: |-
        出现在会话中途的系统指令。

        使用此块可在会话的特定时刻提供或更新系统级
        指令，而不是仅通过顶层 `system` 参数。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          description: 系统指令文本块。
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/BetaRequestTextBlock'
                tool_addition:
                  $ref: '#/components/schemas/BetaRequestToolAdditionBlock'
                tool_removal:
                  $ref: '#/components/schemas/BetaRequestToolRemovalBlock'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/BetaRequestTextBlock'
              - $ref: '#/components/schemas/BetaRequestToolAdditionBlock'
              - $ref: '#/components/schemas/BetaRequestToolRemovalBlock'
          title: 内容
          type: array
        type:
          const: mid_conv_system
          title: 类型
          type: string
      required:
        - content
        - type
      title: RequestMidConvSystemBlock
      type: object
    BetaRequestRedactedThinkingBlock:
      additionalProperties: false
      properties:
        data:
          description: 此经过编辑的思考块的 `data` 值，与 API 在先前响应中返回的完全一致。不透明且已加密；请原样传回。
          title: 数据
          type: string
        type:
          const: redacted_thinking
          title: 类型
          type: string
      required:
        - data
        - type
      title: RequestRedactedThinkingBlock
      type: object
    BetaRequestSearchResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        citations:
          $ref: '#/components/schemas/BetaRequestCitationsConfig'
        content:
          items:
            $ref: '#/components/schemas/BetaRequestTextBlock'
          title: 内容
          type: array
        source:
          title: 来源
          type: string
        title:
          title: 标题
          type: string
        type:
          const: search_result
          title: 类型
          type: string
      required:
        - content
        - source
        - title
        - type
      title: RequestSearchResultBlock
      type: object
    BetaRequestServerToolUseBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          enum:
            - advisor
            - web_search
            - web_fetch
            - code_execution
            - bash_code_execution
            - text_editor_code_execution
            - tool_search_tool_regex
            - tool_search_tool_bm25
          title: 名称
          type: string
        type:
          const: server_tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - type
      title: RequestServerToolUseBlock
      type: object
    BetaRequestTextEditorCodeExecutionToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - $ref: >-
                #/components/schemas/BetaRequestTextEditorCodeExecutionToolResultError
            - $ref: >-
                #/components/schemas/BetaRequestTextEditorCodeExecutionViewResultBlock
            - $ref: >-
                #/components/schemas/BetaRequestTextEditorCodeExecutionCreateResultBlock
            - $ref: >-
                #/components/schemas/BetaRequestTextEditorCodeExecutionStrReplaceResultBlock
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: text_editor_code_execution_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestTextEditorCodeExecutionToolResultBlock
      type: object
    BetaRequestThinkingBlock:
      additionalProperties: false
      properties:
        signature:
          description: |-
            此思考块的 `signature` 值，与 API 在先前响应中返回的完全一致。用于验证该块确实由模型生成。

            思考块必须原样按原始顺序回传；修改过的块会导致 400 `invalid_request_error`。
          title: 签名
          type: string
        thinking:
          description: API 返回的此块的 `thinking` 文本。
          title: 思考
          type: string
        type:
          const: thinking
          title: 类型
          type: string
      required:
        - signature
        - thinking
        - type
      title: RequestThinkingBlock
      type: object
    BetaRequestToolAdditionBlock:
      additionalProperties: false
      description: |-
        会话中途呈现已声明工具的指令。

        ``tool`` 按名称引用请求的
        ``tools`` 中的某个工具（或 MCP 工具集）；从会话中
        的这一时刻起，该工具将提供给模型。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        tool:
          discriminator:
            mapping:
              mcp_tool_reference:
                $ref: '#/components/schemas/BetaToolChangeMCPToolReference'
              mcp_toolset_reference:
                $ref: '#/components/schemas/BetaToolChangeMCPToolsetReference'
              tool_reference:
                $ref: '#/components/schemas/BetaToolChangeToolReference'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaToolChangeToolReference'
            - $ref: '#/components/schemas/BetaToolChangeMCPToolReference'
            - $ref: '#/components/schemas/BetaToolChangeMCPToolsetReference'
          title: 工具
        type:
          const: tool_addition
          title: 类型
          type: string
      required:
        - tool
        - type
      title: RequestToolAdditionBlock
      type: object
    BetaRequestToolRemovalBlock:
      additionalProperties: false
      description: |-
        会话中途撤回工具的指令。

        ``tool`` 按名称引用请求的
        ``tools`` 中的某个工具（或 MCP 工具集）；从会话中
        的这一时刻起，该工具不再提供给模型。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        tool:
          discriminator:
            mapping:
              mcp_tool_reference:
                $ref: '#/components/schemas/BetaToolChangeMCPToolReference'
              mcp_toolset_reference:
                $ref: '#/components/schemas/BetaToolChangeMCPToolsetReference'
              tool_reference:
                $ref: '#/components/schemas/BetaToolChangeToolReference'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaToolChangeToolReference'
            - $ref: '#/components/schemas/BetaToolChangeMCPToolReference'
            - $ref: '#/components/schemas/BetaToolChangeMCPToolsetReference'
          title: 工具
        type:
          const: tool_removal
          title: 类型
          type: string
      required:
        - tool
        - type
      title: RequestToolRemovalBlock
      type: object
    BetaRequestToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - type: string
              x-stainless-skip:
                - go
                - cli
            - items:
                discriminator:
                  mapping:
                    document:
                      $ref: '#/components/schemas/BetaRequestDocumentBlock'
                    image:
                      $ref: '#/components/schemas/BetaRequestImageBlock'
                    search_result:
                      $ref: '#/components/schemas/BetaRequestSearchResultBlock'
                    text:
                      $ref: '#/components/schemas/BetaRequestTextBlock'
                    tool_reference:
                      $ref: '#/components/schemas/BetaRequestToolReferenceBlock'
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/BetaRequestTextBlock'
                  - $ref: '#/components/schemas/BetaRequestImageBlock'
                  - $ref: '#/components/schemas/BetaRequestSearchResultBlock'
                  - $ref: '#/components/schemas/BetaRequestDocumentBlock'
                  - $ref: '#/components/schemas/BetaRequestToolReferenceBlock'
                title: 内容块
              type: array
              x-stainless-naming:
                python:
                  type_name: Content
                ruby:
                  type_name: Content
                php:
                  type_name: Content
          title: 内容
        is_error:
          title: 是否为错误
          type: boolean
        tool_use_id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: 工具调用 ID
          type: string
        type:
          const: tool_result
          title: 类型
          type: string
      required:
        - tool_use_id
        - type
      title: RequestToolResultBlock
      type: object
    BetaRequestToolSearchToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestToolSearchToolResultError'
            - $ref: '#/components/schemas/BetaRequestToolSearchToolSearchResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: tool_search_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestToolSearchToolResultBlock
      type: object
    BetaRequestToolUseBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        id:
          pattern: ^[a-zA-Z0-9_-]+$
          title: ID
          type: string
        input:
          additionalProperties: true
          title: 输入
          type: object
        name:
          maxLength: 200
          minLength: 1
          title: 名称
          type: string
        type:
          const: tool_use
          title: 类型
          type: string
      required:
        - id
        - input
        - name
        - type
      title: RequestToolUseBlock
      type: object
    BetaRequestWebFetchToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        content:
          anyOf:
            - $ref: '#/components/schemas/BetaRequestWebFetchToolResultError'
            - $ref: '#/components/schemas/BetaRequestWebFetchResultBlock'
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: web_fetch_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestWebFetchToolResultBlock
      type: object
    BetaRequestWebSearchToolResultBlock:
      additionalProperties: false
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        caller:
          discriminator:
            mapping:
              code_execution_20250825:
                $ref: '#/components/schemas/BetaServerToolCaller'
              code_execution_20260120:
                $ref: '#/components/schemas/BetaServerToolCaller_20260120'
              direct:
                $ref: '#/components/schemas/BetaDirectCaller'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaDirectCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller'
            - $ref: '#/components/schemas/BetaServerToolCaller_20260120'
          title: 调用方
        content:
          anyOf:
            - items:
                $ref: '#/components/schemas/BetaRequestWebSearchResultBlock'
              type: array
              title: 结果块
            - $ref: '#/components/schemas/BetaRequestWebSearchToolResultError'
              x-stainless-naming:
                go:
                  variant_constructor: BetaNewWebSearchToolRequestError
          title: 内容
        tool_use_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具调用 ID
          type: string
        type:
          const: web_search_tool_result
          title: 类型
          type: string
      required:
        - content
        - tool_use_id
        - type
      title: RequestWebSearchToolResultBlock
      type: object
    BetaAllThinkingTurns:
      additionalProperties: false
      properties:
        type:
          const: all
          title: 类型
          type: string
      required:
        - type
      title: AllThinkingTurns
      type: object
    BetaThinkingTurns:
      additionalProperties: false
      properties:
        type:
          const: thinking_turns
          title: 类型
          type: string
        value:
          minimum: 1
          title: 值
          type: integer
      required:
        - type
        - value
      title: ThinkingTurns
      type: object
    BetaInputTokensClearAtLeast:
      additionalProperties: false
      properties:
        type:
          const: input_tokens
          title: 类型
          type: string
        value:
          minimum: 0
          title: 值
          type: integer
      required:
        - type
        - value
      title: InputTokensClearAtLeast
      type: object
    BetaToolUsesKeep:
      additionalProperties: false
      properties:
        type:
          const: tool_uses
          title: 类型
          type: string
        value:
          minimum: 0
          title: 值
          type: integer
      required:
        - type
        - value
      title: ToolUsesKeep
      type: object
    BetaInputTokensTrigger:
      additionalProperties: false
      properties:
        type:
          const: input_tokens
          title: 类型
          type: string
        value:
          minimum: 1
          title: 值
          type: integer
      required:
        - type
        - value
      title: InputTokensTrigger
      type: object
    BetaToolUsesTrigger:
      additionalProperties: false
      properties:
        type:
          const: tool_uses
          title: 类型
          type: string
        value:
          minimum: 1
          title: 值
          type: integer
      required:
        - type
        - value
      title: ToolUsesTrigger
      type: object
    BetaThinkingDisplayMode:
      enum:
        - summarized
        - omitted
      title: ThinkingDisplayMode
      type: string
    BetaResponseAdvisorToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaAdvisorToolResultErrorCode'
        type:
          const: advisor_tool_result_error
          default: advisor_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: ResponseAdvisorToolResultError
      type: object
    BetaResponseAdvisorResultBlock:
      properties:
        stop_reason:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            顾问子推理的停止原因（与顶层消息的 `stop_reason` 取值相同）。`max_tokens` 表示顾问的输出在工具的
            `max_tokens` 值或顾问模型的策略上限处被截断。
          title: 停止原因
        text:
          title: 文本
          type: string
        type:
          const: advisor_result
          default: advisor_result
          title: 类型
          type: string
      required:
        - stop_reason
        - text
        - type
      title: ResponseAdvisorResultBlock
      type: object
    BetaResponseAdvisorRedactedResultBlock:
      properties:
        encrypted_content:
          description: 包含顾问输出的不透明数据块。原样往返传递；请勿检查或修改。
          title: 加密内容
          type: string
        stop_reason:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 顾问子推理的停止原因（取值与顶层消息的 `stop_reason` 相同）。
          title: 停止原因
        type:
          const: advisor_redacted_result
          default: advisor_redacted_result
          title: 类型
          type: string
      required:
        - encrypted_content
        - stop_reason
        - type
      title: ResponseAdvisorRedactedResultBlock
      type: object
    BetaResponseBashCodeExecutionToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaBashCodeExecutionToolResultErrorCode'
        type:
          const: bash_code_execution_tool_result_error
          default: bash_code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: ResponseBashCodeExecutionToolResultError
      type: object
    BetaResponseBashCodeExecutionResultBlock:
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaResponseBashCodeExecutionOutputBlock'
          title: 内容
          type: array
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        stdout:
          title: 标准输出
          type: string
        type:
          const: bash_code_execution_result
          default: bash_code_execution_result
          title: 类型
          type: string
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      title: ResponseBashCodeExecutionResultBlock
      type: object
    BetaResponseCodeExecutionToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode'
        type:
          const: code_execution_tool_result_error
          default: code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: ResponseCodeExecutionToolResultError
      type: object
    BetaResponseCodeExecutionResultBlock:
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaResponseCodeExecutionOutputBlock'
          title: 内容
          type: array
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        stdout:
          title: 标准输出
          type: string
        type:
          const: code_execution_result
          default: code_execution_result
          title: 类型
          type: string
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      title: ResponseCodeExecutionResultBlock
      type: object
    BetaResponseEncryptedCodeExecutionResultBlock:
      description: 带有加密 stdout 的代码执行结果，用于 PFC + web_search 结果。
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaResponseCodeExecutionOutputBlock'
          title: 内容
          type: array
        encrypted_stdout:
          title: 加密标准输出
          type: string
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        type:
          const: encrypted_code_execution_result
          default: encrypted_code_execution_result
          title: 类型
          type: string
      required:
        - content
        - encrypted_stdout
        - return_code
        - stderr
        - type
      title: ResponseEncryptedCodeExecutionResultBlock
      type: object
    BetaResponseFallbackHopInfo:
      description: 标识回退转换中的一跳。
      properties:
        model:
          $ref: '#/components/schemas/Model'
      required:
        - model
      title: ResponseFallbackHopInfo
      type: object
    BetaFallbackRefusalTrigger:
      description: '`from` 模型因策略原因拒绝。'
      properties:
        category:
          anyOf:
            - $ref: '#/components/schemas/BetaRefusalCategory'
            - type: 'null'
          default: null
          description: >-
            在此跳触发 `from` 模型拒绝的策略类别。当该拒绝无法对应到具名类别时为 `null`。与
            `stop_details.category` 使用相同的取值集合。
          x-stainless-naming:
            csharp:
              type_name: BetaFallbackRefusalTriggerCategory
        type:
          const: refusal
          default: refusal
          title: 类型
          type: string
      required:
        - category
        - type
      title: FallbackRefusalTrigger
      type: object
    BetaServerToolCaller:
      additionalProperties: false
      description: 由服务器端工具生成的工具调用。
      properties:
        tool_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具 ID
          type: string
        type:
          const: code_execution_20250825
          title: 类型
          type: string
      required:
        - tool_id
        - type
      title: ServerToolCaller
      type: object
    BetaServerToolCaller_20260120:
      additionalProperties: false
      properties:
        tool_id:
          pattern: ^srvtoolu_[a-zA-Z0-9_]+$
          title: 工具 ID
          type: string
        type:
          const: code_execution_20260120
          title: 类型
          type: string
      required:
        - tool_id
        - type
      title: ServerToolCaller_20260120
      type: object
    BetaDirectCaller:
      additionalProperties: false
      description: 模型直接发起的工具调用。
      properties:
        type:
          const: direct
          title: 类型
          type: string
      required:
        - type
      title: DirectCaller
      type: object
    BetaResponseCharLocationCitation:
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - type: string
            - type: 'null'
          examples:
            - My Document
          title: 文档标题
        end_char_index:
          title: 结束字符索引
          type: integer
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
          title: 文件 ID
        start_char_index:
          minimum: 0
          title: 起始字符索引
          type: integer
        type:
          const: char_location
          default: char_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_char_index
        - file_id
        - start_char_index
        - type
      title: ResponseCharLocationCitation
      type: object
    BetaResponseContentBlockLocationCitation:
      properties:
        cited_text:
          description: >-
            被引用的块范围的完整文本，拼接而成。


            始终等于 `content[start_block_index:end_block_index]`
            各段内容连接后的结果。文本块是最小的可引用单位；该字段不会是单个块的子串。不计入输出令牌，在后续轮次传回时也不计入输入令牌。
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - type: string
            - type: 'null'
          examples:
            - My Document
          title: 文档标题
        end_block_index:
          description: >-
            所引用区块范围在源 `content` 数组中的排他性 0 基结束索引。


            始终大于 `start_block_index`；单区块引用的 `end_block_index = start_block_index
            + 1`。
          title: 结束内容块索引
          type: integer
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
          title: 文件 ID
        start_block_index:
          description: 来源的 `content` 数组中第一个被引用块的从 0 开始的索引。
          minimum: 0
          title: 起始内容块索引
          type: integer
        type:
          const: content_block_location
          default: content_block_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_block_index
        - file_id
        - start_block_index
        - type
      title: ResponseContentBlockLocationCitation
      type: object
    BetaResponsePageLocationCitation:
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        document_index:
          minimum: 0
          title: 文档索引
          type: integer
        document_title:
          anyOf:
            - type: string
            - type: 'null'
          examples:
            - My Document
          title: 文档标题
        end_page_number:
          title: 结束页码
          type: integer
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
          title: 文件 ID
        start_page_number:
          minimum: 1
          title: 起始页码
          type: integer
        type:
          const: page_location
          default: page_location
          title: 类型
          type: string
      required:
        - cited_text
        - document_index
        - document_title
        - end_page_number
        - file_id
        - start_page_number
        - type
      title: ResponsePageLocationCitation
      type: object
    BetaResponseSearchResultLocationCitation:
      properties:
        cited_text:
          description: >-
            被引用的块范围的完整文本，拼接而成。


            始终等于 `content[start_block_index:end_block_index]`
            各段内容连接后的结果。文本块是最小的可引用单位；该字段不会是单个块的子串。不计入输出令牌，在后续轮次传回时也不计入输入令牌。
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        end_block_index:
          description: >-
            所引用区块范围在源 `content` 数组中的排他性 0 基结束索引。


            始终大于 `start_block_index`；单区块引用的 `end_block_index = start_block_index
            + 1`。
          title: 结束内容块索引
          type: integer
        search_result_index:
          description: |-
            被引用搜索结果在请求中所有 `search_result` 内容块中从 0 开始的索引，按其在各消息和工具结果中出现的顺序计。

            与 `document_index` 分开计数；服务端网页搜索结果不包含在此计数中。
          minimum: 0
          title: 搜索结果索引
          type: integer
        source:
          title: 来源
          type: string
        start_block_index:
          description: 来源的 `content` 数组中第一个被引用块的从 0 开始的索引。
          minimum: 0
          title: 起始内容块索引
          type: integer
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: 标题
        type:
          const: search_result_location
          default: search_result_location
          title: 类型
          type: string
      required:
        - cited_text
        - end_block_index
        - search_result_index
        - source
        - start_block_index
        - title
        - type
      title: ResponseSearchResultLocationCitation
      type: object
    BetaResponseWebSearchResultLocationCitation:
      properties:
        cited_text:
          examples:
            - The grass is green. The sky is blue.
          title: 引用文本
          type: string
        encrypted_index:
          title: 加密索引
          type: string
        title:
          anyOf:
            - maxLength: 512
              type: string
            - type: 'null'
          title: 标题
        type:
          const: web_search_result_location
          default: web_search_result_location
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - cited_text
        - encrypted_index
        - title
        - type
        - url
      title: ResponseWebSearchResultLocationCitation
      type: object
    BetaResponseTextEditorCodeExecutionToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 错误消息
        type:
          const: text_editor_code_execution_tool_result_error
          default: text_editor_code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - error_message
        - type
      title: ResponseTextEditorCodeExecutionToolResultError
      type: object
    BetaResponseTextEditorCodeExecutionViewResultBlock:
      properties:
        content:
          title: 内容
          type: string
        file_type:
          enum:
            - text
            - image
            - pdf
          title: 文件类型
          type: string
        num_lines:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 行数
        start_line:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 起始行
        total_lines:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 总行数
        type:
          const: text_editor_code_execution_view_result
          default: text_editor_code_execution_view_result
          title: 类型
          type: string
      required:
        - content
        - file_type
        - num_lines
        - start_line
        - total_lines
        - type
      title: ResponseTextEditorCodeExecutionViewResultBlock
      type: object
    BetaResponseTextEditorCodeExecutionCreateResultBlock:
      properties:
        is_file_update:
          title: 是否为文件更新
          type: boolean
        type:
          const: text_editor_code_execution_create_result
          default: text_editor_code_execution_create_result
          title: 类型
          type: string
      required:
        - is_file_update
        - type
      title: ResponseTextEditorCodeExecutionCreateResultBlock
      type: object
    BetaResponseTextEditorCodeExecutionStrReplaceResultBlock:
      properties:
        lines:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          title: 行
        new_lines:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 新行
        new_start:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 新起始位置
        old_lines:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 原行
        old_start:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: 原起始位置
        type:
          const: text_editor_code_execution_str_replace_result
          default: text_editor_code_execution_str_replace_result
          title: 类型
          type: string
      required:
        - lines
        - new_lines
        - new_start
        - old_lines
        - old_start
        - type
      title: ResponseTextEditorCodeExecutionStrReplaceResultBlock
      type: object
    BetaResponseToolSearchToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaToolSearchToolResultErrorCode'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 错误消息
        type:
          const: tool_search_tool_result_error
          default: tool_search_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - error_message
        - type
      title: ResponseToolSearchToolResultError
      type: object
    BetaResponseToolSearchToolSearchResultBlock:
      properties:
        tool_references:
          items:
            $ref: '#/components/schemas/BetaResponseToolReferenceBlock'
          title: 工具引用
          type: array
        type:
          const: tool_search_tool_search_result
          default: tool_search_tool_search_result
          title: 类型
          type: string
      required:
        - tool_references
        - type
      title: ResponseToolSearchToolSearchResultBlock
      type: object
    BetaResponseWebFetchToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode'
        type:
          const: web_fetch_tool_result_error
          default: web_fetch_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: ResponseWebFetchToolResultError
      type: object
    BetaResponseWebFetchResultBlock:
      properties:
        content:
          $ref: '#/components/schemas/BetaResponseDocumentBlock'
        retrieved_at:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 内容获取时间的 ISO 8601 时间戳
          title: 获取时间
        type:
          const: web_fetch_result
          default: web_fetch_result
          title: 类型
          type: string
        url:
          description: 已抓取内容的 URL
          title: URL
          type: string
      required:
        - content
        - retrieved_at
        - type
        - url
      title: ResponseWebFetchResultBlock
      type: object
    BetaResponseWebSearchToolResultError:
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode'
        type:
          const: web_search_tool_result_error
          default: web_search_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: ResponseWebSearchToolResultError
      type: object
    BetaResponseWebSearchResultBlock:
      properties:
        encrypted_content:
          title: 加密内容
          type: string
        page_age:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 页面时效
        title:
          title: 标题
          type: string
        type:
          const: web_search_result
          default: web_search_result
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - encrypted_content
        - page_age
        - title
        - type
        - url
      title: ResponseWebSearchResultBlock
      type: object
    BetaFallbackCreditNotApplied:
      description: 未应用重新定价；``reason`` 说明了原因。
      properties:
        reason:
          description: |-
            未应用 `reprice` 的原因。

            这是一个封闭枚举；`redemption-check` 词汇表的扩充将通过经过审查的架构更新引入。
          enum:
            - body_mismatch
            - continuation_excluded
            - continuation_only
            - expired
            - invalid_target_model
            - not_enabled
            - reprice_unavailable
            - temporarily_unavailable
            - variant_fields_present
            - wrong_organization
            - wrong_platform
            - wrong_workspace
          title: 原因
          type: string
        remove_to_redeem:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: |-
            重试前需要移除的请求字段，以便重试可以兑换该
            令牌。

            仅当 `reason` 为 `variant_fields_present` 时才会出现——不会为 null，
            也不会是空数组；其他情况下不出现。字段仅从你自己的请求中列出，且仅在
            sealed variant hash 匹配之后。已被服务的 best-effort 重试已按
            正常价格计费；不会追溯兑换，但在该令牌的五分钟窗口内
            发送修正后的重发请求仍可兑换。
          title: 兑换时需要移除的内容
        type:
          const: not_applied
          default: not_applied
          title: 类型
          type: string
      required:
        - reason
        - type
      title: FallbackCreditNotApplied
      type: object
    BetaFallbackCreditRedeemed:
      description: |-
        已应用重新定价：重试的计费方式如同整个会话
        一直使用的是重试模型。
      properties:
        type:
          const: redeemed
          default: redeemed
          title: 类型
          type: string
      required:
        - type
      title: FallbackCreditRedeemed
      type: object
    BetaAdvisorMessageIterationUsage:
      description: 一次顾问子推理迭代的令牌用量。
      properties:
        cache_creation:
          anyOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
            - type: 'null'
          default: null
          description: 按 TTL 划分的缓存令牌明细
        cache_creation_input_tokens:
          default: 0
          description: 用于创建缓存条目的输入令牌数。
          minimum: 0
          title: 缓存创建输入令牌数
          type: integer
        cache_read_input_tokens:
          default: 0
          description: 从缓存读取的输入令牌数。
          minimum: 0
          title: 缓存读取输入令牌数
          type: integer
        input_tokens:
          description: 已使用的输入令牌数。
          minimum: 0
          title: 输入令牌数
          type: integer
        model:
          $ref: '#/components/schemas/Model'
        output_tokens:
          description: 已使用的输出令牌数。
          minimum: 0
          title: 输出令牌数
          type: integer
        type:
          const: advisor_message
          default: advisor_message
          description: 顾问子推理迭代的用量
          title: 类型
          type: string
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - model
        - output_tokens
        - type
      title: AdvisorMessageIterationUsage
      type: object
    BetaCompactionIterationUsage:
      description: 单次 compaction 迭代的令牌用量。
      properties:
        cache_creation:
          anyOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
            - type: 'null'
          default: null
          description: 按 TTL 划分的缓存令牌明细
        cache_creation_input_tokens:
          default: 0
          description: 用于创建缓存条目的输入令牌数。
          minimum: 0
          title: 缓存创建输入令牌数
          type: integer
        cache_read_input_tokens:
          default: 0
          description: 从缓存读取的输入令牌数。
          minimum: 0
          title: 缓存读取输入令牌数
          type: integer
        input_tokens:
          description: 已使用的输入令牌数。
          minimum: 0
          title: 输入令牌数
          type: integer
        output_tokens:
          description: 已使用的输出令牌数。
          minimum: 0
          title: 输出令牌数
          type: integer
        type:
          const: compaction
          default: compaction
          description: 压缩迭代的用量
          title: 类型
          type: string
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - output_tokens
        - type
      title: CompactionIterationUsage
      type: object
    BetaFallbackMessageIterationUsage:
      description: |-
        服务端 fallback 请求中，备用模型尝试的令牌用量。

        它替代 `message` 条目生成，对应实际提供响应的那一跳。
        被拒绝的跳仍生成现有的 `message` 条目。是否由备用模型提供了响应，
        通过 `usage.iterations` 中是否存在此条目来判断。
      properties:
        cache_creation:
          anyOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
            - type: 'null'
          default: null
          description: 按 TTL 划分的缓存令牌明细
        cache_creation_input_tokens:
          default: 0
          description: 用于创建缓存条目的输入令牌数。
          minimum: 0
          title: 缓存创建输入令牌数
          type: integer
        cache_read_input_tokens:
          default: 0
          description: 从缓存读取的输入令牌数。
          minimum: 0
          title: 缓存读取输入令牌数
          type: integer
        input_tokens:
          description: 已使用的输入令牌数。
          minimum: 0
          title: 输入令牌数
          type: integer
        model:
          $ref: '#/components/schemas/Model'
        output_tokens:
          description: 已使用的输出令牌数。
          minimum: 0
          title: 输出令牌数
          type: integer
        type:
          const: fallback_message
          default: fallback_message
          description: 提供该响应的备用模型尝试的用量
          title: 类型
          type: string
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - model
        - output_tokens
        - type
      title: FallbackMessageIterationUsage
      type: object
    BetaMessageIterationUsage:
      description: 采样迭代的令牌用量。
      properties:
        cache_creation:
          anyOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
            - type: 'null'
          default: null
          description: 按 TTL 划分的缓存令牌明细
        cache_creation_input_tokens:
          default: 0
          description: 用于创建缓存条目的输入令牌数。
          minimum: 0
          title: 缓存创建输入令牌数
          type: integer
        cache_read_input_tokens:
          default: 0
          description: 从缓存读取的输入令牌数。
          minimum: 0
          title: 缓存读取输入令牌数
          type: integer
        input_tokens:
          description: 已使用的输入令牌数。
          minimum: 0
          title: 输入令牌数
          type: integer
        model:
          $ref: '#/components/schemas/Model'
        output_tokens:
          description: 已使用的输出令牌数。
          minimum: 0
          title: 输出令牌数
          type: integer
        type:
          const: message
          default: message
          description: 采样迭代的用量
          title: 类型
          type: string
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - model
        - output_tokens
        - type
      title: MessageIterationUsage
      type: object
    BetaRequestAdvisorToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaAdvisorToolResultErrorCode'
        type:
          const: advisor_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: RequestAdvisorToolResultError
      type: object
    BetaRequestAdvisorResultBlock:
      additionalProperties: false
      properties:
        stop_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: 停止原因
        text:
          title: 文本
          type: string
        type:
          const: advisor_result
          title: 类型
          type: string
      required:
        - text
        - type
      title: RequestAdvisorResultBlock
      type: object
    BetaRequestAdvisorRedactedResultBlock:
      additionalProperties: false
      properties:
        encrypted_content:
          description: 由先前响应生成的不透明数据块；必须原样回传。
          title: 加密内容
          type: string
        stop_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: 停止原因
        type:
          const: advisor_redacted_result
          title: 类型
          type: string
      required:
        - encrypted_content
        - type
      title: RequestAdvisorRedactedResultBlock
      type: object
    BetaRequestBashCodeExecutionToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaBashCodeExecutionToolResultErrorCode'
        type:
          const: bash_code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: RequestBashCodeExecutionToolResultError
      type: object
    BetaRequestBashCodeExecutionResultBlock:
      additionalProperties: false
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaRequestBashCodeExecutionOutputBlock'
          title: 内容
          type: array
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        stdout:
          title: 标准输出
          type: string
        type:
          const: bash_code_execution_result
          title: 类型
          type: string
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      title: RequestBashCodeExecutionResultBlock
      type: object
    BetaRequestCodeExecutionToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode'
        type:
          const: code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: Error
      type: object
    BetaRequestCodeExecutionResultBlock:
      additionalProperties: false
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaRequestCodeExecutionOutputBlock'
          title: 内容
          type: array
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        stdout:
          title: 标准输出
          type: string
        type:
          const: code_execution_result
          title: 类型
          type: string
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      title: Result Block
      type: object
    BetaRequestEncryptedCodeExecutionResultBlock:
      additionalProperties: false
      description: 带有加密 stdout 的代码执行结果，用于 PFC + web_search 结果。
      properties:
        content:
          items:
            $ref: '#/components/schemas/BetaRequestCodeExecutionOutputBlock'
          title: 内容
          type: array
        encrypted_stdout:
          title: 加密标准输出
          type: string
        return_code:
          title: 返回码
          type: integer
        stderr:
          title: 标准错误输出
          type: string
        type:
          const: encrypted_code_execution_result
          title: 类型
          type: string
      required:
        - content
        - encrypted_stdout
        - return_code
        - stderr
        - type
      title: RequestEncryptedCodeExecutionResultBlock
      type: object
    BetaBase64PDFSource:
      additionalProperties: false
      properties:
        data:
          format: byte
          title: 数据
          type: string
        media_type:
          const: application/pdf
          title: 媒体类型
          type: string
        type:
          const: base64
          title: 类型
          type: string
      required:
        - data
        - media_type
        - type
      title: Base64PDFSource
      type: object
    BetaContentBlockSource:
      additionalProperties: false
      properties:
        content:
          anyOf:
            - type: string
            - items:
                discriminator:
                  mapping:
                    image:
                      $ref: '#/components/schemas/BetaRequestImageBlock'
                    text:
                      $ref: '#/components/schemas/BetaRequestTextBlock'
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/BetaRequestTextBlock'
                  - $ref: '#/components/schemas/BetaRequestImageBlock'
                title: beta_content_block_source_content_item
              type: array
              title: beta_content_block_source_content
          title: 内容
        type:
          const: content
          title: 类型
          type: string
      required:
        - content
        - type
      title: ContentBlockSource
      type: object
    BetaFileDocumentSource:
      additionalProperties: false
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: file
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: FileDocumentSource
      type: object
    BetaPlainTextSource:
      additionalProperties: false
      properties:
        data:
          title: 数据
          type: string
        media_type:
          const: text/plain
          title: 媒体类型
          type: string
        type:
          const: text
          title: 类型
          type: string
      required:
        - data
        - media_type
        - type
      title: PlainTextSource
      type: object
    BetaURLPDFSource:
      additionalProperties: false
      properties:
        type:
          const: url
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - type
        - url
      title: URLPDFSource
      type: object
    BetaRequestFallbackHopInfo:
      additionalProperties: false
      description: 标识回退转换中的一跳。
      properties:
        model:
          $ref: '#/components/schemas/Model'
      required:
        - model
      title: RequestFallbackHopInfo
      type: object
    BetaBase64ImageSource:
      additionalProperties: false
      properties:
        data:
          format: byte
          title: 数据
          type: string
        media_type:
          enum:
            - image/jpeg
            - image/png
            - image/gif
            - image/webp
          title: 媒体类型
          type: string
        type:
          const: base64
          title: 类型
          type: string
      required:
        - data
        - media_type
        - type
      title: Base64ImageSource
      type: object
    BetaFileImageSource:
      additionalProperties: false
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: file
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: FileImageSource
      type: object
    BetaURLImageSource:
      additionalProperties: false
      properties:
        type:
          const: url
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - type
        - url
      title: URLImageSource
      type: object
    BetaRequestTextEditorCodeExecutionToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: 错误消息
        type:
          const: text_editor_code_execution_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: RequestTextEditorCodeExecutionToolResultError
      type: object
    BetaRequestTextEditorCodeExecutionViewResultBlock:
      additionalProperties: false
      properties:
        content:
          title: 内容
          type: string
        file_type:
          enum:
            - text
            - image
            - pdf
          title: 文件类型
          type: string
        num_lines:
          anyOf:
            - type: integer
            - type: 'null'
          title: 行数
        start_line:
          anyOf:
            - type: integer
            - type: 'null'
          title: 起始行
        total_lines:
          anyOf:
            - type: integer
            - type: 'null'
          title: 总行数
        type:
          const: text_editor_code_execution_view_result
          title: 类型
          type: string
      required:
        - content
        - file_type
        - type
      title: RequestTextEditorCodeExecutionViewResultBlock
      type: object
    BetaRequestTextEditorCodeExecutionCreateResultBlock:
      additionalProperties: false
      properties:
        is_file_update:
          title: 是否为文件更新
          type: boolean
        type:
          const: text_editor_code_execution_create_result
          title: 类型
          type: string
      required:
        - is_file_update
        - type
      title: RequestTextEditorCodeExecutionCreateResultBlock
      type: object
    BetaRequestTextEditorCodeExecutionStrReplaceResultBlock:
      additionalProperties: false
      properties:
        lines:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: 行
        new_lines:
          anyOf:
            - type: integer
            - type: 'null'
          title: 新行
        new_start:
          anyOf:
            - type: integer
            - type: 'null'
          title: 新起始位置
        old_lines:
          anyOf:
            - type: integer
            - type: 'null'
          title: 原行
        old_start:
          anyOf:
            - type: integer
            - type: 'null'
          title: 原起始位置
        type:
          const: text_editor_code_execution_str_replace_result
          title: 类型
          type: string
      required:
        - type
      title: RequestTextEditorCodeExecutionStrReplaceResultBlock
      type: object
    BetaToolChangeMCPToolReference:
      additionalProperties: false
      description: |-
        通过 server 和 remote name 引用单个 MCP 工具 —— 与
        ``mcp_tool_use`` 所携带的 ``server_name``/``name`` 对相同。
      properties:
        name:
          title: 名称
          type: string
        server_name:
          title: 服务器名称
          type: string
        type:
          const: mcp_tool_reference
          title: 类型
          type: string
      required:
        - name
        - server_name
        - type
      title: ToolChangeMCPToolReference
      type: object
    BetaToolChangeMCPToolsetReference:
      additionalProperties: false
      description: 对指定 MCP 服务器工具集中所有工具的引用。
      properties:
        server_name:
          title: 服务器名称
          type: string
        type:
          const: mcp_toolset_reference
          title: 类型
          type: string
      required:
        - server_name
        - type
      title: ToolChangeMCPToolsetReference
      type: object
    BetaToolChangeToolReference:
      additionalProperties: false
      description: >-
        引用调用方直接在

        ``tools[]`` 中声明的单个工具。不接受服务端为 MCP 解析出的工具所分配的

        ``{server}_{name}`` 组合形式——这些工具请使用 ``mcp_tool_reference`` 或
        ``mcp_toolset_reference``。
      properties:
        name:
          pattern: ^[a-zA-Z0-9_-]{1,128}$
          title: 名称
          type: string
        type:
          const: tool_reference
          title: 类型
          type: string
      required:
        - name
        - type
      title: ToolChangeToolReference
      type: object
    BetaRequestToolReferenceBlock:
      additionalProperties: false
      description: 可包含在 tool_result 内容中的工具引用块。
      properties:
        cache_control:
          anyOf:
            - discriminator:
                mapping:
                  ephemeral:
                    $ref: '#/components/schemas/BetaCacheControlEphemeral'
                propertyName: type
              oneOf:
                - $ref: '#/components/schemas/BetaCacheControlEphemeral'
            - type: 'null'
          description: 在此内容块处创建缓存控制断点。
          title: 缓存控制
        tool_name:
          maxLength: 256
          minLength: 1
          pattern: ^[a-zA-Z0-9_-]{1,256}$
          title: 工具名称
          type: string
        type:
          const: tool_reference
          title: 类型
          type: string
      required:
        - tool_name
        - type
      title: RequestToolReferenceBlock
      type: object
    BetaRequestToolSearchToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaToolSearchToolResultErrorCode'
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: 错误消息
        type:
          const: tool_search_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: RequestToolSearchToolResultError
      type: object
    BetaRequestToolSearchToolSearchResultBlock:
      additionalProperties: false
      properties:
        tool_references:
          items:
            $ref: '#/components/schemas/BetaRequestToolReferenceBlock'
          title: 工具引用
          type: array
        type:
          const: tool_search_tool_search_result
          title: 类型
          type: string
      required:
        - tool_references
        - type
      title: RequestToolSearchToolSearchResultBlock
      type: object
    BetaRequestWebFetchToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode'
        type:
          const: web_fetch_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: RequestWebFetchToolResultError
      type: object
    BetaRequestWebFetchResultBlock:
      additionalProperties: false
      properties:
        content:
          $ref: '#/components/schemas/BetaRequestDocumentBlock'
        retrieved_at:
          anyOf:
            - type: string
            - type: 'null'
          description: 内容获取时间的 ISO 8601 时间戳
          title: 获取时间
        type:
          const: web_fetch_result
          title: 类型
          type: string
        url:
          description: 已抓取内容的 URL
          title: URL
          type: string
      required:
        - content
        - type
        - url
      title: RequestWebFetchResultBlock
      type: object
    BetaRequestWebSearchResultBlock:
      additionalProperties: false
      properties:
        encrypted_content:
          title: 加密内容
          type: string
        page_age:
          anyOf:
            - type: string
            - type: 'null'
          title: 页面时效
        title:
          title: 标题
          type: string
        type:
          const: web_search_result
          title: 类型
          type: string
        url:
          title: URL
          type: string
      required:
        - encrypted_content
        - title
        - type
        - url
      title: RequestWebSearchResultBlock
      type: object
    BetaRequestWebSearchToolResultError:
      additionalProperties: false
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode'
        type:
          const: web_search_tool_result_error
          title: 类型
          type: string
      required:
        - error_code
        - type
      title: Error
      type: object
    BetaAdvisorToolResultErrorCode:
      enum:
        - max_uses_exceeded
        - prompt_too_long
        - too_many_requests
        - overloaded
        - unavailable
        - execution_time_exceeded
        - model_not_found
      title: AdvisorToolResultErrorCode
      type: string
    BetaBashCodeExecutionToolResultErrorCode:
      enum:
        - invalid_tool_input
        - unavailable
        - too_many_requests
        - execution_time_exceeded
        - output_file_too_large
      title: BashCodeExecutionToolResultErrorCode
      type: string
    BetaResponseBashCodeExecutionOutputBlock:
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: bash_code_execution_output
          default: bash_code_execution_output
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: ResponseBashCodeExecutionOutputBlock
      type: object
    BetaCodeExecutionToolResultErrorCode:
      enum:
        - invalid_tool_input
        - unavailable
        - too_many_requests
        - execution_time_exceeded
      title: CodeExecutionToolResultErrorCode
      type: string
    BetaResponseCodeExecutionOutputBlock:
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: code_execution_output
          default: code_execution_output
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: ResponseCodeExecutionOutputBlock
      type: object
    BetaTextEditorCodeExecutionToolResultErrorCode:
      enum:
        - invalid_tool_input
        - unavailable
        - too_many_requests
        - execution_time_exceeded
        - file_not_found
      title: TextEditorCodeExecutionToolResultErrorCode
      type: string
    BetaToolSearchToolResultErrorCode:
      enum:
        - invalid_tool_input
        - unavailable
        - too_many_requests
        - execution_time_exceeded
      title: ToolSearchToolResultErrorCode
      type: string
    BetaResponseToolReferenceBlock:
      properties:
        tool_name:
          maxLength: 256
          minLength: 1
          pattern: ^[a-zA-Z0-9_-]{1,256}$
          title: 工具名称
          type: string
        type:
          const: tool_reference
          default: tool_reference
          title: 类型
          type: string
      required:
        - tool_name
        - type
      title: ResponseToolReferenceBlock
      type: object
    BetaWebFetchToolResultErrorCode:
      enum:
        - invalid_tool_input
        - url_too_long
        - url_not_allowed
        - url_not_in_prior_context
        - url_not_accessible
        - unsupported_content_type
        - too_many_requests
        - max_uses_exceeded
        - unavailable
      title: WebFetchToolResultErrorCode
      type: string
    BetaResponseDocumentBlock:
      properties:
        citations:
          anyOf:
            - $ref: '#/components/schemas/BetaResponseCitationsConfig'
            - type: 'null'
          default: null
          description: 文档的引用配置
        source:
          discriminator:
            mapping:
              base64:
                $ref: '#/components/schemas/BetaBase64PDFSource'
              text:
                $ref: '#/components/schemas/BetaPlainTextSource'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaBase64PDFSource'
            - $ref: '#/components/schemas/BetaPlainTextSource'
          title: 来源
        title:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 文档的标题
          title: 标题
        type:
          const: document
          default: document
          title: 类型
          type: string
      required:
        - citations
        - source
        - title
        - type
      title: ResponseDocumentBlock
      type: object
    BetaWebSearchToolResultErrorCode:
      enum:
        - invalid_tool_input
        - unavailable
        - max_uses_exceeded
        - too_many_requests
        - query_too_long
        - request_too_large
      title: WebSearchToolResultErrorCode
      type: string
    BetaRequestBashCodeExecutionOutputBlock:
      additionalProperties: false
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: bash_code_execution_output
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: RequestBashCodeExecutionOutputBlock
      type: object
    BetaRequestCodeExecutionOutputBlock:
      additionalProperties: false
      properties:
        file_id:
          title: 文件 ID
          type: string
        type:
          const: code_execution_output
          title: 类型
          type: string
      required:
        - file_id
        - type
      title: RequestCodeExecutionOutputBlock
      type: object
    BetaResponseCitationsConfig:
      properties:
        enabled:
          default: false
          title: 已启用
          type: boolean
      required:
        - enabled
      title: ResponseCitationsConfig
      type: object
  securitySchemes:
    omaApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: OMA 工作区 API 密钥。
      x-default: sk-ant-local-default
    omaBearer:
      type: http
      scheme: bearer
      description: 以 Bearer 令牌形式发送的 OMA 工作区 API 密钥。

````