> ## Documentation Index
> Fetch the complete documentation index at: https://docs.senseaudio.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 消息 (Messages)

> 发送结构化的输入消息列表（支持文本和/或图片内容），模型将在会话中生成下一条消息。



## OpenAPI

````yaml api-reference/endpoint/llm/messages.openapi.json POST /v1/messages
openapi: 3.0.3
info:
  title: SenseAudio Messages API
  description: 发送结构化的输入消息列表（支持文本和/或图片内容），模型将在会话中生成下一条消息。Messages API 既可用于单次查询，也可用于无状态的多轮对话。
  version: beta
  contact:
    name: SenseAudio
    url: https://docs.senseaudio.cn
servers:
  - url: https://api.senseaudio.cn
    description: 生产环境
security:
  - bearerAuth: []
paths:
  /v1/messages:
    post:
      summary: 创建消息 (Create a Message)
      description: 发送结构化的输入消息列表（支持文本和/或图片内容），模型将在会话中生成下一条消息。
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageCreateParams'
            example:
              model: senseaudio-s2
              max_tokens: 1024
              messages:
                - role: user
                  content: 你好，Claude！请简要介绍一下你自己。
              temperature: 1
              stream: false
      responses:
        '200':
          description: 成功响应：非流式模式返回完整消息，流式模式（stream=true）返回 Server-Sent Events 事件流。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaMessage'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/BetaRawMessageStreamEvent'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 身份验证错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    MessageCreateParams:
      type: object
      required:
        - max_tokens
        - messages
        - model
      properties:
        max_tokens:
          type: integer
          description: 生成的最大 token 数，达到该值后模型将停止生成。
          example: 1024
        messages:
          type: array
          description: 输入消息列表。单次请求最多包含 100,000 条消息。
          maxItems: 100000
          items:
            $ref: '#/components/schemas/BetaMessageParam'
        model:
          $ref: '#/components/schemas/Model'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
          description: 顶层缓存控制；将自动在请求中最后一个可缓存的内容块上添加 cache_control 标记。
        container:
          oneOf:
            - $ref: '#/components/schemas/BetaContainerParams'
            - type: string
          nullable: true
          description: 容器标识符，用于跨请求复用。
        context_management:
          allOf:
            - $ref: '#/components/schemas/BetaContextManagementConfig'
          nullable: true
        inference_geo:
          type: string
          nullable: true
          description: 指定推理处理的地理区域。
          example: us
        mcp_servers:
          type: array
          description: 本次请求中使用的 MCP 服务器
          items:
            $ref: '#/components/schemas/BetaRequestMCPServerURLDefinition'
        metadata:
          $ref: '#/components/schemas/BetaMetadata'
        output_config:
          $ref: '#/components/schemas/BetaOutputConfig'
        output_format:
          allOf:
            - $ref: '#/components/schemas/BetaJSONOutputFormat'
          nullable: true
          description: 已废弃：请改用 output_config.format。
        service_tier:
          type: string
          enum:
            - auto
            - standard_only
          description: 是否优先使用优先容量（可用时），或仅使用标准容量。
          default: auto
          example: auto
        speed:
          type: string
          nullable: true
          enum:
            - standard
            - fast
          description: 推理速度模式。'fast' 模式启用每秒更高输出 token 数的推理。
          default: standard
          example: standard
        stop_sequences:
          type: array
          description: 自定义停止文本序列，模型在生成到这些序列时会停止。
          items:
            type: string
            example: |-


              Human:
        stream:
          type: boolean
          description: 是否通过 Server-Sent Events (SSE) 以增量方式流式返回响应。
          default: false
          example: false
        system:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/BetaTextBlockParam'
          description: 系统提示词（System Prompt）。
          example: 你是一个严谨且乐于助人的人工智能助手。
        temperature:
          type: number
          minimum: 0
          maximum: 1
          description: 响应的随机性强度。默认值为 1.0。
          default: 1
          example: 1
        thinking:
          $ref: '#/components/schemas/BetaThinkingConfigParam'
        tool_choice:
          $ref: '#/components/schemas/BetaToolChoice'
        tools:
          type: array
          description: 模型可以使用的工具定义列表。
          items:
            $ref: '#/components/schemas/BetaToolUnion'
        top_k:
          type: integer
          description: 仅从每个后续 token 的 top-K 个候选中采样。
          example: 5
        top_p:
          type: number
          description: 使用核采样（nucleus sampling）。
          example: 0.9
        user_profile_id:
          type: string
          nullable: true
          description: 用于归属本次请求的用户配置 ID。
          example: user-profile-123
    BetaMessage:
      type: object
      description: 模型生成的消息响应对象。
      required:
        - id
        - content
        - model
        - role
        - type
        - usage
      properties:
        id:
          type: string
          description: 唯一对象标识符。
          example: msg_01ABCDxyz0123456789
        container:
          allOf:
            - $ref: '#/components/schemas/BetaContainer'
          nullable: true
        content:
          type: array
          description: 响应内容块列表。
          items:
            $ref: '#/components/schemas/BetaContentBlock'
        context_management:
          allOf:
            - $ref: '#/components/schemas/BetaContextManagementResponse'
          nullable: true
        model:
          $ref: '#/components/schemas/Model'
        role:
          type: string
          description: 消息角色，响应固定为 assistant。
          enum:
            - assistant
          default: assistant
          example: assistant
        stop_details:
          allOf:
            - $ref: '#/components/schemas/BetaRefusalStopDetails'
          nullable: true
        stop_reason:
          allOf:
            - $ref: '#/components/schemas/BetaStopReason'
          nullable: true
        stop_sequence:
          type: string
          nullable: true
          description: 触发停止生成的自定义停止序列（若命中）。
          example: |-


            Human:
        type:
          type: string
          description: 对象类型，固定为 message。
          enum:
            - message
          default: message
          example: message
        usage:
          $ref: '#/components/schemas/BetaUsage'
    BetaRawMessageStreamEvent:
      type: object
      description: >-
        流式模式下的 Server-Sent Events (SSE) 事件。事件类型包括
        message_start、content_block_start、content_block_delta、content_block_stop、message_delta、message_stop、ping、error。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - message_start
            - content_block_start
            - content_block_delta
            - content_block_stop
            - message_delta
            - message_stop
            - ping
            - error
      additionalProperties: true
    ErrorResponse:
      type: object
      description: 错误响应对象。
      properties:
        type:
          type: string
          description: 响应对象类型，固定为 error。
          default: error
          example: error
        error:
          type: object
          description: 错误详情。
          properties:
            type:
              type: string
              description: 错误类型标识，如 invalid_request_error、authentication_error 等。
              example: invalid_request_error
            message:
              type: string
              description: 错误详细信息。
              example: Invalid API key.
    BetaMessageParam:
      type: object
      description: 输入消息。支持字符串或多模态内容块数组。
      required:
        - content
        - role
      properties:
        content:
          description: 消息内容。可以是纯文本字符串，或由文本 / 图片 / 工具调用等内容块组成的数组。
          oneOf:
            - type: string
              example: 你好，Claude！
            - type: array
              items:
                $ref: '#/components/schemas/BetaContentBlockParam'
        role:
          type: string
          description: 对话角色。
          enum:
            - user
            - assistant
          example: user
    Model:
      description: 用于补全你提示词的模型。
      type: string
      enum:
        - deepseek-v4-flash
        - deepseek-v4-pro
        - doubao-seed-2-0-pro-260215
        - glm-5.1
        - glm-5.2
        - kimi-k2.6
        - minimax-m2.7
        - qwen3.6-27b
        - qwen3.6-35b-a3b
        - senseaudio-s2
        - senseaudio-s1
        - senseaudio-s2-flash
        - senseaudio-s2-lite
        - senseaudio-vl-1.0-260319
        - senseaudio-vl-lite-1.0-260319
        - sensenova-6.7-flash-lite
      default: senseaudio-s2
      example: senseaudio-s2
    BetaCacheControlEphemeral:
      type: object
      description: 在当前内容块上创建一个缓存控制断点（cache breakpoint）。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - ephemeral
          default: ephemeral
          example: ephemeral
        ttl:
          type: string
          description: 缓存断点的存活时间（TTL）。默认值为 5m。
          enum:
            - 5m
            - 1h
          default: 5m
          example: 5m
    BetaContainerParams:
      type: object
      description: 容器参数，包含需要加载的技能列表。
      properties:
        id:
          type: string
          nullable: true
          description: 容器 ID。
          example: container_abc123
        skills:
          type: array
          nullable: true
          description: 要在容器中加载的技能列表。
          items:
            $ref: '#/components/schemas/BetaSkillParams'
    BetaContextManagementConfig:
      type: object
      description: 上下文管理配置。控制 Claude 在多次请求之间如何管理上下文。
      properties:
        edits:
          type: array
          description: 要应用的上下文管理编辑操作列表。
          items:
            $ref: '#/components/schemas/BetaContextManagementEdit'
    BetaRequestMCPServerURLDefinition:
      type: object
      description: 通过 URL 连接的 MCP 服务器定义。
      required:
        - name
        - type
        - url
      properties:
        name:
          type: string
          description: MCP 服务器名称。
          example: my-mcp-server
        type:
          type: string
          enum:
            - url
          default: url
          example: url
        url:
          type: string
          description: MCP 服务器的访问 URL。
          example: https://example.com/mcp
        authorization_token:
          type: string
          nullable: true
          description: 可选的鉴权 Token。
          example: Bearer xxx
        tool_configuration:
          allOf:
            - $ref: '#/components/schemas/BetaRequestMCPServerToolConfiguration'
          nullable: true
    BetaMetadata:
      type: object
      description: 描述请求相关的元数据对象。
      properties:
        user_id:
          type: string
          nullable: true
          description: 与该请求关联的用户的外部标识符。建议使用 UUID、哈希值或不透明标识符，切勿包含姓名、邮箱或电话号码等可识别信息。
          example: user-123e4567-e89b-12d3-a456-426614174000
    BetaOutputConfig:
      type: object
      description: 模型输出配置选项，例如输出格式等。
      properties:
        effort:
          type: string
          nullable: true
          description: 生成时的努力程度（effort）。
          enum:
            - low
            - medium
            - high
            - xhigh
            - max
          example: medium
        format:
          allOf:
            - $ref: '#/components/schemas/BetaJSONOutputFormat'
          nullable: true
        task_budget:
          allOf:
            - $ref: '#/components/schemas/BetaTokenTaskBudget'
          nullable: true
    BetaJSONOutputFormat:
      type: object
      description: 用于指定 Claude 在响应中输出格式的 schema。
      required:
        - schema
        - type
      properties:
        schema:
          type: object
          additionalProperties: true
          description: 输出格式对应的 JSON Schema。
        type:
          type: string
          enum:
            - json_schema
          default: json_schema
          example: json_schema
    BetaTextBlockParam:
      type: object
      description: 文本内容块。
      required:
        - text
        - type
      properties:
        text:
          type: string
          description: 文本内容。
          example: 你好，请解释一下什么是黑洞？
        type:
          type: string
          enum:
            - text
          default: text
          example: text
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/BetaTextCitationParam'
    BetaThinkingConfigParam:
      oneOf:
        - $ref: '#/components/schemas/BetaThinkingConfigEnabled'
        - $ref: '#/components/schemas/BetaThinkingConfigDisabled'
        - $ref: '#/components/schemas/BetaThinkingConfigAdaptive'
      discriminator:
        propertyName: type
    BetaToolChoice:
      oneOf:
        - $ref: '#/components/schemas/BetaToolChoiceAuto'
        - $ref: '#/components/schemas/BetaToolChoiceAny'
        - $ref: '#/components/schemas/BetaToolChoiceTool'
        - $ref: '#/components/schemas/BetaToolChoiceNone'
      discriminator:
        propertyName: type
    BetaToolUnion:
      oneOf:
        - $ref: '#/components/schemas/BetaTool'
        - $ref: '#/components/schemas/BetaToolBash20241022'
        - $ref: '#/components/schemas/BetaToolBash20250124'
        - $ref: '#/components/schemas/BetaCodeExecutionTool20250522'
        - $ref: '#/components/schemas/BetaCodeExecutionTool20250825'
        - $ref: '#/components/schemas/BetaCodeExecutionTool20260120'
        - $ref: '#/components/schemas/BetaToolComputerUse20241022'
        - $ref: '#/components/schemas/BetaMemoryTool20250818'
        - $ref: '#/components/schemas/BetaToolComputerUse20250124'
        - $ref: '#/components/schemas/BetaToolTextEditor20241022'
        - $ref: '#/components/schemas/BetaToolComputerUse20251124'
        - $ref: '#/components/schemas/BetaToolTextEditor20250124'
        - $ref: '#/components/schemas/BetaToolTextEditor20250429'
        - $ref: '#/components/schemas/BetaToolTextEditor20250728'
        - $ref: '#/components/schemas/BetaWebSearchTool20250305'
        - $ref: '#/components/schemas/BetaWebFetchTool20250910'
        - $ref: '#/components/schemas/BetaWebSearchTool20260209'
        - $ref: '#/components/schemas/BetaWebFetchTool20260209'
        - $ref: '#/components/schemas/BetaWebFetchTool20260309'
        - $ref: '#/components/schemas/BetaAdvisorTool20260301'
        - $ref: '#/components/schemas/BetaToolSearchToolBm25_20251119'
        - $ref: '#/components/schemas/BetaToolSearchToolRegex20251119'
        - $ref: '#/components/schemas/BetaMCPToolset'
    BetaContainer:
      type: object
      description: >-
        Information about the container used in the request (for the code
        execution tool)
      required:
        - id
        - expires_at
        - skills
      properties:
        id:
          type: string
        expires_at:
          type: string
          format: date-time
        skills:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/BetaSkill'
    BetaContentBlock:
      oneOf:
        - $ref: '#/components/schemas/BetaTextBlock'
        - $ref: '#/components/schemas/BetaThinkingBlock'
        - $ref: '#/components/schemas/BetaRedactedThinkingBlock'
        - $ref: '#/components/schemas/BetaToolUseBlock'
        - $ref: '#/components/schemas/BetaServerToolUseBlock'
        - $ref: '#/components/schemas/BetaWebSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaWebFetchToolResultBlock'
        - $ref: '#/components/schemas/BetaAdvisorToolResultBlock'
        - $ref: '#/components/schemas/BetaCodeExecutionToolResultBlock'
        - $ref: '#/components/schemas/BetaBashCodeExecutionToolResultBlock'
        - $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultBlock'
        - $ref: '#/components/schemas/BetaToolSearchToolResultBlock'
        - $ref: '#/components/schemas/BetaMCPToolUseBlock'
        - $ref: '#/components/schemas/BetaMCPToolResultBlock'
        - $ref: '#/components/schemas/BetaContainerUploadBlock'
        - $ref: '#/components/schemas/BetaCompactionBlock'
      discriminator:
        propertyName: type
    BetaContextManagementResponse:
      type: object
      required:
        - applied_edits
      properties:
        applied_edits:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/BetaClearToolUses20250919EditResponse'
              - $ref: '#/components/schemas/BetaClearThinking20251015EditResponse'
    BetaRefusalStopDetails:
      type: object
      required:
        - category
        - explanation
        - type
      properties:
        category:
          type: string
          nullable: true
          enum:
            - cyber
            - bio
        explanation:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - refusal
    BetaStopReason:
      type: string
      enum:
        - end_turn
        - max_tokens
        - stop_sequence
        - tool_use
        - pause_turn
        - compaction
        - refusal
        - model_context_window_exceeded
    BetaUsage:
      type: object
      description: Billing and rate-limit usage.
      required:
        - input_tokens
        - output_tokens
      properties:
        cache_creation:
          allOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
          nullable: true
        cache_creation_input_tokens:
          type: integer
          nullable: true
        cache_read_input_tokens:
          type: integer
          nullable: true
        inference_geo:
          type: string
          nullable: true
        input_tokens:
          type: integer
        iterations:
          allOf:
            - $ref: '#/components/schemas/BetaIterationsUsage'
          nullable: true
        output_tokens:
          type: integer
        server_tool_use:
          allOf:
            - $ref: '#/components/schemas/BetaServerToolUsage'
          nullable: true
        service_tier:
          type: string
          nullable: true
          enum:
            - standard
            - priority
            - batch
        speed:
          type: string
          nullable: true
          enum:
            - standard
            - fast
    BetaContentBlockParam:
      oneOf:
        - $ref: '#/components/schemas/BetaTextBlockParam'
        - $ref: '#/components/schemas/BetaImageBlockParam'
        - $ref: '#/components/schemas/BetaRequestDocumentBlock'
        - $ref: '#/components/schemas/BetaSearchResultBlockParam'
        - $ref: '#/components/schemas/BetaThinkingBlockParam'
        - $ref: '#/components/schemas/BetaRedactedThinkingBlockParam'
        - $ref: '#/components/schemas/BetaToolUseBlockParam'
        - $ref: '#/components/schemas/BetaToolResultBlockParam'
        - $ref: '#/components/schemas/BetaServerToolUseBlockParam'
        - $ref: '#/components/schemas/BetaWebSearchToolResultBlockParam'
        - $ref: '#/components/schemas/BetaWebFetchToolResultBlockParam'
        - $ref: '#/components/schemas/BetaAdvisorToolResultBlockParam'
        - $ref: '#/components/schemas/BetaCodeExecutionToolResultBlockParam'
        - $ref: '#/components/schemas/BetaBashCodeExecutionToolResultBlockParam'
        - $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultBlockParam'
        - $ref: '#/components/schemas/BetaToolSearchToolResultBlockParam'
        - $ref: '#/components/schemas/BetaMCPToolUseBlockParam'
        - $ref: '#/components/schemas/BetaRequestMCPToolResultBlockParam'
        - $ref: '#/components/schemas/BetaContainerUploadBlockParam'
        - $ref: '#/components/schemas/BetaCompactionBlockParam'
      discriminator:
        propertyName: type
    BetaSkillParams:
      type: object
      required:
        - skill_id
        - type
      properties:
        skill_id:
          type: string
          description: 技能 ID。
          example: code-review
        type:
          type: string
          enum:
            - anthropic
            - custom
          description: 技能类型：'anthropic'（内置）或 'custom'（用户自定义）。
          default: anthropic
          example: anthropic
        version:
          type: string
          description: 技能版本号，或使用 'latest' 表示最新版本。
          default: latest
          example: latest
    BetaContextManagementEdit:
      oneOf:
        - $ref: '#/components/schemas/BetaClearToolUses20250919Edit'
        - $ref: '#/components/schemas/BetaClearThinking20251015Edit'
        - $ref: '#/components/schemas/BetaCompact20260112Edit'
      discriminator:
        propertyName: type
    BetaRequestMCPServerToolConfiguration:
      type: object
      properties:
        allowed_tools:
          type: array
          nullable: true
          items:
            type: string
        enabled:
          type: boolean
          nullable: true
    BetaTokenTaskBudget:
      type: object
      description: 用户可配置的跨上下文总 token 预算。
      required:
        - total
        - type
      properties:
        total:
          type: integer
          description: 会话中所有上下文的总 token 预算。
          example: 100000
        type:
          type: string
          enum:
            - tokens
          description: 预算类型。目前仅支持 'tokens'。
          default: tokens
          example: tokens
        remaining:
          type: integer
          nullable: true
          description: 预算中剩余的 token 数。
          example: 80000
    BetaTextCitationParam:
      oneOf:
        - $ref: '#/components/schemas/BetaCitationCharLocationParam'
        - $ref: '#/components/schemas/BetaCitationPageLocationParam'
        - $ref: '#/components/schemas/BetaCitationContentBlockLocationParam'
        - $ref: '#/components/schemas/BetaCitationWebSearchResultLocationParam'
        - $ref: '#/components/schemas/BetaCitationSearchResultLocationParam'
      discriminator:
        propertyName: type
    BetaThinkingConfigEnabled:
      type: object
      description: 启用思考模式的配置。
      required:
        - budget_tokens
        - type
      properties:
        budget_tokens:
          type: integer
          minimum: 1024
          description: 用于内部推理（思考）的 token 数。必须 >= 1024 且小于 max_tokens。
          example: 2048
        type:
          type: string
          enum:
            - enabled
          default: enabled
          example: enabled
        display:
          type: string
          nullable: true
          description: 思考过程的展示方式。
          enum:
            - summarized
            - omitted
          example: summarized
    BetaThinkingConfigDisabled:
      type: object
      description: 禁用思考模式的配置。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - disabled
          default: disabled
          example: disabled
    BetaThinkingConfigAdaptive:
      type: object
      description: 自适应思考模式的配置。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - adaptive
          default: adaptive
          example: adaptive
        display:
          type: string
          nullable: true
          description: 思考过程的展示方式。
          enum:
            - summarized
            - omitted
          example: summarized
    BetaToolChoiceAuto:
      type: object
      description: 由模型自行决定是否使用工具。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - auto
          default: auto
          example: auto
        disable_parallel_tool_use:
          type: boolean
          description: 是否禁用并行工具调用。
          default: false
          example: false
    BetaToolChoiceAny:
      type: object
      description: 模型必须使用任意可用工具中的一个。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - any
          default: any
          example: any
        disable_parallel_tool_use:
          type: boolean
          description: 是否禁用并行工具调用。
          default: false
          example: false
    BetaToolChoiceTool:
      type: object
      description: 模型必须使用指定名称的工具。
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: 必须使用的工具名称。
          example: get_weather
        type:
          type: string
          enum:
            - tool
          default: tool
          example: tool
        disable_parallel_tool_use:
          type: boolean
          description: 是否禁用并行工具调用。
          default: false
          example: false
    BetaToolChoiceNone:
      type: object
      description: 不允许模型使用任何工具。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - none
          default: none
          example: none
    BetaTool:
      type: object
      description: 用户自定义工具定义。
      required:
        - input_schema
        - name
      properties:
        input_schema:
          $ref: '#/components/schemas/InputSchema'
        name:
          type: string
          description: 工具名称。
          example: get_weather
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
          description: 是否延迟加载该工具。
          default: false
          example: false
        description:
          type: string
          description: 工具能力描述，供模型理解使用场景。
          example: 根据城市名称查询当前天气信息。
        eager_input_streaming:
          type: boolean
          nullable: true
          description: 是否在生成阶段即流式传输工具输入。
        input_examples:
          type: array
          description: 工具输入示例数组，帮助模型更好地理解输入格式。
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
          description: 是否开启对输入参数的严格校验。
          default: false
          example: false
        type:
          type: string
          enum:
            - custom
          nullable: true
          default: custom
          example: custom
    BetaToolBash20241022:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - bash
        type:
          type: string
          enum:
            - bash_20241022
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolBash20250124:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - bash
        type:
          type: string
          enum:
            - bash_20250124
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaCodeExecutionTool20250522:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - code_execution
        type:
          type: string
          enum:
            - code_execution_20250522
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        strict:
          type: boolean
    BetaCodeExecutionTool20250825:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - code_execution
        type:
          type: string
          enum:
            - code_execution_20250825
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        strict:
          type: boolean
    BetaCodeExecutionTool20260120:
      type: object
      description: >-
        Code execution tool with REPL state persistence (daemon mode + gVisor
        checkpoint).
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - code_execution
        type:
          type: string
          enum:
            - code_execution_20260120
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        strict:
          type: boolean
    BetaToolComputerUse20241022:
      type: object
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      properties:
        display_height_px:
          type: integer
        display_width_px:
          type: integer
        name:
          type: string
          enum:
            - computer
        type:
          type: string
          enum:
            - computer_20241022
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        display_number:
          type: integer
          nullable: true
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaMemoryTool20250818:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - memory
        type:
          type: string
          enum:
            - memory_20250818
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolComputerUse20250124:
      type: object
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      properties:
        display_height_px:
          type: integer
        display_width_px:
          type: integer
        name:
          type: string
          enum:
            - computer
        type:
          type: string
          enum:
            - computer_20250124
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        display_number:
          type: integer
          nullable: true
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolTextEditor20241022:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - str_replace_editor
        type:
          type: string
          enum:
            - text_editor_20241022
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolComputerUse20251124:
      type: object
      required:
        - display_height_px
        - display_width_px
        - name
        - type
      properties:
        display_height_px:
          type: integer
        display_width_px:
          type: integer
        name:
          type: string
          enum:
            - computer
        type:
          type: string
          enum:
            - computer_20251124
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        display_number:
          type: integer
          nullable: true
        enable_zoom:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolTextEditor20250124:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - str_replace_editor
        type:
          type: string
          enum:
            - text_editor_20250124
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolTextEditor20250429:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - str_replace_based_edit_tool
        type:
          type: string
          enum:
            - text_editor_20250429
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        strict:
          type: boolean
    BetaToolTextEditor20250728:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - str_replace_based_edit_tool
        type:
          type: string
          enum:
            - text_editor_20250728
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        input_examples:
          type: array
          items:
            type: object
            additionalProperties: true
        max_characters:
          type: integer
          nullable: true
          description: Maximum number of characters to display when viewing a file.
        strict:
          type: boolean
    BetaWebSearchTool20250305:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - web_search
        type:
          type: string
          enum:
            - web_search_20250305
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        allowed_domains:
          type: array
          nullable: true
          items:
            type: string
        blocked_domains:
          type: array
          nullable: true
          items:
            type: string
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
        user_location:
          allOf:
            - $ref: '#/components/schemas/BetaUserLocation'
          nullable: true
    BetaWebFetchTool20250910:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - web_fetch
        type:
          type: string
          enum:
            - web_fetch_20250910
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        allowed_domains:
          type: array
          nullable: true
          items:
            type: string
        blocked_domains:
          type: array
          nullable: true
          items:
            type: string
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          allOf:
            - $ref: '#/components/schemas/BetaCitationsConfigParam'
          nullable: true
        defer_loading:
          type: boolean
        max_content_tokens:
          type: integer
          nullable: true
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
    BetaWebSearchTool20260209:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - web_search
        type:
          type: string
          enum:
            - web_search_20260209
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        allowed_domains:
          type: array
          nullable: true
          items:
            type: string
        blocked_domains:
          type: array
          nullable: true
          items:
            type: string
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
        user_location:
          allOf:
            - $ref: '#/components/schemas/BetaUserLocation'
          nullable: true
    BetaWebFetchTool20260209:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - web_fetch
        type:
          type: string
          enum:
            - web_fetch_20260209
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        allowed_domains:
          type: array
          nullable: true
          items:
            type: string
        blocked_domains:
          type: array
          nullable: true
          items:
            type: string
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          allOf:
            - $ref: '#/components/schemas/BetaCitationsConfigParam'
          nullable: true
        defer_loading:
          type: boolean
        max_content_tokens:
          type: integer
          nullable: true
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
    BetaWebFetchTool20260309:
      type: object
      description: Web fetch tool with use_cache parameter for bypassing cached content.
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - web_fetch
        type:
          type: string
          enum:
            - web_fetch_20260309
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        allowed_domains:
          type: array
          nullable: true
          items:
            type: string
        blocked_domains:
          type: array
          nullable: true
          items:
            type: string
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          allOf:
            - $ref: '#/components/schemas/BetaCitationsConfigParam'
          nullable: true
        defer_loading:
          type: boolean
        max_content_tokens:
          type: integer
          nullable: true
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
        use_cache:
          type: boolean
          description: Whether to use cached content. Set to false to bypass cache.
    BetaAdvisorTool20260301:
      type: object
      required:
        - model
        - name
        - type
      properties:
        model:
          $ref: '#/components/schemas/Model'
        name:
          type: string
          enum:
            - advisor
        type:
          type: string
          enum:
            - advisor_20260301
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        caching:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        max_uses:
          type: integer
          nullable: true
        strict:
          type: boolean
    BetaToolSearchToolBm25_20251119:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - tool_search_tool_bm25
        type:
          type: string
          enum:
            - tool_search_tool_bm25_20251119
            - tool_search_tool_bm25
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        strict:
          type: boolean
    BetaToolSearchToolRegex20251119:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          enum:
            - tool_search_tool_regex
        type:
          type: string
          enum:
            - tool_search_tool_regex_20251119
            - tool_search_tool_regex
        allowed_callers:
          $ref: '#/components/schemas/BetaToolAllowedCallers'
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        defer_loading:
          type: boolean
        strict:
          type: boolean
    BetaMCPToolset:
      type: object
      description: Configuration for a group of tools from an MCP server.
      required:
        - mcp_server_name
        - type
      properties:
        mcp_server_name:
          type: string
        type:
          type: string
          enum:
            - mcp_toolset
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        configs:
          type: object
          nullable: true
          additionalProperties:
            $ref: '#/components/schemas/BetaMCPToolConfig'
        default_config:
          $ref: '#/components/schemas/BetaMCPToolDefaultConfig'
    BetaSkill:
      type: object
      required:
        - skill_id
        - type
        - version
      properties:
        skill_id:
          type: string
        type:
          type: string
          enum:
            - anthropic
            - custom
        version:
          type: string
    BetaTextBlock:
      type: object
      required:
        - citations
        - text
        - type
      properties:
        citations:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/BetaTextCitation'
        text:
          type: string
        type:
          type: string
          enum:
            - text
    BetaThinkingBlock:
      type: object
      required:
        - signature
        - thinking
        - type
      properties:
        signature:
          type: string
        thinking:
          type: string
        type:
          type: string
          enum:
            - thinking
    BetaRedactedThinkingBlock:
      type: object
      required:
        - data
        - type
      properties:
        data:
          type: string
        type:
          type: string
          enum:
            - redacted_thinking
    BetaToolUseBlock:
      type: object
      required:
        - id
        - input
        - name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
        type:
          type: string
          enum:
            - tool_use
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaServerToolUseBlock:
      type: object
      required:
        - id
        - input
        - name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
          enum:
            - advisor
            - web_search
            - web_fetch
            - code_execution
            - bash_code_execution
            - text_editor_code_execution
            - tool_search_tool_regex
            - tool_search_tool_bm25
        type:
          type: string
          enum:
            - server_tool_use
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaWebSearchToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaWebSearchToolResultError'
            - type: array
              items:
                $ref: '#/components/schemas/BetaWebSearchResultBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - web_search_tool_result
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaWebFetchToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaWebFetchToolResultErrorBlock'
            - $ref: '#/components/schemas/BetaWebFetchBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - web_fetch_tool_result
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaAdvisorToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaAdvisorToolResultError'
            - $ref: '#/components/schemas/BetaAdvisorResultBlock'
            - $ref: '#/components/schemas/BetaAdvisorRedactedResultBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - advisor_tool_result
    BetaCodeExecutionToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaCodeExecutionToolResultError'
            - $ref: '#/components/schemas/BetaCodeExecutionResultBlock'
            - $ref: '#/components/schemas/BetaEncryptedCodeExecutionResultBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_tool_result
    BetaBashCodeExecutionToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaBashCodeExecutionToolResultError'
            - $ref: '#/components/schemas/BetaBashCodeExecutionResultBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_tool_result
    BetaTextEditorCodeExecutionToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultError'
            - $ref: '#/components/schemas/BetaTextEditorCodeExecutionViewResultBlock'
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionCreateResultBlock
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionStrReplaceResultBlock
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - text_editor_code_execution_tool_result
    BetaToolSearchToolResultBlock:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaToolSearchToolResultError'
            - $ref: '#/components/schemas/BetaToolSearchToolSearchResultBlock'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - tool_search_tool_result
    BetaMCPToolUseBlock:
      type: object
      required:
        - id
        - input
        - name
        - server_name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
        server_name:
          type: string
        type:
          type: string
          enum:
            - mcp_tool_use
    BetaMCPToolResultBlock:
      type: object
      required:
        - content
        - is_error
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/BetaTextBlock'
        is_error:
          type: boolean
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - mcp_tool_result
    BetaContainerUploadBlock:
      type: object
      description: Response model for a file uploaded to the container.
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - container_upload
    BetaCompactionBlock:
      type: object
      description: A compaction block returned when autocompact is triggered.
      required:
        - content
        - encrypted_content
        - type
      properties:
        content:
          type: string
          nullable: true
        encrypted_content:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - compaction
    BetaClearToolUses20250919EditResponse:
      type: object
      required:
        - cleared_input_tokens
        - cleared_tool_uses
        - type
      properties:
        cleared_input_tokens:
          type: integer
        cleared_tool_uses:
          type: integer
        type:
          type: string
          enum:
            - clear_tool_uses_20250919
    BetaClearThinking20251015EditResponse:
      type: object
      required:
        - cleared_input_tokens
        - cleared_thinking_turns
        - type
      properties:
        cleared_input_tokens:
          type: integer
        cleared_thinking_turns:
          type: integer
        type:
          type: string
          enum:
            - clear_thinking_20251015
    BetaCacheCreation:
      type: object
      required:
        - ephemeral_1h_input_tokens
        - ephemeral_5m_input_tokens
      properties:
        ephemeral_1h_input_tokens:
          type: integer
        ephemeral_5m_input_tokens:
          type: integer
    BetaIterationsUsage:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/BetaMessageIterationUsage'
          - $ref: '#/components/schemas/BetaCompactionIterationUsage'
          - $ref: '#/components/schemas/BetaAdvisorMessageIterationUsage'
        discriminator:
          propertyName: type
    BetaServerToolUsage:
      type: object
      required:
        - web_fetch_requests
        - web_search_requests
      properties:
        web_fetch_requests:
          type: integer
        web_search_requests:
          type: integer
    BetaImageBlockParam:
      type: object
      required:
        - source
        - type
      properties:
        source:
          oneOf:
            - $ref: '#/components/schemas/BetaBase64ImageSource'
            - $ref: '#/components/schemas/BetaURLImageSource'
            - $ref: '#/components/schemas/BetaFileImageSource'
        type:
          type: string
          enum:
            - image
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaRequestDocumentBlock:
      type: object
      required:
        - source
        - type
      properties:
        source:
          oneOf:
            - $ref: '#/components/schemas/BetaBase64PDFSource'
            - $ref: '#/components/schemas/BetaPlainTextSource'
            - $ref: '#/components/schemas/BetaContentBlockSource'
            - $ref: '#/components/schemas/BetaURLPDFSource'
            - $ref: '#/components/schemas/BetaFileDocumentSource'
        type:
          type: string
          enum:
            - document
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          allOf:
            - $ref: '#/components/schemas/BetaCitationsConfigParam'
          nullable: true
        context:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
    BetaSearchResultBlockParam:
      type: object
      required:
        - content
        - source
        - title
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaTextBlockParam'
        source:
          type: string
        title:
          type: string
        type:
          type: string
          enum:
            - search_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        citations:
          $ref: '#/components/schemas/BetaCitationsConfigParam'
    BetaThinkingBlockParam:
      type: object
      required:
        - signature
        - thinking
        - type
      properties:
        signature:
          type: string
        thinking:
          type: string
        type:
          type: string
          enum:
            - thinking
    BetaRedactedThinkingBlockParam:
      type: object
      required:
        - data
        - type
      properties:
        data:
          type: string
        type:
          type: string
          enum:
            - redacted_thinking
    BetaToolUseBlockParam:
      type: object
      required:
        - id
        - input
        - name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
        type:
          type: string
          enum:
            - tool_use
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaToolResultBlockParam:
      type: object
      required:
        - tool_use_id
        - type
      properties:
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/BetaToolResultContentBlock'
        is_error:
          type: boolean
    BetaServerToolUseBlockParam:
      type: object
      required:
        - id
        - input
        - name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
          enum:
            - advisor
            - web_search
            - web_fetch
            - code_execution
            - bash_code_execution
            - text_editor_code_execution
            - tool_search_tool_regex
            - tool_search_tool_bm25
        type:
          type: string
          enum:
            - server_tool_use
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaWebSearchToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - type: array
              items:
                $ref: '#/components/schemas/BetaWebSearchResultBlockParam'
            - $ref: '#/components/schemas/BetaWebSearchToolRequestError'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - web_search_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaWebFetchToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaWebFetchToolResultErrorBlockParam'
            - $ref: '#/components/schemas/BetaWebFetchBlockParam'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - web_fetch_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        caller:
          $ref: '#/components/schemas/BetaToolCaller'
    BetaAdvisorToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaAdvisorToolResultErrorParam'
            - $ref: '#/components/schemas/BetaAdvisorResultBlockParam'
            - $ref: '#/components/schemas/BetaAdvisorRedactedResultBlockParam'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - advisor_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaCodeExecutionToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorParam'
            - $ref: '#/components/schemas/BetaCodeExecutionResultBlockParam'
            - $ref: '#/components/schemas/BetaEncryptedCodeExecutionResultBlockParam'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaBashCodeExecutionToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaBashCodeExecutionToolResultErrorParam'
            - $ref: '#/components/schemas/BetaBashCodeExecutionResultBlockParam'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaTextEditorCodeExecutionToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionToolResultErrorParam
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionViewResultBlockParam
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionCreateResultBlockParam
            - $ref: >-
                #/components/schemas/BetaTextEditorCodeExecutionStrReplaceResultBlockParam
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - text_editor_code_execution_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaToolSearchToolResultBlockParam:
      type: object
      required:
        - content
        - tool_use_id
        - type
      properties:
        content:
          oneOf:
            - $ref: '#/components/schemas/BetaToolSearchToolResultErrorParam'
            - $ref: '#/components/schemas/BetaToolSearchToolSearchResultBlockParam'
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - tool_search_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaMCPToolUseBlockParam:
      type: object
      required:
        - id
        - input
        - name
        - server_name
        - type
      properties:
        id:
          type: string
        input:
          type: object
          additionalProperties: true
        name:
          type: string
        server_name:
          type: string
          description: The name of the MCP server
        type:
          type: string
          enum:
            - mcp_tool_use
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaRequestMCPToolResultBlockParam:
      type: object
      required:
        - tool_use_id
        - type
      properties:
        tool_use_id:
          type: string
        type:
          type: string
          enum:
            - mcp_tool_result
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/BetaTextBlockParam'
        is_error:
          type: boolean
    BetaContainerUploadBlockParam:
      type: object
      description: >-
        A content block that represents a file to be uploaded to the container.
        Files uploaded via this block will be available in the container's input
        directory.
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - container_upload
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaCompactionBlockParam:
      type: object
      description: >-
        A compaction block containing summary of previous context. Round-trip
        these blocks from responses to subsequent requests to maintain context
        across compaction boundaries.
      required:
        - content
        - type
      properties:
        content:
          type: string
          nullable: true
          description: >-
            Summary of previously compacted content, or null if compaction
            failed
        type:
          type: string
          enum:
            - compaction
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
        encrypted_content:
          type: string
          nullable: true
          description: Opaque metadata from prior compaction, to be round-tripped verbatim
    BetaClearToolUses20250919Edit:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - clear_tool_uses_20250919
        clear_at_least:
          allOf:
            - $ref: '#/components/schemas/BetaInputTokensClearAtLeast'
          nullable: true
        clear_tool_inputs:
          oneOf:
            - type: boolean
            - type: array
              items:
                type: string
          nullable: true
        exclude_tools:
          type: array
          nullable: true
          items:
            type: string
        keep:
          $ref: '#/components/schemas/BetaToolUsesKeep'
        trigger:
          oneOf:
            - $ref: '#/components/schemas/BetaInputTokensTrigger'
            - $ref: '#/components/schemas/BetaToolUsesTrigger'
    BetaClearThinking20251015Edit:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - clear_thinking_20251015
        keep:
          oneOf:
            - $ref: '#/components/schemas/BetaThinkingTurns'
            - $ref: '#/components/schemas/BetaAllThinkingTurns'
            - type: string
              enum:
                - all
    BetaCompact20260112Edit:
      type: object
      description: 当达到配置的触发阈值时，自动压缩较早的上下文。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - compact_20260112
          default: compact_20260112
          example: compact_20260112
        instructions:
          type: string
          nullable: true
          description: 用于上下文摘要生成的附加指令。
          example: 请保留所有关键决策与代码改动上下文。
        pause_after_compaction:
          type: boolean
          description: 是否在压缩完成后暂停，并把压缩块返回给用户。
          default: false
          example: false
        trigger:
          allOf:
            - $ref: '#/components/schemas/BetaInputTokensTrigger'
          nullable: true
          description: 触发压缩的条件。默认值为 150,000 输入 token。
    BetaCitationCharLocationParam:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_char_index
        - start_char_index
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_char_index:
          type: integer
        start_char_index:
          type: integer
        type:
          type: string
          enum:
            - char_location
    BetaCitationPageLocationParam:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_page_number
        - start_page_number
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_page_number:
          type: integer
        start_page_number:
          type: integer
        type:
          type: string
          enum:
            - page_location
    BetaCitationContentBlockLocationParam:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_block_index
        - start_block_index
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_block_index:
          type: integer
        start_block_index:
          type: integer
        type:
          type: string
          enum:
            - content_block_location
    BetaCitationWebSearchResultLocationParam:
      type: object
      required:
        - cited_text
        - encrypted_index
        - title
        - type
        - url
      properties:
        cited_text:
          type: string
        encrypted_index:
          type: string
        title:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - web_search_result_location
        url:
          type: string
    BetaCitationSearchResultLocationParam:
      type: object
      required:
        - cited_text
        - end_block_index
        - search_result_index
        - source
        - start_block_index
        - title
        - type
      properties:
        cited_text:
          type: string
        end_block_index:
          type: integer
        search_result_index:
          type: integer
        source:
          type: string
        start_block_index:
          type: integer
        title:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - search_result_location
    InputSchema:
      type: object
      description: 该工具输入参数的 JSON Schema。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - object
          default: object
          example: object
        properties:
          type: object
          nullable: true
          additionalProperties: true
        required:
          type: array
          nullable: true
          items:
            type: string
            example: location
    BetaToolAllowedCallers:
      type: array
      items:
        type: string
        enum:
          - direct
          - code_execution_20250825
          - code_execution_20260120
    BetaUserLocation:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - approximate
        city:
          type: string
          nullable: true
        country:
          type: string
          nullable: true
          description: Two letter ISO country code
        region:
          type: string
          nullable: true
        timezone:
          type: string
          nullable: true
          description: IANA timezone
    BetaCitationsConfigParam:
      type: object
      properties:
        enabled:
          type: boolean
    BetaMCPToolConfig:
      type: object
      properties:
        defer_loading:
          type: boolean
        enabled:
          type: boolean
    BetaMCPToolDefaultConfig:
      type: object
      properties:
        defer_loading:
          type: boolean
        enabled:
          type: boolean
    BetaTextCitation:
      oneOf:
        - $ref: '#/components/schemas/BetaCitationCharLocation'
        - $ref: '#/components/schemas/BetaCitationPageLocation'
        - $ref: '#/components/schemas/BetaCitationContentBlockLocation'
        - $ref: '#/components/schemas/BetaCitationsWebSearchResultLocation'
        - $ref: '#/components/schemas/BetaCitationSearchResultLocation'
      discriminator:
        propertyName: type
    BetaToolCaller:
      oneOf:
        - $ref: '#/components/schemas/BetaDirectCaller'
        - $ref: '#/components/schemas/BetaServerToolCaller'
        - $ref: '#/components/schemas/BetaServerToolCaller20260120'
      discriminator:
        propertyName: type
    BetaWebSearchToolResultError:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode'
        type:
          type: string
          enum:
            - web_search_tool_result_error
    BetaWebSearchResultBlock:
      type: object
      required:
        - encrypted_content
        - page_age
        - title
        - type
        - url
      properties:
        encrypted_content:
          type: string
        page_age:
          type: string
          nullable: true
        title:
          type: string
        type:
          type: string
          enum:
            - web_search_result
        url:
          type: string
    BetaWebFetchToolResultErrorBlock:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode'
        type:
          type: string
          enum:
            - web_fetch_tool_result_error
    BetaWebFetchBlock:
      type: object
      required:
        - content
        - retrieved_at
        - type
        - url
      properties:
        content:
          $ref: '#/components/schemas/BetaDocumentBlock'
        retrieved_at:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - web_fetch_result
        url:
          type: string
    BetaAdvisorToolResultError:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - max_uses_exceeded
            - prompt_too_long
            - too_many_requests
            - overloaded
            - unavailable
            - execution_time_exceeded
        type:
          type: string
          enum:
            - advisor_tool_result_error
    BetaAdvisorResultBlock:
      type: object
      required:
        - text
        - type
      properties:
        text:
          type: string
        type:
          type: string
          enum:
            - advisor_result
    BetaAdvisorRedactedResultBlock:
      type: object
      required:
        - encrypted_content
        - type
      properties:
        encrypted_content:
          type: string
        type:
          type: string
          enum:
            - advisor_redacted_result
    BetaCodeExecutionToolResultError:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode'
        type:
          type: string
          enum:
            - code_execution_tool_result_error
    BetaCodeExecutionResultBlock:
      type: object
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaCodeExecutionOutputBlock'
        return_code:
          type: integer
        stderr:
          type: string
        stdout:
          type: string
        type:
          type: string
          enum:
            - code_execution_result
    BetaEncryptedCodeExecutionResultBlock:
      type: object
      required:
        - content
        - encrypted_stdout
        - return_code
        - stderr
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaCodeExecutionOutputBlock'
        encrypted_stdout:
          type: string
        return_code:
          type: integer
        stderr:
          type: string
        type:
          type: string
          enum:
            - encrypted_code_execution_result
    BetaBashCodeExecutionToolResultError:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
            - output_file_too_large
        type:
          type: string
          enum:
            - bash_code_execution_tool_result_error
    BetaBashCodeExecutionResultBlock:
      type: object
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaBashCodeExecutionOutputBlock'
        return_code:
          type: integer
        stderr:
          type: string
        stdout:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_result
    BetaTextEditorCodeExecutionToolResultError:
      type: object
      required:
        - error_code
        - error_message
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
            - file_not_found
        error_message:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - text_editor_code_execution_tool_result_error
    BetaTextEditorCodeExecutionViewResultBlock:
      type: object
      required:
        - content
        - file_type
        - num_lines
        - start_line
        - total_lines
        - type
      properties:
        content:
          type: string
        file_type:
          type: string
          enum:
            - text
            - image
            - pdf
        num_lines:
          type: integer
          nullable: true
        start_line:
          type: integer
          nullable: true
        total_lines:
          type: integer
          nullable: true
        type:
          type: string
          enum:
            - text_editor_code_execution_view_result
    BetaTextEditorCodeExecutionCreateResultBlock:
      type: object
      required:
        - is_file_update
        - type
      properties:
        is_file_update:
          type: boolean
        type:
          type: string
          enum:
            - text_editor_code_execution_create_result
    BetaTextEditorCodeExecutionStrReplaceResultBlock:
      type: object
      required:
        - lines
        - new_lines
        - new_start
        - old_lines
        - old_start
        - type
      properties:
        lines:
          type: array
          nullable: true
          items:
            type: string
        new_lines:
          type: integer
          nullable: true
        new_start:
          type: integer
          nullable: true
        old_lines:
          type: integer
          nullable: true
        old_start:
          type: integer
          nullable: true
        type:
          type: string
          enum:
            - text_editor_code_execution_str_replace_result
    BetaToolSearchToolResultError:
      type: object
      required:
        - error_code
        - error_message
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
        error_message:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - tool_search_tool_result_error
    BetaToolSearchToolSearchResultBlock:
      type: object
      required:
        - tool_references
        - type
      properties:
        tool_references:
          type: array
          items:
            $ref: '#/components/schemas/BetaToolReferenceBlock'
        type:
          type: string
          enum:
            - tool_search_tool_search_result
    BetaMessageIterationUsage:
      type: object
      description: Token usage for a sampling iteration.
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - output_tokens
        - type
      properties:
        cache_creation:
          allOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
          nullable: true
        cache_creation_input_tokens:
          type: integer
        cache_read_input_tokens:
          type: integer
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        type:
          type: string
          enum:
            - message
    BetaCompactionIterationUsage:
      type: object
      description: Token usage for a compaction iteration.
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - output_tokens
        - type
      properties:
        cache_creation:
          allOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
          nullable: true
        cache_creation_input_tokens:
          type: integer
        cache_read_input_tokens:
          type: integer
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        type:
          type: string
          enum:
            - compaction
    BetaAdvisorMessageIterationUsage:
      type: object
      description: Token usage for an advisor sub-inference iteration.
      required:
        - cache_creation
        - cache_creation_input_tokens
        - cache_read_input_tokens
        - input_tokens
        - model
        - output_tokens
        - type
      properties:
        cache_creation:
          allOf:
            - $ref: '#/components/schemas/BetaCacheCreation'
          nullable: true
        cache_creation_input_tokens:
          type: integer
        cache_read_input_tokens:
          type: integer
        input_tokens:
          type: integer
        model:
          $ref: '#/components/schemas/Model'
        output_tokens:
          type: integer
        type:
          type: string
          enum:
            - advisor_message
    BetaBase64ImageSource:
      type: object
      required:
        - data
        - media_type
        - type
      properties:
        data:
          type: string
          format: byte
        media_type:
          type: string
          enum:
            - image/jpeg
            - image/png
            - image/gif
            - image/webp
        type:
          type: string
          enum:
            - base64
    BetaURLImageSource:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - url
        url:
          type: string
    BetaFileImageSource:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - file
    BetaBase64PDFSource:
      type: object
      required:
        - data
        - media_type
        - type
      properties:
        data:
          type: string
          format: byte
        media_type:
          type: string
          enum:
            - application/pdf
        type:
          type: string
          enum:
            - base64
    BetaPlainTextSource:
      type: object
      required:
        - data
        - media_type
        - type
      properties:
        data:
          type: string
        media_type:
          type: string
          enum:
            - text/plain
        type:
          type: string
          enum:
            - text
    BetaContentBlockSource:
      type: object
      required:
        - content
        - type
      properties:
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/BetaContentBlockSourceContent'
        type:
          type: string
          enum:
            - content
    BetaURLPDFSource:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - url
        url:
          type: string
    BetaFileDocumentSource:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - file
    BetaToolResultContentBlock:
      oneOf:
        - $ref: '#/components/schemas/BetaTextBlockParam'
        - $ref: '#/components/schemas/BetaImageBlockParam'
        - $ref: '#/components/schemas/BetaSearchResultBlockParam'
        - $ref: '#/components/schemas/BetaRequestDocumentBlock'
        - $ref: '#/components/schemas/BetaToolReferenceBlockParam'
    BetaWebSearchResultBlockParam:
      type: object
      required:
        - encrypted_content
        - title
        - type
        - url
      properties:
        encrypted_content:
          type: string
        title:
          type: string
        type:
          type: string
          enum:
            - web_search_result
        url:
          type: string
        page_age:
          type: string
          nullable: true
    BetaWebSearchToolRequestError:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode'
        type:
          type: string
          enum:
            - web_search_tool_result_error
    BetaWebFetchToolResultErrorBlockParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode'
        type:
          type: string
          enum:
            - web_fetch_tool_result_error
    BetaWebFetchBlockParam:
      type: object
      required:
        - content
        - type
        - url
      properties:
        content:
          $ref: '#/components/schemas/BetaRequestDocumentBlock'
        type:
          type: string
          enum:
            - web_fetch_result
        url:
          type: string
          description: Fetched content URL
        retrieved_at:
          type: string
          nullable: true
          description: ISO 8601 timestamp when the content was retrieved
    BetaAdvisorToolResultErrorParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - max_uses_exceeded
            - prompt_too_long
            - too_many_requests
            - overloaded
            - unavailable
            - execution_time_exceeded
        type:
          type: string
          enum:
            - advisor_tool_result_error
    BetaAdvisorResultBlockParam:
      type: object
      required:
        - text
        - type
      properties:
        text:
          type: string
        type:
          type: string
          enum:
            - advisor_result
    BetaAdvisorRedactedResultBlockParam:
      type: object
      required:
        - encrypted_content
        - type
      properties:
        encrypted_content:
          type: string
          description: >-
            Opaque blob produced by a prior response; must be round-tripped
            verbatim.
        type:
          type: string
          enum:
            - advisor_redacted_result
    BetaCodeExecutionToolResultErrorParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode'
        type:
          type: string
          enum:
            - code_execution_tool_result_error
    BetaCodeExecutionResultBlockParam:
      type: object
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaCodeExecutionOutputBlockParam'
        return_code:
          type: integer
        stderr:
          type: string
        stdout:
          type: string
        type:
          type: string
          enum:
            - code_execution_result
    BetaEncryptedCodeExecutionResultBlockParam:
      type: object
      description: >-
        Code execution result with encrypted stdout for PFC + web_search
        results.
      required:
        - content
        - encrypted_stdout
        - return_code
        - stderr
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaCodeExecutionOutputBlockParam'
        encrypted_stdout:
          type: string
        return_code:
          type: integer
        stderr:
          type: string
        type:
          type: string
          enum:
            - encrypted_code_execution_result
    BetaBashCodeExecutionToolResultErrorParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
            - output_file_too_large
        type:
          type: string
          enum:
            - bash_code_execution_tool_result_error
    BetaBashCodeExecutionResultBlockParam:
      type: object
      required:
        - content
        - return_code
        - stderr
        - stdout
        - type
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/BetaBashCodeExecutionOutputBlockParam'
        return_code:
          type: integer
        stderr:
          type: string
        stdout:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_result
    BetaTextEditorCodeExecutionToolResultErrorParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
            - file_not_found
        type:
          type: string
          enum:
            - text_editor_code_execution_tool_result_error
        error_message:
          type: string
          nullable: true
    BetaTextEditorCodeExecutionViewResultBlockParam:
      type: object
      required:
        - content
        - file_type
        - type
      properties:
        content:
          type: string
        file_type:
          type: string
          enum:
            - text
            - image
            - pdf
        type:
          type: string
          enum:
            - text_editor_code_execution_view_result
        num_lines:
          type: integer
          nullable: true
        start_line:
          type: integer
          nullable: true
        total_lines:
          type: integer
          nullable: true
    BetaTextEditorCodeExecutionCreateResultBlockParam:
      type: object
      required:
        - is_file_update
        - type
      properties:
        is_file_update:
          type: boolean
        type:
          type: string
          enum:
            - text_editor_code_execution_create_result
    BetaTextEditorCodeExecutionStrReplaceResultBlockParam:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text_editor_code_execution_str_replace_result
        lines:
          type: array
          nullable: true
          items:
            type: string
        new_lines:
          type: integer
          nullable: true
        new_start:
          type: integer
          nullable: true
        old_lines:
          type: integer
          nullable: true
        old_start:
          type: integer
          nullable: true
    BetaToolSearchToolResultErrorParam:
      type: object
      required:
        - error_code
        - type
      properties:
        error_code:
          type: string
          enum:
            - invalid_tool_input
            - unavailable
            - too_many_requests
            - execution_time_exceeded
        type:
          type: string
          enum:
            - tool_search_tool_result_error
    BetaToolSearchToolSearchResultBlockParam:
      type: object
      required:
        - tool_references
        - type
      properties:
        tool_references:
          type: array
          items:
            $ref: '#/components/schemas/BetaToolReferenceBlockParam'
        type:
          type: string
          enum:
            - tool_search_tool_search_result
    BetaInputTokensClearAtLeast:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - input_tokens
        value:
          type: integer
    BetaToolUsesKeep:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - tool_uses
        value:
          type: integer
    BetaInputTokensTrigger:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - input_tokens
        value:
          type: integer
    BetaToolUsesTrigger:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - tool_uses
        value:
          type: integer
    BetaThinkingTurns:
      type: object
      required:
        - type
        - value
      properties:
        type:
          type: string
          enum:
            - thinking_turns
        value:
          type: integer
    BetaAllThinkingTurns:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - all
    BetaCitationCharLocation:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_char_index
        - file_id
        - start_char_index
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_char_index:
          type: integer
        file_id:
          type: string
          nullable: true
        start_char_index:
          type: integer
        type:
          type: string
          enum:
            - char_location
    BetaCitationPageLocation:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_page_number
        - file_id
        - start_page_number
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_page_number:
          type: integer
        file_id:
          type: string
          nullable: true
        start_page_number:
          type: integer
        type:
          type: string
          enum:
            - page_location
    BetaCitationContentBlockLocation:
      type: object
      required:
        - cited_text
        - document_index
        - document_title
        - end_block_index
        - file_id
        - start_block_index
        - type
      properties:
        cited_text:
          type: string
        document_index:
          type: integer
        document_title:
          type: string
          nullable: true
        end_block_index:
          type: integer
        file_id:
          type: string
          nullable: true
        start_block_index:
          type: integer
        type:
          type: string
          enum:
            - content_block_location
    BetaCitationsWebSearchResultLocation:
      type: object
      required:
        - cited_text
        - encrypted_index
        - title
        - type
        - url
      properties:
        cited_text:
          type: string
        encrypted_index:
          type: string
        title:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - web_search_result_location
        url:
          type: string
    BetaCitationSearchResultLocation:
      type: object
      required:
        - cited_text
        - end_block_index
        - search_result_index
        - source
        - start_block_index
        - title
        - type
      properties:
        cited_text:
          type: string
        end_block_index:
          type: integer
        search_result_index:
          type: integer
        source:
          type: string
        start_block_index:
          type: integer
        title:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - search_result_location
    BetaDirectCaller:
      type: object
      description: Tool invocation directly from the model.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - direct
    BetaServerToolCaller:
      type: object
      description: Tool invocation generated by a server-side tool.
      required:
        - tool_id
        - type
      properties:
        tool_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_20250825
    BetaServerToolCaller20260120:
      type: object
      required:
        - tool_id
        - type
      properties:
        tool_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_20260120
    BetaWebSearchToolResultErrorCode:
      type: string
      enum:
        - invalid_tool_input
        - unavailable
        - max_uses_exceeded
        - too_many_requests
        - query_too_long
        - request_too_large
    BetaWebFetchToolResultErrorCode:
      type: string
      enum:
        - invalid_tool_input
        - url_too_long
        - url_not_allowed
        - url_not_accessible
        - unsupported_content_type
        - too_many_requests
        - max_uses_exceeded
        - unavailable
    BetaDocumentBlock:
      type: object
      required:
        - citations
        - source
        - title
        - type
      properties:
        citations:
          allOf:
            - $ref: '#/components/schemas/BetaCitationConfig'
          nullable: true
        source:
          oneOf:
            - $ref: '#/components/schemas/BetaBase64PDFSource'
            - $ref: '#/components/schemas/BetaPlainTextSource'
        title:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - document
    BetaCodeExecutionToolResultErrorCode:
      type: string
      enum:
        - invalid_tool_input
        - unavailable
        - too_many_requests
        - execution_time_exceeded
    BetaCodeExecutionOutputBlock:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_output
    BetaBashCodeExecutionOutputBlock:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_output
    BetaToolReferenceBlock:
      type: object
      required:
        - tool_name
        - type
      properties:
        tool_name:
          type: string
        type:
          type: string
          enum:
            - tool_reference
    BetaContentBlockSourceContent:
      oneOf:
        - $ref: '#/components/schemas/BetaTextBlockParam'
        - $ref: '#/components/schemas/BetaImageBlockParam'
    BetaToolReferenceBlockParam:
      type: object
      description: Tool reference block that can be included in tool_result content.
      required:
        - tool_name
        - type
      properties:
        tool_name:
          type: string
        type:
          type: string
          enum:
            - tool_reference
        cache_control:
          allOf:
            - $ref: '#/components/schemas/BetaCacheControlEphemeral'
          nullable: true
    BetaCodeExecutionOutputBlockParam:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - code_execution_output
    BetaBashCodeExecutionOutputBlockParam:
      type: object
      required:
        - file_id
        - type
      properties:
        file_id:
          type: string
        type:
          type: string
          enum:
            - bash_code_execution_output
    BetaCitationConfig:
      type: object
      required:
        - enabled
      properties:
        enabled:
          type: boolean
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: 格式：`Bearer <API_KEY>`

````