> ## 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>要使用此处展示的 Beta 请求和响应结构，请同时发送 `?beta=true` 与 `anthropic-beta: message-batches-2024-09-24`。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json get /v1/messages/batches/{message_batch_id}/results
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/batches/{message_batch_id}/results:
    get:
      summary: 检索消息批处理结果
      description: 通过 OMA API 检索消息批处理结果。
      operationId: beta_message_batches_results
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: message_batch_id
          in: path
          required: true
          schema:
            type: string
            description: 消息批处理的 ID。
            title: 消息批处理 ID
          description: 消息批处理的 ID。
        - name: anthropic-beta
          in: header
          required: true
          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'
            x-default: message-batches-2024-09-24
          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 版本。

            在此处阅读更多关于版本控制和我们版本历史的信息。
      responses:
        '200':
          description: 成功的响应
          content:
            application/x-jsonl:
              schema:
                $ref: '#/components/schemas/BetaMessageBatchIndividualResponse'
        4XX:
          description: |-
            错误响应。

            详见我们的错误文档。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
components:
  schemas:
    BetaMessageBatchIndividualResponse:
      description: 这是响应 `.jsonl` 文件中的一行，不代表整个响应。
      properties:
        custom_id:
          description: |-
            为消息批处理中的每个请求创建的开发者提供的 ID。由于结果可能不按请求顺序给出，可用于将结果与请求匹配。

            在消息批处理内必须对每个请求唯一。
          examples:
            - my-custom-id-1
          title: 自定义 ID
          type: string
        result:
          description: |-
            该请求的处理结果。

            如果处理成功，包含消息输出；如果处理失败，包含错误响应；如果未尝试处理，则包含原因，例如已取消或已过期。
          discriminator:
            mapping:
              canceled:
                $ref: '#/components/schemas/BetaCanceledResult'
              errored:
                $ref: '#/components/schemas/BetaErroredResult'
              expired:
                $ref: '#/components/schemas/BetaExpiredResult'
              succeeded:
                $ref: '#/components/schemas/BetaSucceededResult'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaSucceededResult'
            - $ref: '#/components/schemas/BetaErroredResult'
            - $ref: '#/components/schemas/BetaCanceledResult'
            - $ref: '#/components/schemas/BetaExpiredResult'
          title: 结果
      required:
        - custom_id
        - result
      title: MessageBatchIndividualResponse
      type: object
    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
    BetaCanceledResult:
      properties:
        type:
          const: canceled
          default: canceled
          title: 类型
          type: string
      required:
        - type
      title: CanceledResult
      type: object
    BetaErroredResult:
      properties:
        error:
          $ref: '#/components/schemas/BetaErrorResponse'
        type:
          const: errored
          default: errored
          title: 类型
          type: string
      required:
        - error
        - type
      title: ErroredResult
      type: object
    BetaExpiredResult:
      properties:
        type:
          const: expired
          default: expired
          title: 类型
          type: string
      required:
        - type
      title: ExpiredResult
      type: object
    BetaSucceededResult:
      properties:
        message:
          $ref: '#/components/schemas/BetaMessage'
        type:
          const: succeeded
          default: succeeded
          title: 类型
          type: string
      required:
        - message
        - type
      title: SucceededResult
      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
    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
    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'
    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
    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
    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
    BetaSpeed:
      type: string
      description: 推理速度模式。`fast` 以较高价格提供显著更快的输出令牌生成速度。并非所有模型都支持 `fast`；无效组合会在创建时被拒绝。
      enum:
        - standard
        - fast
    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
    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
    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
    BetaResponseCitationsConfig:
      properties:
        enabled:
          default: false
          title: 已启用
          type: boolean
      required:
        - enabled
      title: ResponseCitationsConfig
      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
    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
  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 密钥。

````