---
title: "Count tokens in a Message"
method: POST
path: "/v1/messages/count_tokens?beta=true"
---

# Count tokens in a Message

`POST /v1/messages/count_tokens?beta=true`

## Request

- Base URL: `https://api.anthropic.com`
- URL: `https://api.anthropic.com/v1/messages/count_tokens?beta=true`
- Auth: none declared

Count the number of tokens in a Message.

The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.

Learn more about token counting in our [user guide](https://platform.claude.com/docs/en/build-with-claude/token-counting)

## Headers

- `anthropic-beta` AnthropicBeta[]: Optional header to specify the beta version(s) you want to use.
  - union: Beta names you can send in the `anthropic-beta` header. See [Beta headers](https://platform.claude.com/docs/en/api/beta-headers) for how to send them and where to find the name a feature needs.
    - string
    - 'message-batches-2024-09-24' | 'prompt-caching-2024-07-31' | 'computer-use-2024-10-22' | 'computer-use-2025-01-24' | 'pdfs-2024-09-25' | 'token-counting-2024-11-01' | 'token-efficient-tools-2025-02-19' | 'output-128k-2025-02-19' | 'files-api-2025-04-14' | 'mcp-client-2025-04-04' | 'mcp-client-2025-11-20' | 'dev-full-thinking-2025-05-14' | 'interleaved-thinking-2025-05-14' | 'code-execution-2025-05-22' | 'extended-cache-ttl-2025-04-11' | 'context-1m-2025-08-07' | 'context-management-2025-06-27' | 'model-context-window-exceeded-2025-08-26' | 'skills-2025-10-02' | 'fast-mode-2026-02-01' | 'output-300k-2026-03-24' | 'user-profiles-2026-03-24' | 'user-profiles-2026-08-18' | 'user-profiles-2026-09-04' | 'advisor-tool-2026-03-01' | 'managed-agents-2026-04-01' | 'cache-diagnosis-2026-04-07' | 'dreaming-2026-04-21' | 'thinking-token-count-2026-05-13' | 'server-side-fallback-2026-06-01' | 'server-side-fallback-2026-07-01' | 'fallback-credit-2026-06-01' | 'fallback-credit-2026-07-01' | 'agent-memory-2026-07-22' | 'mid-conversation-tool-changes-2026-07-01' | 'compact-2026-01-12' | 'computer-use-2025-11-24' | 'mcp-tunnels-2026-06-22' | 'structured-outputs-2025-11-13' | 'task-budgets-2026-03-13' | 'thinking-display-updates-2026-08-18' | 'ce-user-management-2026-07-13' | 'mid-conversation-output-config-2026-07-01' | 'thinking-binding-controls-2026-08-01' | 'mid-conversation-system-clear-at-2026-08-21' | 'compact-2026-09-04' | 'inline-tools-2026-09-15' | 'mcp-client-2026-09-15' | 'ce-plugins-2026-09-01' | 'spend-limit-reads-2026-09-26' | 'telemetry-destinations-2026-08-11' | 'webhooks-2026-10-07' | 'admin-user-sign-out-2026-10-08' | 'message-threads-2026-08-12' | 'analytics-usage-cost-2026-08-24' | 'experimental-claude-tag-2026-10-21'
- `anthropic-version` string: The version of the Claude API you want to use. Read more about versioning and our version history [here](https://platform.claude.com/docs/en/api/versioning).
- `anthropic-user-profile-id` string: The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization.
- `anthropic-workspace-id` string

## Request body

- BetaCountMessageTokensParams
  - `cache_control` BetaCacheControlEphemeral
    - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
    - `type` 'ephemeral', required
  - `compaction` object, nullable: Compact the whole conversation and return a signed `compaction` block, alone, that a later request sends back first in `messages`, in place of the messages it summarizes. There is no trigger and no pause flag: sending the parameter compacts, and nothing is sampled after the block. The summarization prompt is the server's own unless `instructions` are given, which then replace it for this request; a value that is empty or only whitespace counts as absent.
    - `instructions` string, nullable: Replaces the server's default summarization prompt for this request. An empty or whitespace-only value counts as absent.
    - `type` 'summarize', required
  - `context_management` object, nullable: Context management configuration. This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.
    - `edits` union[]: List of context management edits to apply
      - union
        - BetaClearToolUses20250919
          - `clear_at_least` BetaInputTokensClearAtLeast
            - `type` 'input_tokens', required
            - `value` integer, required
          - `clear_tool_inputs` union: Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)
            - boolean
            - string[]
          - `exclude_tools` string[], nullable: Tool names whose uses are preserved from clearing
          - `keep` BetaToolUsesKeep
            - `type` 'tool_uses', required
            - `value` integer, required
          - `trigger` union: Condition that triggers the context management strategy
            - BetaInputTokensTrigger
              - …
            - BetaToolUsesTrigger
              - …
          - `type` 'clear_tool_uses_20250919', required
        - BetaClearThinking20251015
          - `keep` union: Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed.
            - union
              - …
            - 'all'
          - `type` 'clear_thinking_20251015', required
        - BetaCompact20260112: Automatically compact older context when reaching the configured trigger threshold.
          - `instructions` string, nullable: Additional instructions for summarization.
          - `pause_after_compaction` boolean: Whether to pause after compaction and return the compaction block to the user.
          - `trigger` BetaInputTokensTrigger
            - `type` 'input_tokens', required
            - `value` integer, required
          - `type` 'compact_20260112', required
  - `mcp_servers` BetaRequestMCPServerURLDefinition[]: MCP servers to be utilized in this request
    - `authorization_token` string, nullable
    - `name` string, required
    - `tool_configuration` BetaRequestMCPServerToolConfiguration
      - `allowed_tools` string[], nullable
      - `enabled` boolean, nullable
    - `type` 'url', required
    - `url` string, required
  - `messages` BetaInputMessageUnion[], required: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. This is called prefill. On models that don't support prefill, creating a message that ends with a partial `assistant` response returns a 400 error. See [Prefill not supported](https://platform.claude.com/docs/en/api/errors#prefill-not-supported). Example with a single `user` message: ```json [{"role": "user", "content": "Hello, Claude"}] ``` Example with multiple conversational turns: ```json [ {"role": "user", "content": "Hello there."}, {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, {"role": "user", "content": "Can you explain LLMs in plain English?"}, ] ``` Example with a partially-filled response from Claude, for models that support prefill: ```json [ {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, {"role": "assistant", "content": "The best answer is ("}, ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json {"role": "user", "content": "Hello, Claude"} ``` ```json {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter. There is a limit of 100,000 messages in a single request.
    - union
      - object
        - `content` union, required
          - string
          - BetaInputContentBlock[]
            - union
              - …
        - `role` 'user', required
      - object
        - `content` union, required
          - string
          - BetaInputContentBlock[]
            - union
              - …
        - `role` 'assistant', required
      - object
        - `clear_at` 'next_user_message' | 'never', nullable: How long this system message's text stays in front of the model. `"never"` (the default) renders it on every request that includes it. `"next_user_message"` renders it only for the user turn it follows: once a later `role: "user"` message exists in `messages` the message stays in the array (send it unchanged) but is no longer shown to the model. Only permitted on `role: "system"` messages.
        - `content` union
          - string
          - union[]
            - union
              - …
        - `output_config` object, nullable: Per-message output configuration on a role:"system" input message. Fields here apply per-turn; ``format`` remains top-level only. An empty ``{}`` is accepted on a message that carries content; a message with neither content nor output_config fields is rejected.
          - `effort` 'low' | 'medium' | 'high' | 'xhigh' | 'max': All possible effort levels.
        - `role` 'system', required
  - `model` union, required: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
    - 'claude-fable-5-2': Built for the most ambitious work in coding, enterprise workflows, and the sciences
    - 'claude-mythos-5-2': Built for the most demanding cybersecurity and life sciences research, available through verification programs
    - 'claude-haiku-5-5': Fastest model for high-volume, real-time tasks
    - 'claude-sonnet-5-5': Efficient model for coding and agents
    - 'claude-fable-5-1': Frontier intelligence for ambitious tasks across coding, scientific discovery, and enterprise workflows
    - 'claude-opus-5-5': Powerful intelligence for coding, knowledge work, and long-running agents
    - 'claude-mythos-5-1': Our most capable model for cybersecurity and biology research, available through trusted access programs
    - 'claude-sonnet-5': Efficient model for coding and agents
    - 'claude-fable-5': Next generation of intelligence for the hardest knowledge work and coding problems
    - 'claude-mythos-5': Most capable model for cybersecurity and biology research
    - 'claude-opus-5': Powerful intelligence for long-running agents and coding
    - 'claude-opus-4-8': Powerful intelligence for long-running agents and coding
    - 'claude-opus-4-7': Powerful intelligence for long-running agents and coding
    - 'claude-mythos-preview': New class of intelligence, strongest in coding and cybersecurity
    - 'claude-opus-4-6': Powerful intelligence for long-running agents and coding
    - 'claude-sonnet-4-6': Best combination of speed and intelligence
    - 'claude-haiku-4-5'
    - 'claude-haiku-4-5-20251001'
    - 'claude-opus-4-5': Powerful intelligence for long-running agents and coding
    - 'claude-opus-4-5-20251101': Powerful intelligence for long-running agents and coding
    - 'claude-sonnet-4-5': High-performance model for agents and coding
    - 'claude-sonnet-4-5-20250929': High-performance model for agents and coding
    - string
  - `output_config` BetaOutputConfig
    - `effort` 'low' | 'medium' | 'high' | 'xhigh' | 'max': All possible effort levels.
    - `format` BetaJsonOutputFormat
      - `schema` object, required: The JSON schema of the format
      - `type` 'json_schema', required
    - `task_budget` object, nullable: User-configurable total token budget across contexts.
      - `remaining` integer, nullable: Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided.
      - `total` integer, required: Total token budget across all contexts in the session.
      - `type` 'tokens', required: The budget type. Currently only 'tokens' is supported.
  - `output_format` object, nullable: Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) A schema to specify Claude's output format in responses. This parameter will be removed in a future release.
    - `schema` object, required: The JSON schema of the format
    - `type` 'json_schema', required
  - `speed` 'standard' | 'fast'
  - `system` union: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).
    - string
    - BetaRequestTextBlock[]
      - `cache_control` BetaCacheControlEphemeral
        - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
        - `type` 'ephemeral', required
      - `citations` union[], nullable
        - union
          - BetaRequestCharLocationCitation
            - `cited_text` string, required
            - `document_index` integer, required
            - `document_title` string, nullable, required
            - `end_char_index` integer, required
            - `start_char_index` integer, required
            - `type` 'char_location', required
          - BetaRequestPageLocationCitation
            - `cited_text` string, required
            - `document_index` integer, required
            - `document_title` string, nullable, required
            - `end_page_number` integer, required
            - `start_page_number` integer, required
            - `type` 'page_location', required
          - BetaRequestContentBlockLocationCitation
            - `cited_text` string, required: The full text of the cited block range, concatenated. Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
            - `document_index` integer, required
            - `document_title` string, nullable, required
            - `end_block_index` integer, required: Exclusive 0-based end index of the cited block range in the source's `content` array. Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
            - `start_block_index` integer, required: 0-based index of the first cited block in the source's `content` array.
            - `type` 'content_block_location', required
          - BetaRequestWebSearchResultLocationCitation
            - `cited_text` string, required
            - `encrypted_index` string, required
            - `title` string, nullable, required
            - `type` 'web_search_result_location', required
            - `url` string, required
          - BetaRequestSearchResultLocationCitation
            - `cited_text` string, required: The full text of the cited block range, concatenated. Always equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns.
            - `end_block_index` integer, required: Exclusive 0-based end index of the cited block range in the source's `content` array. Always greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`.
            - `search_result_index` integer, required: 0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results. Counted separately from `document_index`; server-side web search results are not included in this count.
            - `source` string, required
            - `start_block_index` integer, required: 0-based index of the first cited block in the source's `content` array.
            - `title` string, nullable, required
            - `type` 'search_result_location', required
      - `text` string, required
      - `type` 'text', required
  - `thinking` union: Configuration for Claude's thinking. With `{"type": "adaptive"}`, Claude decides when and how much to think. With `{"type": "enabled"}` (manual extended thinking), you set a `budget_tokens` of at least 1,024. Thinking tokens count toward your `max_tokens` limit. Which `type` values are accepted, and what happens when you omit `thinking`, depend on the model. See [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#configuring-thinking) for each model's behavior.
    - BetaThinkingConfigEnabled
      - `block_binding` object, nullable: Controls for block binding: what happens when a thinking block this request sends back fails the conversation check. Every field is optional; an empty object means every default.
        - `prefix_mismatch_behavior` 'error' | 'drop_block': What happens when a thinking block in `messages` fails the conversation check: it was created in a different conversation, or the messages before it have changed since. `"error"` (the default) fails the request with a 400 error. `"drop_block"` removes the failing blocks and the request proceeds; the model no longer sees the dropped reasoning.
      - `budget_tokens` integer, required: Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.
      - `display` 'summarized' | 'omitted' | 'updates'
      - `type` 'enabled', required
    - BetaThinkingConfigDisabled
      - `type` 'disabled', required
    - BetaThinkingConfigBetweenTools
      - `type` 'between_tools', required
    - BetaThinkingConfigAdaptive
      - `block_binding` object, nullable: Controls for block binding: what happens when a thinking block this request sends back fails the conversation check. Every field is optional; an empty object means every default.
        - `prefix_mismatch_behavior` 'error' | 'drop_block': What happens when a thinking block in `messages` fails the conversation check: it was created in a different conversation, or the messages before it have changed since. `"error"` (the default) fails the request with a 400 error. `"drop_block"` removes the failing blocks and the request proceeds; the model no longer sees the dropped reasoning.
      - `display` 'summarized' | 'omitted' | 'updates'
      - `type` 'adaptive', required
  - `tool_choice` union: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
    - BetaToolChoiceAuto: The model will automatically decide whether to use tools.
      - `disable_parallel_tool_use` boolean: Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output at most one tool use.
      - `type` 'auto', required
    - BetaToolChoiceAny: The model will use any available tools.
      - `disable_parallel_tool_use` boolean: Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
      - `type` 'any', required
    - BetaToolChoiceTool: The model will use the specified tool with `tool_choice.name`.
      - `disable_parallel_tool_use` boolean: Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.
      - `name` string, required: The name of the tool to use.
      - `type` 'tool', required
    - BetaToolChoiceNone: The model will not be allowed to use tools.
      - `type` 'none', required
  - `tools` union[]: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: * `name`: Name of the tool. * `description`: Optional, but strongly-recommended description of the tool. * `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.
    - union
      - BetaTool
        - `type` 'custom', nullable
        - `description` string: Description of what this tool does. Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
        - `name` string, required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `input_schema` BetaInputSchema, required
          - `properties` object, nullable
          - `required` string[], nullable
          - `type` 'object', required
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `eager_input_streaming` boolean, nullable: Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers.
        - `allowed_callers` BetaAllowedCaller[]
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
      - BetaBashTool20241022
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'bash', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'bash_20241022', required
      - BetaBashTool20250124
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'bash', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'bash_20250124', required
      - BetaCodeExecutionTool20250522
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'code_execution', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'code_execution_20250522', required
      - BetaCodeExecutionTool20250825
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'code_execution', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'code_execution_20250825', required
      - BetaCodeExecutionTool20260120: A `tools` entry for the code execution tool, version `code_execution_20260120`. It adds REPL state persistence to version `code_execution_20250825`. REPL state persistence applies with programmatic tool calling. With it, the Python interpreter state, such as variable bindings, persists across requests that reuse the container. See the [code execution tool guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#tool-versions) to learn what each tool version adds.
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'code_execution', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'code_execution_20260120', required
      - BetaCodeExecutionTool20260521: Code execution tool with REPL state persistence.
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'code_execution', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'code_execution_20260521', required
      - BetaBrowserToolset20260801: The browser toolset: a single ``tools[]`` entry (carrying no ``name``) that declares the browser tool family. The model is served the family's tool with any members disabled via ``configs`` removed from its schema.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `configs` BetaBrowserToolsetConfigs: Per-member configuration for ``browser_toolset_20260801``: one optional field per member tool, keyed by the member name — the same name the member's ``tool_use`` blocks carry. Every member is an accepted key, and a member's defaults apply wherever its key is absent. Unknown keys are rejected: the field set is this toolset version's complete member set.
          - `close_tab` BetaBrowserCloseTabConfig: ``close_tab``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `double_click` BetaBrowserDoubleClickConfig: ``double_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `file_upload` BetaBrowserFileUploadConfig: ``file_upload``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `find` BetaBrowserFindConfig: ``find``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `form_input` BetaBrowserFormInputConfig: ``form_input``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `get_page_text` BetaBrowserGetPageTextConfig: ``get_page_text``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `hold_key` BetaBrowserHoldKeyConfig: ``hold_key``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `hover` BetaBrowserHoverConfig: ``hover``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `javascript_exec` BetaBrowserJavascriptExecConfig: ``javascript_exec``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `key` BetaBrowserKeyConfig: ``key``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_click` BetaBrowserLeftClickConfig: ``left_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_click_drag` BetaBrowserLeftClickDragConfig: ``left_click_drag``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_mouse_down` BetaBrowserLeftMouseDownConfig: ``left_mouse_down``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_mouse_up` BetaBrowserLeftMouseUpConfig: ``left_mouse_up``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `list_tabs` BetaBrowserListTabsConfig: ``list_tabs``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `middle_click` BetaBrowserMiddleClickConfig: ``middle_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `mouse_move` BetaBrowserMouseMoveConfig: ``mouse_move``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `navigate` BetaBrowserNavigateConfig: ``navigate``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `new_tab` BetaBrowserNewTabConfig: ``new_tab``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `read_console` BetaBrowserReadConsoleConfig: ``read_console``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `read_network` BetaBrowserReadNetworkConfig: ``read_network``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `read_page` BetaBrowserReadPageConfig: ``read_page``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `right_click` BetaBrowserRightClickConfig: ``right_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `screenshot` BetaBrowserScreenshotConfig: ``screenshot``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `scroll` BetaBrowserScrollConfig: ``scroll``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `scroll_to` BetaBrowserScrollToConfig: ``scroll_to``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `switch_tab` BetaBrowserSwitchTabConfig: ``switch_tab``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `triple_click` BetaBrowserTripleClickConfig: ``triple_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `type` BetaBrowserTypeConfig: ``type``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `wait` BetaBrowserWaitConfig: ``wait``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `zoom` BetaBrowserZoomConfig: ``zoom``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
        - `type` 'browser_toolset_20260801', required
      - BetaComputerUseTool20241022
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `display_height_px` integer, required: The height of the display in pixels.
        - `display_number` integer, nullable: The X11 display number (e.g. 0, 1) for the display.
        - `display_width_px` integer, required: The width of the display in pixels.
        - `input_examples` object[]
        - `name` 'computer', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'computer_20241022', required
      - BetaMemoryTool20250818
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'memory', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'memory_20250818', required
      - BetaComputerUseTool20250124
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `display_height_px` integer, required: The height of the display in pixels.
        - `display_number` integer, nullable: The X11 display number (e.g. 0, 1) for the display.
        - `display_width_px` integer, required: The width of the display in pixels.
        - `input_examples` object[]
        - `name` 'computer', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'computer_20250124', required
      - BetaTextEditor20241022
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'str_replace_editor', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'text_editor_20241022', required
      - BetaComputerUseTool20251124
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `display_height_px` integer, required: The height of the display in pixels.
        - `display_number` integer, nullable: The X11 display number (e.g. 0, 1) for the display.
        - `display_width_px` integer, required: The width of the display in pixels.
        - `enable_zoom` boolean: Whether to enable an action to take a zoomed-in screenshot of the screen.
        - `input_examples` object[]
        - `name` 'computer', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'computer_20251124', required
      - BetaComputerToolset20260801: The computer toolset: a single ``tools[]`` entry (carrying no ``name``) that declares the computer tool family. The model is served the family's tool with any members disabled via ``configs`` removed from its schema. Every member is enabled by default, zoom included. The single-tool options ``display_number`` and ``enable_zoom`` are not fields of a toolset entry — it carries only ``type``, ``configs``, and ``cache_control``; zoom is controlled via ``configs.zoom.enabled``.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `configs` BetaComputerToolsetConfigs: Per-member configuration for ``computer_toolset_20260801``: one optional field per member tool, keyed by the member name — the same name the member's ``tool_use`` blocks carry. Every member is an accepted key, and a member's defaults apply wherever its key is absent. Unknown keys are rejected: the field set is this toolset version's complete member set.
          - `cursor_position` BetaComputerCursorPositionConfig: ``cursor_position``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `double_click` BetaComputerDoubleClickConfig: ``double_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `hold_key` BetaComputerHoldKeyConfig: ``hold_key``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `key` BetaComputerKeyConfig: ``key``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_click` BetaComputerLeftClickConfig: ``left_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_click_drag` BetaComputerLeftClickDragConfig: ``left_click_drag``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_mouse_down` BetaComputerLeftMouseDownConfig: ``left_mouse_down``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `left_mouse_up` BetaComputerLeftMouseUpConfig: ``left_mouse_up``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `middle_click` BetaComputerMiddleClickConfig: ``middle_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `mouse_move` BetaComputerMouseMoveConfig: ``mouse_move``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `right_click` BetaComputerRightClickConfig: ``right_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `screenshot` BetaComputerScreenshotConfig: ``screenshot``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `scroll` BetaComputerScrollConfig: ``scroll``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `triple_click` BetaComputerTripleClickConfig: ``triple_click``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `type` BetaComputerTypeConfig: ``type``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `wait` BetaComputerWaitConfig: ``wait``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
          - `zoom` BetaComputerZoomConfig: ``zoom``'s config overrides.
            - `defer_loading` boolean, nullable: Defer loading for this member. Must resolve to the same value on every enabled member of the toolset.
            - `enabled` boolean, nullable: Whether this member is offered to the model. Default is per member, per the toolset's documentation. A member whose enabled resolves false is withheld from the served schema.
        - `type` 'computer_toolset_20260801', required
      - BetaTextEditor20250124
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'str_replace_editor', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'text_editor_20250124', required
      - BetaTextEditor20250429
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `name` 'str_replace_based_edit_tool', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'text_editor_20250429', required
      - BetaTextEditor20250728
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `input_examples` object[]
        - `max_characters` integer, nullable: Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.
        - `name` 'str_replace_based_edit_tool', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'text_editor_20250728', required
      - BetaWebSearchTool20250305
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.
        - `blocked_domains` string[], nullable: If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_search', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_search_20250305', required
        - `user_location` BetaUserLocation
          - `city` string, nullable: The city of the user.
          - `country` string, nullable: The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
          - `region` string, nullable: The region of the user.
          - `timezone` string, nullable: The [IANA timezone](https://nodatime.org/TimeZones) of the user.
          - `type` 'approximate', required
      - BetaWebFetchTool20250910
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: List of domains to allow fetching from
        - `blocked_domains` string[], nullable: List of domains to block fetching from
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `citations` BetaRequestCitationsConfig
          - `enabled` boolean
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_content_tokens` integer, nullable: Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_fetch', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_fetch_20250910', required
        - `url_sources` BetaWebFetchUrlSources: Which sources contribute to the set of URLs web fetch may fetch. Each key is a tagged variant: ``user_input`` is ``all`` or ``none``; the two tool filters are ``all``, ``none``, ``only`` (only the named tools' results) or ``except`` (every result but the named tools'). A named tool must be declared in this request's ``tools[]``.
          - `client_tool_results` union: Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `server_tool_results` union: Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `user_input` union: Whether URLs in user messages are fetchable: "all" or "none".
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
      - BetaWebSearchTool20260209
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.
        - `blocked_domains` string[], nullable: If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_search', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_search_20260209', required
        - `user_location` BetaUserLocation
          - `city` string, nullable: The city of the user.
          - `country` string, nullable: The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
          - `region` string, nullable: The region of the user.
          - `timezone` string, nullable: The [IANA timezone](https://nodatime.org/TimeZones) of the user.
          - `type` 'approximate', required
      - BetaWebFetchTool20260209
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: List of domains to allow fetching from
        - `blocked_domains` string[], nullable: List of domains to block fetching from
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `citations` BetaRequestCitationsConfig
          - `enabled` boolean
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_content_tokens` integer, nullable: Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_fetch', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_fetch_20260209', required
        - `url_sources` BetaWebFetchUrlSources: Which sources contribute to the set of URLs web fetch may fetch. Each key is a tagged variant: ``user_input`` is ``all`` or ``none``; the two tool filters are ``all``, ``none``, ``only`` (only the named tools' results) or ``except`` (every result but the named tools'). A named tool must be declared in this request's ``tools[]``.
          - `client_tool_results` union: Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `server_tool_results` union: Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `user_input` union: Whether URLs in user messages are fetchable: "all" or "none".
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
      - BetaWebFetchTool20260309: Web fetch tool with use_cache parameter for bypassing cached content.
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: List of domains to allow fetching from
        - `blocked_domains` string[], nullable: List of domains to block fetching from
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `citations` BetaRequestCitationsConfig
          - `enabled` boolean
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_content_tokens` integer, nullable: Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_fetch', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_fetch_20260309', required
        - `url_sources` BetaWebFetchUrlSources: Which sources contribute to the set of URLs web fetch may fetch. Each key is a tagged variant: ``user_input`` is ``all`` or ``none``; the two tool filters are ``all``, ``none``, ``only`` (only the named tools' results) or ``except`` (every result but the named tools'). A named tool must be declared in this request's ``tools[]``.
          - `client_tool_results` union: Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `server_tool_results` union: Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `user_input` union: Whether URLs in user messages are fetchable: "all" or "none".
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
        - `use_cache` boolean: Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
      - BetaWebSearchTool20260318
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.
        - `blocked_domains` string[], nullable: If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_search', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `response_inclusion` 'full' | 'excluded': How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_search_20260318', required
        - `user_location` BetaUserLocation
          - `city` string, nullable: The city of the user.
          - `country` string, nullable: The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.
          - `region` string, nullable: The region of the user.
          - `timezone` string, nullable: The [IANA timezone](https://nodatime.org/TimeZones) of the user.
          - `type` 'approximate', required
      - BetaWebFetchTool20260318
        - `allowed_callers` BetaAllowedCaller[]
        - `allowed_domains` string[], nullable: List of domains to allow fetching from
        - `blocked_domains` string[], nullable: List of domains to block fetching from
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `citations` BetaRequestCitationsConfig
          - `enabled` boolean
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_content_tokens` integer, nullable: Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `name` 'web_fetch', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `response_inclusion` 'full' | 'excluded': How this tool's result blocks appear in the API response when the result was consumed by a completed code_execution call in the same turn. 'full' returns the complete content (default). 'excluded' drops the nested server_tool_use and result block pair entirely. Results from direct calls, or from code_execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'web_fetch_20260318', required
        - `url_sources` BetaWebFetchUrlSources: Which sources contribute to the set of URLs web fetch may fetch. Each key is a tagged variant: ``user_input`` is ``all`` or ``none``; the two tool filters are ``all``, ``none``, ``only`` (only the named tools' results) or ``except`` (every result but the named tools'). A named tool must be declared in this request's ``tools[]``.
          - `client_tool_results` union: Which client tools' results contribute fetchable URLs: "all", "none", or an only or except list of client tool names from tools[].
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `server_tool_results` union: Which server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
            - BetaWebFetchUrlSourceOnly: The tool filter variant under which only the named tools' results contribute.
              - …
            - BetaWebFetchUrlSourceExcept: The tool filter variant under which every result but the named tools' contributes.
              - …
          - `user_input` union: Whether URLs in user messages are fetchable: "all" or "none".
            - BetaWebFetchUrlSourceAll: The ``url_sources`` variant under which a source contributes in full: every result of the tool filter's source, or all user input.
              - …
            - BetaWebFetchUrlSourceNone: The ``url_sources`` variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
              - …
        - `use_cache` boolean: Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources.
      - BetaAdvisorTool20260301
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `caching` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `max_tokens` integer, nullable: Bounds the advisor's total output (thinking + text) per call. When the advisor hits this cap, the returned advisor_result or advisor_redacted_result block carries stop_reason='max_tokens', and a truncation note is appended to the advice text the worker model sees (inside the encrypted blob in redacted mode). When set, the API also passes the advisor its remaining-token budget, so the advisor shapes its output toward the cap. When omitted, the advisor model's default output cap applies and the API doesn't pass a budget.
        - `max_uses` integer, nullable: Maximum number of times the tool can be used in the API request.
        - `model` union, required: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.
          - 'claude-fable-5-2': Built for the most ambitious work in coding, enterprise workflows, and the sciences
          - 'claude-mythos-5-2': Built for the most demanding cybersecurity and life sciences research, available through verification programs
          - 'claude-haiku-5-5': Fastest model for high-volume, real-time tasks
          - 'claude-sonnet-5-5': Efficient model for coding and agents
          - 'claude-fable-5-1': Frontier intelligence for ambitious tasks across coding, scientific discovery, and enterprise workflows
          - 'claude-opus-5-5': Powerful intelligence for coding, knowledge work, and long-running agents
          - 'claude-mythos-5-1': Our most capable model for cybersecurity and biology research, available through trusted access programs
          - 'claude-sonnet-5': Efficient model for coding and agents
          - 'claude-fable-5': Next generation of intelligence for the hardest knowledge work and coding problems
          - 'claude-mythos-5': Most capable model for cybersecurity and biology research
          - 'claude-opus-5': Powerful intelligence for long-running agents and coding
          - 'claude-opus-4-8': Powerful intelligence for long-running agents and coding
          - 'claude-opus-4-7': Powerful intelligence for long-running agents and coding
          - 'claude-mythos-preview': New class of intelligence, strongest in coding and cybersecurity
          - 'claude-opus-4-6': Powerful intelligence for long-running agents and coding
          - 'claude-sonnet-4-6': Best combination of speed and intelligence
          - 'claude-haiku-4-5'
          - 'claude-haiku-4-5-20251001'
          - 'claude-opus-4-5': Powerful intelligence for long-running agents and coding
          - 'claude-opus-4-5-20251101': Powerful intelligence for long-running agents and coding
          - 'claude-sonnet-4-5': High-performance model for agents and coding
          - 'claude-sonnet-4-5-20250929': High-performance model for agents and coding
          - string
        - `name` 'advisor', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'advisor_20260301', required
      - BetaToolSearchToolBM2520251119
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'tool_search_tool_bm25', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25', required
      - BetaToolSearchToolRegex20251119
        - `allowed_callers` BetaAllowedCaller[]
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `defer_loading` boolean: If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search.
        - `name` 'tool_search_tool_regex', required: Name of the tool. This is how the tool will be called by the model and in `tool_use` blocks.
        - `strict` boolean: When true, guarantees schema validation on tool names and inputs
        - `type` 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex', required
      - BetaMCPToolset: Configuration for a group of tools from an MCP server. Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
        - `cache_control` BetaCacheControlEphemeral
          - `ttl` '5m' | '1h': The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.
          - `type` 'ephemeral', required
        - `configs` object, nullable: Configuration overrides for specific tools, keyed by tool name
        - `default_config` BetaMCPToolDefaultConfig: Default configuration for tools in an MCP toolset.
          - `defer_loading` boolean
          - `enabled` boolean
        - `mcp_server_name` string, required: Name of the MCP server to configure tools for
        - `tools` BetaMCPTool[], nullable: The server's tool listing, pinned: when present, the server is not asked for its tools before sampling and exactly these entries, with `default_config` and `configs` applied, are the toolset's tools. Copy it from the `mcp_tool_listing` block of an earlier response.
          - `description` string, nullable: The tool's description as the MCP server lists it.
          - `input_schema` object, required: The tool's input schema as the MCP server lists it, verbatim.
          - `name` string, required: The tool's name as the MCP server lists it (not prefixed with the server name).
        - `type` 'mcp_toolset', required

## Response `200`

Successful Response

- BetaCountMessageTokensResponse
  - `context_management` object, nullable, required: Information about context management applied to the message.
    - `original_input_tokens` integer, required: The original token count before context management was applied
  - `input_tokens` integer, required: The total number of tokens across the provided list of messages, system prompt, and tools.

## Other responses

- `400`: Invalid argument - The client specified an invalid argument
- `401`: Unauthenticated - The request does not have valid authentication credentials
- `403`: Permission denied - The caller does not have permission to execute the specified operation
- `404`: Not found - Some requested entity was not found
- `408`: Deadline exceeded - The deadline expired before the operation could complete
- `409`: Aborted - The operation was aborted due to concurrency issue
- `412`: Failed precondition - Operation was rejected because the system is not in required state
- `413`: Out of range - Operation was attempted past the valid range
- `429`: Resource exhausted - Some resource has been exhausted (rate limiting)
- `431`: Request header fields too large - Request metadata was too large
- `499`: Cancelled - The operation was cancelled by the client
- `500`: Internal - Internal server error
- `501`: Unimplemented - The operation is not implemented or supported
- `503`: Unavailable - The service is currently unavailable
- `504`: Deadline exceeded - Upstream service did not respond in time
- `529`: Overloaded - The service is temporarily overloaded

## Changes

- **2026-11-09** `9b8a60482a33`: 11 breaking, 11 info
  - removed `subschema #1, subschema #2` from the `messages/items/oneOf[subschema #1: UserInputMessage]/content/anyOf[subschema #2]/items/oneOf[subschema #20: RequestCompactionBlock]/tool_changes/anyOf[subschema #1]/items/oneOf[subschema #1: RequestToolAdditionBlock]/tool/oneOf[subschema #4: ToolChangeToolDefinition]/definition/oneOf[subschema #25: AdvisorTool_20260301]/model` request property `anyOf` list
  - removed `subschema #1, subschema #2` from the `messages/items/oneOf[subschema #1: UserInputMessage]/content/anyOf[subschema #2]/items/oneOf[subschema #21: RequestToolAdditionBlock]/tool/oneOf[subschema #4: ToolChangeToolDefinition]/definition/oneOf[subschema #25: AdvisorTool_20260301]/model` request property `anyOf` list
  - removed `subschema #1, subschema #2` from the `messages/items/oneOf[subschema #1: UserInputMessage]/content/anyOf[subschema #2]/items/oneOf[subschema #24: RequestFallbackBlock]/from/model` request property `anyOf` list
  - removed `subschema #1, subschema #2` from the `messages/items/oneOf[subschema #1: UserInputMessage]/content/anyOf[subschema #2]/items/oneOf[subschema #24: RequestFallbackBlock]/to/model` request property `anyOf` list
  - …18 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/anthropics/apis/anthropic-api/changes/v1/messages/count_tokens%3Fbeta=true/post.md)

---

[API](https://skmtc.dev/anthropics/apis/anthropic-api.md) - [All operations](https://skmtc.dev/anthropics/apis/anthropic-api/llms.txt) - [OpenAPI document](https://skmtc.dev/anthropics/apis/anthropic-api/revisions/690622377a5e?raw)
