Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
One capture · api

One read of Claude Developer Platform

147 pages moved out of 634 read.

api-20260922T163722Z

Pages moved 147 significant first
Pages read 634 in this capture
Captured 16:37 UTC
Corpus hash 4b35df8b3fd5 corpus-hash

What this read moved

1–25 of 147

This capture is too large to show at once. Changes 1-25 of 147 are below, significant first; the rest are on the following screens.

about-claude/models/choosing-a-model Changed · +12 / -8 lines

from line 9
99When choosing a Claude model, consider first evaluating these factors:
1010 
1111* **Capabilities:** What specific features or capabilities will you need the model to have to meet your needs?
12* **Speed:** How quickly does the model need to respond in your application? Claude Opus 5 and Claude Opus 4.8 support [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (research preview), which delivers up to 2.5x higher output speed at premium pricing.
12* **Speed:** How quickly does the model need to respond in your application? Claude Opus 5.5, Claude Opus 5, and Claude Opus 4.8 support [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (research preview), which delivers up to 2.5x higher output speed at premium pricing.
1313* **Cost:** What's your budget for both development and production usage?
14* **Effort:** Several Claude models support an [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) that trades intelligence for latency and cost within a single model. Tuning effort is often a better lever than switching models. On Claude Fable 5.1 and Claude Opus 5, start with the default (`high`) and adjust up or down based on your evals. On Claude Opus 4.8 and Claude Opus 4.7, the `xhigh` effort level, between `high` and `max`, is the best setting for most coding and agentic use cases.
14* **Effort:** Several Claude models support an [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) that trades intelligence for latency and cost within a single model. Tuning effort is often a better lever than switching models. On Claude Fable 5.1 and Claude Opus 5, start with the default (`high`) and adjust up or down based on your evals. On Claude Opus 5.5 the default is `medium`; start there and adjust the same way. On Claude Opus 4.8 and Claude Opus 4.7, the `xhigh` effort level, between `high` and `max`, is the best setting for most coding and agentic use cases.
1515 
1616***
1717 
from line 39
3939 
4040For complex tasks where intelligence and advanced capabilities are paramount, you may want to start capability-first: implement with the strongest starting point for your task, then optimize to more efficient models down the line:
4141 
421. Implement with Claude Opus 5.
432. [Optimize your prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5) for this model.
421. Implement with Claude Opus 5.5.
432. [Optimize your prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5-5) for this model.
44443. Evaluate if performance meets your requirements.
45454. Consider increasing efficiency by lowering [effort](https://platform.claude.com/docs/en/build-with-claude/effort) or downgrading models over time with greater workflow optimization.
46465. If your evals at `xhigh` or `max` effort still fall short on demanding reasoning or long-horizon agentic work, move to [Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1).
from line 53
5353* Applications where accuracy outweighs cost considerations
5454* Advanced coding and high-autonomy agentic work
5555 
56**Claude Opus 5** (`claude-opus-5`) is built for complex agentic coding and enterprise work, with deep reasoning, long-horizon tasks, and test-time compute scaling.
56**Claude Opus 5.5** (`claude-opus-5-5`) is built for long-running agentic coding and knowledge work, with [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) always on. If your integration forces tool use (`tool_choice` of type `any` or `tool`), turns thinking off, or uses the `computer_20251124` computer use tool, see [Breaking changes](https://platform.claude.com/docs/en/models/opus-5-5/whats-new-opus-5-5#breaking-changes) before switching.
5757 
5858**Claude Fable 5.1** (`claude-fable-5-1`) is Anthropic's most capable widely released model. It extends Claude Fable 5 with stronger long-running agentic coding, knowledge work, and research at the same input and output prices, with cache reads at a quarter of the cost. **Claude Mythos 5.1** (`claude-mythos-5-1`) offers the same capabilities to [Project Glasswing](https://anthropic.com/glasswing) participants only. Both models use always-on [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking). See [What's new in Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1) for details.
5959 
60Claude Fable 5 and Claude Mythos 5 are also available. See [Introducing Claude Fable 5 and Claude Mythos 5](https://platform.claude.com/docs/en/models/fable-5/introducing-claude-fable-5-and-claude-mythos-5) for details. For context windows, output limits, and prices, see the [model comparison table](https://platform.claude.com/docs/en/models/overview#latest-models-comparison).
60For context windows, output limits, and prices, see the [model comparison table](https://platform.claude.com/docs/en/models/overview#latest-models-comparison).
6161 
6262## Model selection matrix
6363 
64Most workloads start with Claude Opus 5.
64Most workloads start with Claude Opus 5.5.
6565 
6666| When you need... | Consider starting with... | Example use cases |
6767| ------------------------------------------------------------------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
6868| The highest available capability | Claude Fable 5.1 | Agent sessions that run for hours, multistep deep research, analysis carried through to a finished document, spreadsheet, or deck |
69| Complex agentic coding and enterprise work | Claude Opus 5 | Multihour autonomous coding agents, large-scale refactoring, complex systems engineering, vision-heavy workflows, computer use |
69| Complex agentic coding and enterprise work | Claude Opus 5.5 | Multihour autonomous coding agents, large-scale refactoring, complex systems engineering, vision-heavy workflows, computer use |
7070| Speed and capability for everyday coding, agent, and enterprise workloads | Claude Sonnet 5 | Code generation, data analysis, content creation, visual understanding, agentic tool use |
7171| The lowest latency and price, with extended thinking | Claude Haiku 4.5 | Real-time applications, high-volume intelligent processing, cost-sensitive deployments needing strong reasoning, sub-agent tasks |
7272 
from line 101
101101 
102102 <Card title="What's new in Claude Fable 5.1" icon="sparkle" href="https://platform.claude.com/docs/en/models/fable-5-1/whats-new-fable-5-1">
103103 Built for demanding reasoning and long-horizon agentic work
104 </Card>
105 
106 <Card title="What's new in Claude Opus 5.5" icon="sparkle" href="https://platform.claude.com/docs/en/models/opus-5-5/whats-new-opus-5-5">
107 The latest Opus model: breaking changes, new features, and behavior differences
104108 </Card>
105109 
106110 <Card title="What's new in Claude Opus 5" icon="sparkle" href="https://platform.claude.com/docs/en/models/opus-5/whats-new-opus-5">

about-claude/models/optimizing-for-cost-and-intelligence Changed · +3 / -3 lines

from line 65
6565* Turns arrive seconds apart: stay on the 5-minute default. When nothing paused, it cost 15% less than the 1-hour setting on Claude Sonnet 5 and 11% less on Claude Opus 5.
6666* Gaps over an hour are common: stay on the default. A gap over an hour expires both durations, and the 1-hour setting then re-writes the prefix at its higher write price, so it loses on each of those gaps. Of your pauses longer than 5 minutes, if about 60% or more also run past an hour, stay on the default; the 1-hour duration pays only when at least about 40% of long pauses end within the hour.
6767 
68Anthropic measured the triage job from [Trim input and context tokens](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#trim-input-and-context-tokens) with pauses inserted before some turns to simulate a person's delay[16](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs). On both models measured, the 1-hour cache became the cheaper setting once about 1 turn in 30 followed a pause, so the 1-in-20 rule leaves a margin, and the gap widens quickly past the crossover because every paused turn on the 5-minute setting re-writes the whole prefix. Every current model uses the same cache-write multipliers, and every model but Claude Fable 5.1 and Claude Mythos 5.1 the same read price, so the crossover is in the same range on the other models; Fable 5.1 is the case covered next. Accuracy stayed within run-to-run noise in every cell. The turn after a pause kept its warm-cache latency on the 1-hour setting. The following chart plots cost per session against the share of paused turns on Claude Sonnet 5:
68Anthropic measured the triage job from [Trim input and context tokens](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#trim-input-and-context-tokens) with pauses inserted before some turns to simulate a person's delay[16](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs). On both models measured, the 1-hour cache became the cheaper setting once about 1 turn in 30 followed a pause, so the 1-in-20 rule leaves a margin, and the gap widens quickly past the crossover because every paused turn on the 5-minute setting re-writes the whole prefix. Every current model uses the same cache-write multipliers, and every model but Claude Fable 5.1, Claude Mythos 5.1, and Claude Opus 5.5 the same read price, so the crossover is in the same range on the other models; Fable 5.1 is the case covered next. Accuracy stayed within run-to-run noise in every cell. The turn after a pause kept its warm-cache latency on the 1-hour setting (measured on Claude Sonnet 5 and Claude Opus 5, not on Claude Opus 5.5). The following chart plots cost per session against the share of paused turns on Claude Sonnet 5:
6969 
7070![Line chart: cost per triage session by share of turns after a pause; the 1-hour cache is cheaper past about 1 turn in 30](https://platform.claude.com/docs/images/cost-intel-cache-ttl.png)
7171 
from line 241
241241 
242242## Trade cost against intelligence
243243 
244These levers set where a single model sits between cost and intelligence: model choice, effort, re-running failures at a higher setting, and the budgets and caps it works within. Start with an effort sweep on your current model ([Tune effort](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#tune-effort)). From lowest to highest cost and capability, the current models are Claude Haiku 4.5, Claude Sonnet 5, Claude Opus 5, and Claude Fable 5.1 (the frontier model); [Models overview](https://platform.claude.com/docs/en/models/overview) has the full lineup and prices.
244These levers set where a single model sits between cost and intelligence: model choice, effort, re-running failures at a higher setting, and the budgets and caps it works within. Start with an effort sweep on your current model ([Tune effort](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#tune-effort)). From lowest to highest cost and capability, the current models are Claude Haiku 4.5, Claude Sonnet 5, Claude Opus 5.5, and Claude Fable 5.1 (the frontier model); [Models overview](https://platform.claude.com/docs/en/models/overview) has the full lineup and prices.
245245 
246246### Compare models on cost per task
247247 
from line 277
277277 
278278### Tune effort
279279 
280Effort is the most direct way to tune a model to your task. The `effort` parameter governs how much thinking, tool calling, and self-verification the model does, and the default (`high`) suits demanding tasks. Cost scales with all that activity; accuracy scales only with the part your task needs. Below the model's ceiling, the highest effort levels pay for depth the task never uses.
280Effort is the most direct way to tune a model to your task. The `effort` parameter governs how much thinking, tool calling, and self-verification the model does, and `high`, the default on most models, suits demanding tasks; Claude Opus 5.5 defaults to `medium`. Cost scales with all that activity; accuracy scales only with the part your task needs. Below the model's ceiling, the highest effort levels pay for depth the task never uses.
281281 
282282On the research and knowledge-work benchmarks (WideSearch[1](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs), DeepWideSearch[6](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs), BrowseComp[4](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs), and GDPval[2](https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligence#refs), all with Claude Fable 5), the curve of accuracy against cost is nearly flat: `low` gave up 1 to 3 points for a third to a half off the cost per task, `medium` matched the default's accuracy at about 70% to 87% of its cost, and the default bought nothing measurable over `medium` on any of the four. On DeepWideSearch, `low` also matched an orchestrator with a Claude Sonnet 5 worker at 29% lower cost: lowering effort beat an architecture change.
283283 

about-claude/pricing Changed · +17 / -9 lines

from line 18
1818| Claude Mythos 5.1 ([limited availability](https://anthropic.com/glasswing)) | $10 / MTok | $12.50 / MTok | $20 / MTok | $0.25 / MTok<sup>1</sup> | $50 / MTok |
1919| Claude Fable 5 | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok |
2020| Claude Mythos 5 ([limited availability](https://anthropic.com/glasswing)) | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok |
21| Claude Opus 5.5 | $4 / MTok | $5 / MTok | $8 / MTok | $0.20 / MTok<sup>2</sup> | $20 / MTok |
2122| Claude Opus 5 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok |
2223| Claude Opus 4.8 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok |
2324| Claude Opus 4.7 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok |
from line 33
3233| Claude Haiku 4.5 | $1 / MTok | $1.25 / MTok | $2 / MTok | $0.10 / MTok | $5 / MTok |
3334| Claude Haiku 3.5 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $0.80 / MTok | $1 / MTok | $1.60 / MTok | $0.08 / MTok | $4 / MTok |
3435 
35*<sup>1 Cache hits and refreshes on Claude Fable 5.1 and Claude Mythos 5.1 are priced at 0.025x the base input price. All other models use the standard 0.1x multiplier.</sup>*
36*<sup>1 Cache hits and refreshes on Claude Fable 5.1 and Claude Mythos 5.1 are priced at 0.025x the base input price.</sup>*
3637 
38*<sup>2 Cache hits and refreshes on Claude Opus 5.5 are priced at 0.05x the base input price.</sup>*
39 
40*<sup>All other models use the standard 0.1x multiplier.</sup>*
41 
3742<Note id="claude-sonnet-5-introductory-pricing">
3843 The $2/$10 per million input/output token pricing for Claude Sonnet 5, announced at launch as introductory pricing through August 31, 2026, is now the standard price. The previously scheduled increase to $3/$15 per million input/output tokens on September 1, 2026 will not occur.
3944</Note>
from line 147
142147 
143148Prompt caching uses the following pricing multipliers relative to base input token rates:
144149 
145| Cache operation | Multiplier | Duration |
146| -------------------- | ------------------------------------------------------------------------ | ------------------------------------ |
147| 5-minute cache write | 1.25x base input price | Cache valid for 5 minutes |
148| 1-hour cache write | 2x base input price | Cache valid for 1 hour |
149| Cache read (hit) | 0.1x base input price (0.025x on Claude Fable 5.1 and Claude Mythos 5.1) | Same duration as the preceding write |
150| Cache operation | Multiplier | Duration |
151| -------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------ |
152| 5-minute cache write | 1.25x base input price | Cache valid for 5 minutes |
153| 1-hour cache write | 2x base input price | Cache valid for 1 hour |
154| Cache read (hit) | 0.1x base input price (0.025x on Claude Fable 5.1 and Claude Mythos 5.1; 0.05x on Claude Opus 5.5) | Same duration as the preceding write |
150155 
151Cache write tokens are charged when content is first stored. Cache read tokens are charged when a subsequent request retrieves the cached content. A cache hit costs 10% of the standard input price, which means caching pays off after one cache read for the 5-minute duration (1.25x write), or after two cache reads for the 1-hour duration (2x write). On Claude Fable 5.1 and Claude Mythos 5.1, a cache hit costs 2.5% of the standard input price ($0.25 USD per million tokens).
156Cache write tokens are charged when content is first stored. Cache read tokens are charged when a subsequent request retrieves the cached content. A cache hit costs 10% of the standard input price, which means caching pays off after one cache read for the 5-minute duration (1.25x write), or after two cache reads for the 1-hour duration (2x write). On Claude Fable 5.1 and Claude Mythos 5.1, a cache hit costs 2.5% of the standard input price ($0.25 USD per million tokens). On Claude Opus 5.5, a cache hit costs 5% of the standard input price ($0.20 USD per million tokens).
152157 
153158These multipliers stack with other pricing modifiers, including the Batch API discount and data residency.
154159 
from line 169
164169 
165170### Fast mode pricing
166171 
167[Fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode), in research preview, provides significantly faster output for Claude Opus 5 and Claude Opus 4.8 at premium pricing. Fast mode pricing applies across the full context window, including requests over 200k input tokens. Fast mode is available on the Claude API (first-party) only; it is not available on Claude Platform on AWS or partner-operated cloud platforms.
172[Fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode), in research preview, provides significantly faster output for Claude Opus 5.5, Claude Opus 5, and Claude Opus 4.8 at premium pricing. Fast mode pricing applies across the full context window, including requests over 200k input tokens. Fast mode is available on the Claude API (first-party) only; it is not available on Claude Platform on AWS or partner-operated cloud platforms.
168173 
169174| Model | Input | Output |
170175| ------------------------------- | ---------- | ---------- |
176| Claude Opus 5.5 | $8 / MTok | $40 / MTok |
171177| Claude Opus 5 / Claude Opus 4.8 | $10 / MTok | $50 / MTok |
172178 
173179Fast mode is not available on Claude Opus 4.7 (requests with `speed: "fast"` return an error) or Claude Opus 4.6 (requests run at standard speed and are billed at standard rates). See [Fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode#supported-models).
from line 197
191197| Claude Mythos 5.1 ([limited availability](https://anthropic.com/glasswing)) | $5 / MTok | $25 / MTok |
192198| Claude Fable 5 | $5 / MTok | $25 / MTok |
193199| Claude Mythos 5 ([limited availability](https://anthropic.com/glasswing)) | $5 / MTok | $25 / MTok |
200| Claude Opus 5.5 | $2 / MTok | $10 / MTok |
194201| Claude Opus 5 | $2.50 / MTok | $12.50 / MTok |
195202| Claude Opus 4.8 | $2.50 / MTok | $12.50 / MTok |
196203| Claude Opus 4.7 | $2.50 / MTok | $12.50 / MTok |
from line 238
231238 
232239| Model | Tool choice | Tool use system prompt token count |
233240| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ---------------------------------- |
241| Claude Opus 5.5 | `auto`, `none` | 286 tokens |
234242| Claude Opus 5 | `auto`, `none`***`any`, `tool` | 286 tokens***406 tokens |
235243| Claude Opus 4.8 | `auto`, `none`***`any`, `tool` | 290 tokens***410 tokens |
236244| Claude Opus 4.7 | `auto`, `none`***`any`, `tool` | 675 tokens***804 tokens |

agents-and-tools/agent-skills/claude-api-skill Changed · +7 / -7 lines

from line 26
2626* **Streaming patterns:** Implementation details for building chat UIs and handling incremental display
2727* **Batch processing:** Offline batch processing at 50% cost
2828* **Prompt caching:** Prefix-stability design, breakpoint placement, and silent-invalidator audit
29* **Model migration:** Step-by-step guidance for migrating to newer Claude models (including the breaking changes and behavior shifts on [Claude Opus 5](https://platform.claude.com/docs/en/models/opus-5/migration-guide#migrating-from-claude-opus-4-8-to-claude-opus-5) and [Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide))
29* **Model migration:** Step-by-step guidance for migrating to newer Claude models (including the breaking changes and behavior shifts on [Claude Opus 5.5](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#migrating-from-claude-opus-5) and [Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide))
3030* **Current model information:** Model IDs, context window sizes, and pricing
3131* **Common pitfalls:** Detailed guidance on avoiding frequent mistakes when integrating with the API
3232 
from line 102
102102The Claude API skill can perform Claude model migrations across a code base. Invoke it directly with `/claude-api migrate`:
103103 
104104```text wrap
105/claude-api migrate this project to claude-opus-5
105/claude-api migrate this project to claude-opus-5-5
106106```
107107 
108108You can also pass a specific scope up front to skip the scope-confirmation question:
109109 
110110```text wrap
111/claude-api migrate everything under src/ to claude-opus-5
112/claude-api migrate apps/api.py and apps/worker.py to claude-opus-5
111/claude-api migrate everything under src/ to claude-opus-5-5
112/claude-api migrate apps/api.py and apps/worker.py to claude-opus-5-5
113113```
114114 
115115When the scope is ambiguous (for example, a bare `/claude-api migrate to claude-opus-5`), the skill asks you to choose between the entire working directory, a specific subdirectory, or an explicit file list before editing any files. This applies to both Messages API and Managed Agents callers.
from line 124
124124* **Effort calibration**, recommending an `output_config.effort` starting point for the target model (for example, the default `high` on Claude Opus 5, and `xhigh` for coding and agentic use cases on Claude Opus 4.8 and Claude Opus 4.7)
125125* **Prompt-behavior tuning**, flagging length-control, tool-triggering, subagent, and instruction-following prompts that may behave differently on the target model
126126* **Silent default handling**, opting back into thinking summarization (`thinking.display: "summarized"`) when reasoning is surfaced to users on Claude Opus 4.8 and Claude Opus 4.7
127* **Refusal fallback configuration**, adding `stop_reason: "refusal"` handling before reading response content and setting up a [fallback retry path](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) when the target is Claude Fable 5.1, Claude Fable 5, or Claude Opus 5 (the server-side `fallbacks` parameter, typically in its `"default"` mode, the SDK refusal-fallback middleware, or a fallback-credit retry), and updating fallback code written against earlier preview shapes
127* **Refusal fallback configuration**, adding `stop_reason: "refusal"` handling before reading response content and setting up a [fallback retry path](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) when the target is Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, or Claude Opus 5 (the server-side `fallbacks` parameter, typically in its `"default"` mode, the SDK refusal-fallback middleware, or a fallback-credit retry), and updating fallback code written against earlier preview shapes
128128 
129129As it edits, the skill explains each change and its motivation inline. On completion, it produces a checklist of items that require manual verification (typically integration tests, length-control prompt tuning, and cost/rate-limit re-baselining).
130130 
131For the full list of model-specific changes the skill applies, see [Migrating to Claude Opus 5 from Claude Opus 4.8](https://platform.claude.com/docs/en/models/opus-5/migration-guide#migrating-from-claude-opus-4-8-to-claude-opus-5) and [Migrating to Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide).
131For the full list of model-specific changes the skill applies, see [Migrating to Claude Opus 5.5 from Claude Opus 5](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#migrating-from-claude-opus-5), [Migrating to Claude Opus 5 from Claude Opus 4.8](https://platform.claude.com/docs/en/models/opus-5/migration-guide#migrating-from-claude-opus-4-8-to-claude-opus-5), and [Migrating to Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/migration-guide).
132132 
133133## Setting up a Managed Agent
134134 
from line 155
155155**Migrating an existing project:**
156156 
157157```text wrap
158/claude-api migrate this codebase to claude-opus-5 and re-tune effort
158/claude-api migrate this codebase to claude-opus-5-5 and re-tune effort
159159```
160160 
161161**Onboarding a new Managed Agent:**

agents-and-tools/agent-skills/quickstart Changed · +36 / -36 lines

from line 131
131131 -H "anthropic-version: 2023-06-01" \
132132 -d @- <<'EOF'
133133 {
134 "model": "claude-opus-5",
134 "model": "claude-opus-5-5",
135135 "max_tokens": 16000,
136136 "container": {
137137 "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
from line 148
148148 ```bash CLI
149149 # Create a message with the PowerPoint Skill
150150 response=$(ant messages create --format json <<'YAML'
151 model: claude-opus-5
151 model: claude-opus-5-5
152152 max_tokens: 16000
153153 container:
154154 skills:
from line 168
168168 ```python Python
169169 # Create a message with the PowerPoint Skill
170170 response = client.messages.create(
171 model="claude-opus-5",
171 model="claude-opus-5-5",
172172 max_tokens=16000,
173173 container={
174174 "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
from line 188
188188 ```typescript TypeScript
189189 // Create a message with the PowerPoint Skill
190190 const response = await client.messages.create({
191 model: "claude-opus-5",
191 model: "claude-opus-5-5",
192192 max_tokens: 16000,
193193 container: {
194194 skills: [{ type: "anthropic", skill_id: "pptx", version: "latest" }],
from line 211
211211 // Create a message with the PowerPoint Skill
212212 var response = await client.Messages.Create(new MessageCreateParams
213213 {
214 Model = Model.ClaudeOpus5,
214 Model = Model.ClaudeOpus5_5,
215215 MaxTokens = 16000,
216216 Container = new ContainerParams
217217 {
from line 242
242242 ```go Go
243243 // Create a message with the PowerPoint Skill
244244 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
245 Model: anthropic.ModelClaudeOpus5,
245 Model: anthropic.ModelClaudeOpus5_5,
246246 MaxTokens: 16000,
247247 Container: anthropic.MessageCreateParamsContainerUnion{
248248 OfContainers: &anthropic.ContainerParams{
from line 275
275275 // Create a message with the PowerPoint Skill
276276 Message response = client.messages().create(
277277 MessageCreateParams.builder()
278 .model(Model.CLAUDE_OPUS_5)
278 .model(Model.CLAUDE_OPUS_5_5)
279279 .maxTokens(16000)
280280 .container(
281281 ContainerParams.builder()
from line 302
302302 ```php PHP
303303 // Create a message with the PowerPoint Skill
304304 $response = $client->messages->create(
305 model: 'claude-opus-5',
305 model: 'claude-opus-5-5',
306306 maxTokens: 16000,
307307 container: [
308308 'skills' => [['type' => 'anthropic', 'skillID' => 'pptx', 'version' => 'latest']],
from line 322
322322 ```ruby Ruby
323323 # Create a message with the PowerPoint Skill
324324 response = client.messages.create(
325 model: "claude-opus-5",
325 model: "claude-opus-5-5",
326326 max_tokens: 16_000,
327327 container: {
328328 skills: [{type: "anthropic", skill_id: "pptx", version: "latest"}]
from line 609
609609 -H "x-api-key: $ANTHROPIC_API_KEY" \
610610 -H "anthropic-version: 2023-06-01" \
611611 -d '{
612 "model": "claude-opus-5",
612 "model": "claude-opus-5-5",
613613 "max_tokens": 16000,
614614 "container": {
615615 "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]
from line 623
623623 
624624 ```bash CLI
625625 ant messages create <<'YAML'
626 model: claude-opus-5
626 model: claude-opus-5-5
627627 max_tokens: 16000
628628 container:
629629 skills:
from line 641
641641 
642642 ```python Python
643643 response = client.messages.create(
644 model="claude-opus-5",
644 model="claude-opus-5-5",
645645 max_tokens=16000,
646646 container={
647647 "skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]
from line 658
658658 
659659 ```typescript TypeScript
660660 const response = await client.messages.create({
661 model: "claude-opus-5",
661 model: "claude-opus-5-5",
662662 max_tokens: 16000,
663663 container: {
664664 skills: [{ type: "anthropic", skill_id: "xlsx", version: "latest" }]
from line 677
677677 var response = await client.Messages.Create(
678678 new MessageCreateParams
679679 {
680 Model = Model.ClaudeOpus5,
680 Model = Model.ClaudeOpus5_5,
681681 MaxTokens = 16000,
682682 Container = new ContainerParams
683683 {
from line 706
706706 
707707 ```go Go
708708 response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
709 Model: anthropic.ModelClaudeOpus5,
709 Model: anthropic.ModelClaudeOpus5_5,
710710 MaxTokens: 16000,
711711 Container: anthropic.MessageCreateParamsContainerUnion{
712712 OfContainers: &anthropic.ContainerParams{
from line 736
736736 ```java Java
737737 Message response = client.messages().create(
738738 MessageCreateParams.builder()
739 .model(CLAUDE_OPUS_5)
739 .model(CLAUDE_OPUS_5_5)
740740 .maxTokens(16000)
741741 .container(
742742 ContainerParams.builder()
from line 758
758758 
759759 ```php PHP
760760 $response = $client->messages->create(
761 model: 'claude-opus-5',
761 model: 'claude-opus-5-5',
762762 maxTokens: 16000,
763763 container: [
764764 'skills' => [
from line 777
777777 
778778 ```ruby Ruby
779779 response = client.messages.create(
780 model: "claude-opus-5",
780 model: "claude-opus-5-5",
781781 max_tokens: 16_000,
782782 container: {
783783 skills: [{type: "anthropic", skill_id: "xlsx", version: "latest"}]
from line 802
802802 -H "x-api-key: $ANTHROPIC_API_KEY" \
803803 -H "anthropic-version: 2023-06-01" \
804804 -d '{
805 "model": "claude-opus-5",
805 "model": "claude-opus-5-5",
806806 "max_tokens": 16000,
807807 "container": {
808808 "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]
from line 816
816816 
817817 ```bash CLI
818818 ant messages create <<'YAML'
819 model: claude-opus-5
819 model: claude-opus-5-5
820820 max_tokens: 16000
821821 container:
822822 skills:
from line 834
834834 
835835 ```python Python
836836 response = client.messages.create(
837 model="claude-opus-5",
837 model="claude-opus-5-5",
838838 max_tokens=16000,
839839 container={
840840 "skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]
from line 851
851851 
852852 ```typescript TypeScript
853853 const response = await client.messages.create({
854 model: "claude-opus-5",
854 model: "claude-opus-5-5",
855855 max_tokens: 16000,
856856 container: {
857857 skills: [{ type: "anthropic", skill_id: "docx", version: "latest" }]
from line 870
870870 var response = await client.Messages.Create(
871871 new MessageCreateParams
872872 {
873 Model = Model.ClaudeOpus5,
873 Model = Model.ClaudeOpus5_5,
874874 MaxTokens = 16000,
875875 Container = new ContainerParams
876876 {
from line 899
899899 
900900 ```go Go
901901 response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
902 Model: anthropic.ModelClaudeOpus5,
902 Model: anthropic.ModelClaudeOpus5_5,
903903 MaxTokens: 16000,
904904 Container: anthropic.MessageCreateParamsContainerUnion{
905905 OfContainers: &anthropic.ContainerParams{
from line 929
929929 ```java Java
930930 Message response = client.messages().create(
931931 MessageCreateParams.builder()
932 .model(CLAUDE_OPUS_5)
932 .model(CLAUDE_OPUS_5_5)
933933 .maxTokens(16000)
934934 .container(
935935 ContainerParams.builder()
from line 951
951951 
952952 ```php PHP
953953 $response = $client->messages->create(
954 model: 'claude-opus-5',
954 model: 'claude-opus-5-5',
955955 maxTokens: 16000,
956956 container: [
957957 'skills' => [
from line 970
970970 
971971 ```ruby Ruby
972972 response = client.messages.create(
973 model: "claude-opus-5",
973 model: "claude-opus-5-5",
974974 max_tokens: 16_000,
975975 container: {
976976 skills: [{type: "anthropic", skill_id: "docx", version: "latest"}]
from line 995
995995 -H "x-api-key: $ANTHROPIC_API_KEY" \
996996 -H "anthropic-version: 2023-06-01" \
997997 -d '{
998 "model": "claude-opus-5",
998 "model": "claude-opus-5-5",
999999 "max_tokens": 16000,
10001000 "container": {
10011001 "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]
from line 1009
10091009 
10101010 ```bash CLI
10111011 ant messages create <<'YAML'
1012 model: claude-opus-5
1012 model: claude-opus-5-5
10131013 max_tokens: 16000
10141014 container:
10151015 skills:
from line 1027
10271027 
10281028 ```python Python
10291029 response = client.messages.create(
1030 model="claude-opus-5",
1030 model="claude-opus-5-5",
10311031 max_tokens=16000,
10321032 container={
10331033 "skills": [{"type": "anthropic", "skill_id": "pdf", "version": "latest"}]
from line 1044
10441044 
10451045 ```typescript TypeScript
10461046 const response = await client.messages.create({
1047 model: "claude-opus-5",
1047 model: "claude-opus-5-5",
10481048 max_tokens: 16000,
10491049 container: {
10501050 skills: [{ type: "anthropic", skill_id: "pdf", version: "latest" }]
from line 1063
10631063 var response = await client.Messages.Create(
10641064 new MessageCreateParams
10651065 {
1066 Model = Model.ClaudeOpus5,
1066 Model = Model.ClaudeOpus5_5,
10671067 MaxTokens = 16000,
10681068 Container = new ContainerParams
10691069 {
from line 1092
10921092 
10931093 ```go Go
10941094 response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
1095 Model: anthropic.ModelClaudeOpus5,
1095 Model: anthropic.ModelClaudeOpus5_5,
10961096 MaxTokens: 16000,
10971097 Container: anthropic.MessageCreateParamsContainerUnion{
10981098 OfContainers: &anthropic.ContainerParams{
from line 1122
11221122 ```java Java
11231123 Message response = client.messages().create(
11241124 MessageCreateParams.builder()
1125 .model(CLAUDE_OPUS_5)
1125 .model(CLAUDE_OPUS_5_5)
11261126 .maxTokens(16000)
11271127 .container(
11281128 ContainerParams.builder()
from line 1144
11441144 
11451145 ```php PHP
11461146 $response = $client->messages->create(
1147 model: 'claude-opus-5',
1147 model: 'claude-opus-5-5',
11481148 maxTokens: 16000,
11491149 container: [
11501150 'skills' => [
from line 1163
11631163 
11641164 ```ruby Ruby
11651165 response = client.messages.create(
1166 model: "claude-opus-5",
1166 model: "claude-opus-5-5",
11671167 max_tokens: 16_000,
11681168 container: {
11691169 skills: [{type: "anthropic", skill_id: "pdf", version: "latest"}]

agents-and-tools/mcp-connector Changed · +609 / -40 lines

## Pin an MCP server's tool list (beta)

The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.

from line 61
6161 -H "anthropic-version: 2023-06-01" \
6262 -H "anthropic-beta: mcp-client-2025-11-20" \
6363 -d '{
64 "model": "claude-opus-5",
64 "model": "claude-opus-5-5",
6565 "max_tokens": 1000,
6666 "messages": [{"role": "user", "content": "What tools do you have available?"}],
6767 "mcp_servers": [
from line 83
8383 
8484 ```bash CLI
8585 ant beta:messages create --beta mcp-client-2025-11-20 <<'YAML'
86 model: claude-opus-5
86 model: claude-opus-5-5
8787 max_tokens: 1000
8888 messages:
8989 - role: user
from line 103
103103 client = anthropic.Anthropic()
104104 
105105 response = client.beta.messages.create(
106 model="claude-opus-5",
106 model="claude-opus-5-5",
107107 max_tokens=1000,
108108 messages=[{"role": "user", "content": "What tools do you have available?"}],
109109 mcp_servers=[
from line 125
125125 const anthropic = new Anthropic();
126126 
127127 const response = await anthropic.beta.messages.create({
128 model: "claude-opus-5",
128 model: "claude-opus-5-5",
129129 max_tokens: 1000,
130130 messages: [
131131 {
from line 158
158158 
159159 var parameters = new MessageCreateParams
160160 {
161 Model = Model.ClaudeOpus5,
161 Model = Model.ClaudeOpus5_5,
162162 MaxTokens = 1000,
163163 Messages = new List<BetaMessageParam>
164164 {
from line 188
188188 client := anthropic.NewClient()
189189 
190190 response, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{
191 Model: anthropic.ModelClaudeOpus5,
191 Model: anthropic.ModelClaudeOpus5_5,
192192 MaxTokens: 1000,
193193 Messages: []anthropic.BetaMessageParam{
194194 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("What tools do you have available?")),
from line 225
225225 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
226226 
227227 MessageCreateParams params = MessageCreateParams.builder()
228 .model(Model.CLAUDE_OPUS_5)
228 .model(Model.CLAUDE_OPUS_5_5)
229229 .maxTokens(1000L)
230230 .addUserMessage("What tools do you have available?")
231231 .addMcpServer(BetaRequestMcpServerUrlDefinition.builder()
from line 252
252252 messages: [
253253 ['role' => 'user', 'content' => 'What tools do you have available?']
254254 ],
255 model: 'claude-opus-5',
255 model: 'claude-opus-5-5',
256256 mcpServers: [
257257 [
258258 'type' => 'url',
from line 277
277277 client = Anthropic::Client.new
278278 
279279 response = client.beta.messages.create(
280 model: "claude-opus-5",
280 model: "claude-opus-5-5",
281281 max_tokens: 1000,
282282 messages: [
283283 { role: "user", content: "What tools do you have available?" }
from line 358
358358| `configs` | object | No | Per-tool configuration overrides. Keys are tool names, values are configuration objects. |
359359| `cache_control` | object | No | [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) cache breakpoint configuration for this toolset. |
360360 
361With the `mcp-client-2026-09-15` beta header, an MCPToolset also accepts `tools`, a pinned copy of the server's tool list. See [Pin an MCP server's tool list](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector#pin-mcp-tool-list).
362 
361363### Tool configuration options
362364 
363365Each tool (whether configured in `default_config` or in `configs`) supports the following fields:
from line 526
524526}
525527```
526528 
527## Multiple MCP servers
528 
529You can connect to multiple MCP servers by including multiple server definitions in `mcp_servers` and a corresponding MCPToolset for each in the `tools` array:
529## Pin an MCP server's tool list (beta)
530 
531An MCP server can change its tools at any time. The `mcp-client-2026-09-15` beta header records the tool list each server returns and lets you pin it, so a server that changes its tools doesn't change what Claude sees partway through a conversation. It includes everything `mcp-client-2025-11-20` does, so send it in place of that header. It's available on the Claude API.
532 
533When the API asks an MCP server for its tools while producing a response, the response starts with an `mcp_tool_listing` block for that server, one block for each server it asked:
530534 
531535```json
532536{
533 "model": "claude-opus-5",
537 "type": "mcp_tool_listing",
538 "mcp_server_name": "example-mcp",
539 "tools": [
540 {
541 "name": "echo",
542 "description": "Returns the text it receives.",
543 "input_schema": {
544 "type": "object",
545 "properties": { "text": { "type": "string" } },
546 "required": ["text"]
547 }
548 }
549 ]
550}
551```
552 
553If your code reads `content[0]`, skip these blocks. Send the assistant message back unchanged, `mcp_tool_listing` blocks included, and keep sending `mcp-client-2026-09-15` on every request that carries one. Later requests then use the recorded list for that server instead of asking it again.
554 
555To pin a list yourself, copy a block's `tools` into the `tools` field of that server's MCPToolset. The API then doesn't ask the server for its tools, and the toolset's tools are exactly those entries, with `default_config` and `configs` applied:
556 
557```json
558{
559 "type": "mcp_toolset",
560 "mcp_server_name": "example-mcp",
561 "tools": [
562 {
563 "name": "echo",
564 "description": "Returns the text it receives.",
565 "input_schema": {
566 "type": "object",
567 "properties": { "text": { "type": "string" } },
568 "required": ["text"]
569 }
570 }
571 ]
572}
573```
574 
575Each entry in `tools` holds the tool's `name` as the server lists it (without the server name), its `description`, and its `input_schema`.
576 
577The following example sends one request with an unpinned toolset, copies the returned list into the toolset's `tools` field, and sends the request again. The second response has no `mcp_tool_listing` block, because the API doesn't ask the server:
578 
579<CodeGroup>
580 ```bash cURL
581 BODY='{
582 "model": "claude-opus-5-5",
583 "max_tokens": 1024,
584 "mcp_servers": [
585 {
586 "type": "url",
587 "url": "https://example-server.modelcontextprotocol.io/sse",
588 "name": "example-mcp",
589 "authorization_token": "YOUR_TOKEN"
590 }
591 ],
592 "tools": [
593 {
594 "type": "mcp_toolset",
595 "mcp_server_name": "example-mcp"
596 }
597 ],
598 "messages": [
599 {
600 "role": "user",
601 "content": "What tools do you have available?"
602 }
603 ]
604 }'
605 
606 # First request: the toolset isn't pinned, so the API asks the server for
607 # its tools and the response starts with an mcp_tool_listing block.
608 # tee shows the response on stderr while the variable captures it.
609 FIRST=$(curl -sS https://api.anthropic.com/v1/messages \
610 -H "content-type: application/json" \
611 -H "x-api-key: $ANTHROPIC_API_KEY" \
612 -H "anthropic-version: 2023-06-01" \
613 -H "anthropic-beta: mcp-client-2026-09-15" \
614 -d "$BODY" | tee /dev/stderr)
615 
616 # Pin the list: copy the block's tools into the toolset. The API uses
617 # exactly these entries and doesn't ask the server again.
618 TOOLS=$(jq '.content[] | select(.type == "mcp_tool_listing") | .tools' \
619 <<<"$FIRST")
620 PINNED=$(jq --argjson tools "$TOOLS" '.tools[0].tools = $tools' <<<"$BODY")
621 
622 # With a pinned toolset, the response has no mcp_tool_listing block.
623 curl https://api.anthropic.com/v1/messages \
624 -H "content-type: application/json" \
625 -H "x-api-key: $ANTHROPIC_API_KEY" \
626 -H "anthropic-version: 2023-06-01" \
627 -H "anthropic-beta: mcp-client-2026-09-15" \
628 -d "$PINNED"
629 ```
630 
631 ```bash CLI
632 request=$(cat <<'YAML'
633 model: claude-opus-5-5
634 max_tokens: 1024
635 mcp_servers:
636 - type: url
637 url: https://example-server.modelcontextprotocol.io/sse
638 name: example-mcp
639 authorization_token: YOUR_TOKEN
640 tools:
641 - type: mcp_toolset
642 mcp_server_name: example-mcp
643 messages:
644 - role: user
645 content: What tools do you have available?
646 YAML
647 )
648 
649 # First request: the toolset isn't pinned, so the API asks the server for
650 # its tools and the response starts with an mcp_tool_listing block.
651 # tee shows the response on stderr while the variable captures it.
652 first=$(ant beta:messages create --beta mcp-client-2026-09-15 --format json \
653 <<<"$request" | tee /dev/stderr)
654 tools=$(jq -c '.content[] | select(.type == "mcp_tool_listing") | .tools' \
655 <<<"$first")
656 
657 # Pin the list: copy the block's tools into the toolset. The --tool flag
658 # replaces the body's tools array. The API uses exactly these entries and
659 # doesn't ask the server again, so the response has no mcp_tool_listing block.
660 ant beta:messages create --beta mcp-client-2026-09-15 \
661 --tool "{type: mcp_toolset, mcp_server_name: example-mcp, tools: $tools}" \
662 <<<"$request"
663 ```
664 
665 ```python Python
666 from anthropic.types.beta import (
667 BetaMessageParam,
668 BetaRequestMCPServerURLDefinitionParam,
669 )
670 
671 client = anthropic.Anthropic()
672 
673 mcp_servers: list[BetaRequestMCPServerURLDefinitionParam] = [
674 {
675 "type": "url",
676 "url": "https://example-server.modelcontextprotocol.io/sse",
677 "name": "example-mcp",
678 "authorization_token": "YOUR_TOKEN",
679 },
680 ]
681 messages: list[BetaMessageParam] = [
682 {"role": "user", "content": "What tools do you have available?"},
683 ]
684 
685 # First request: the toolset isn't pinned, so the API asks the server for
686 # its tools and the response starts with an mcp_tool_listing block.
687 first = client.beta.messages.create(
688 model="claude-opus-5-5",
689 max_tokens=1024,
690 betas=["mcp-client-2026-09-15"],
691 mcp_servers=mcp_servers,
692 tools=[{"type": "mcp_toolset", "mcp_server_name": "example-mcp"}],
693 messages=messages,
694 )
695 
696 listing = next(block for block in first.content if block.type == "mcp_tool_listing")
697 print([tool.name for tool in listing.tools])
698 
699 # Pin the list: copy the block's tools into the toolset. The API uses
700 # exactly these entries and doesn't ask the server again.
701 second = client.beta.messages.create(
702 model="claude-opus-5-5",
703 max_tokens=1024,
704 betas=["mcp-client-2026-09-15"],
705 mcp_servers=mcp_servers,
706 tools=[
707 {
708 "type": "mcp_toolset",
709 "mcp_server_name": "example-mcp",
710 "tools": [
711 {
712 "name": tool.name,
713 "description": tool.description,
714 "input_schema": tool.input_schema,
715 }
716 for tool in listing.tools
717 ],
718 },
719 ],
720 messages=messages,
721 )
722 
723 # With a pinned toolset, the response has no mcp_tool_listing block.
724 print([block.type for block in second.content])
725 ```
726 
727 ```typescript TypeScript
728 const client = new Anthropic();
729 
730 const mcpServers: Anthropic.Beta.BetaRequestMCPServerURLDefinition[] = [
731 {
732 type: "url",
733 url: "https://example-server.modelcontextprotocol.io/sse",
734 name: "example-mcp",
735 authorization_token: "YOUR_TOKEN"
736 }
737 ];
738 const messages: Anthropic.Beta.BetaMessageParam[] = [
739 { role: "user", content: "What tools do you have available?" }
740 ];
741 
742 // First request: the toolset isn't pinned, so the API asks the server for
743 // its tools and the response starts with an mcp_tool_listing block.
744 const first = await client.beta.messages.create({
745 model: "claude-opus-5-5",
746 max_tokens: 1024,
747 betas: ["mcp-client-2026-09-15"],
748 mcp_servers: mcpServers,
749 tools: [{ type: "mcp_toolset", mcp_server_name: "example-mcp" }],
750 messages
751 });
752 
753 const listing = first.content.find((block) => block.type === "mcp_tool_listing");
754 if (!listing) {
755 throw new Error("The response has no mcp_tool_listing block.");
756 }
757 console.log(listing.tools.map((tool) => tool.name));
758 
759 // Pin the list: copy the block's tools into the toolset. The API uses
760 // exactly these entries and doesn't ask the server again.
761 const second = await client.beta.messages.create({
762 model: "claude-opus-5-5",
763 max_tokens: 1024,
764 betas: ["mcp-client-2026-09-15"],
765 mcp_servers: mcpServers,
766 tools: [
767 {
768 type: "mcp_toolset",
769 mcp_server_name: "example-mcp",
770 tools: listing.tools
771 }
772 ],
773 messages
774 });
775 
776 // With a pinned toolset, the response has no mcp_tool_listing block.
777 console.log(second.content.map((block) => block.type));
778 ```
779 
780 ```csharp C#
781 using Anthropic.Models.Beta;
782 using Anthropic.Models.Beta.Messages;
783 using Messages = Anthropic.Models.Messages;
784 
785 AnthropicClient client = new();
786 
787 List<BetaRequestMcpServerUrlDefinition> mcpServers =
788 [
789 new()
790 {
791 Url = "https://example-server.modelcontextprotocol.io/sse",
792 Name = "example-mcp",
793 AuthorizationToken = "YOUR_TOKEN",
794 },
795 ];
796 List<BetaMessageParam> messages =
797 [
798 new() { Role = Role.User, Content = "What tools do you have available?" },
799 ];
800 
801 // First request: the toolset isn't pinned, so the API asks the server for
802 // its tools and the response starts with an mcp_tool_listing block.
803 var first = await client.Beta.Messages.Create(new MessageCreateParams
804 {
805 Model = Messages::Model.ClaudeOpus5_5,
806 MaxTokens = 1024,
807 Betas = [AnthropicBeta.McpClient2026_09_15],
808 McpServers = mcpServers,
809 Tools = [new BetaMcpToolset("example-mcp")],
810 Messages = messages,
811 });
812 
813 var listing = first.Content
814 .Select(block => block.Value)
815 .OfType<BetaMcpToolListingBlock>()
816 .First();
817 Console.WriteLine(string.Join(", ", listing.Tools.Select(tool => tool.Name)));
818 
819 // Pin the list: copy the block's tools into the toolset. The API uses
820 // exactly these entries and doesn't ask the server again.
821 var second = await client.Beta.Messages.Create(new MessageCreateParams
822 {
823 Model = Messages::Model.ClaudeOpus5_5,
824 MaxTokens = 1024,
825 Betas = [AnthropicBeta.McpClient2026_09_15],
826 McpServers = mcpServers,
827 Tools =
828 [
829 new BetaMcpToolset("example-mcp")
830 {
831 Tools =
832 [
833 .. listing.Tools.Select(tool => new BetaMcpToolParam
834 {
835 Name = tool.Name,
836 Description = tool.Description,
837 InputSchema = tool.InputSchema,
838 }),
839 ],
840 },
841 ],
842 Messages = messages,
843 });
844 
845 // With a pinned toolset, the response has no mcp_tool_listing block.
846 Console.WriteLine(string.Join(", ", second.Content.Select(block => block.Type)));
847 ```
848 
849 ```go Go
850 client := anthropic.NewClient()
851 
852 mcpServers := []anthropic.BetaRequestMCPServerURLDefinitionParam{
853 {
854 URL: "https://example-server.modelcontextprotocol.io/sse",
855 Name: "example-mcp",
856 AuthorizationToken: anthropic.String("YOUR_TOKEN"),
857 },
858 }
859 messages := []anthropic.BetaMessageParam{
860 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("What tools do you have available?")),
861 }
862 
863 // First request: the toolset isn't pinned, so the API asks the server for
864 // its tools and the response starts with an mcp_tool_listing block.
865 first, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{
866 Model: anthropic.ModelClaudeOpus5_5,
867 MaxTokens: 1024,
868 Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMCPClient2026_09_15},
869 MCPServers: mcpServers,
870 Tools: []anthropic.BetaToolUnionParam{
871 {OfMCPToolset: &anthropic.BetaMCPToolsetParam{MCPServerName: "example-mcp"}},
872 },
873 Messages: messages,
874 })
875 if err != nil {
876 log.Fatal(err)
877 }
878 
879 var listing anthropic.BetaMCPToolListingBlock
880 for _, block := range first.Content {
881 if listingBlock, ok := block.AsAny().(anthropic.BetaMCPToolListingBlock); ok {
882 listing = listingBlock
883 break
884 }
885 }
886 
887 // Pin the list: copy the block's tools into the toolset. The API uses
888 // exactly these entries and doesn't ask the server again.
889 var toolNames []string
890 var pinnedTools []anthropic.BetaMCPToolParam
891 for _, tool := range listing.Tools {
892 toolNames = append(toolNames, tool.Name)
893 pinnedTools = append(pinnedTools, anthropic.BetaMCPToolParam{
894 Name: tool.Name,
895 Description: anthropic.String(tool.Description),
896 InputSchema: tool.InputSchema,
897 })
898 }
899 fmt.Println(toolNames)
900 
901 second, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{
902 Model: anthropic.ModelClaudeOpus5_5,
903 MaxTokens: 1024,
904 Betas: []anthropic.AnthropicBeta{anthropic.AnthropicBetaMCPClient2026_09_15},
905 MCPServers: mcpServers,
906 Tools: []anthropic.BetaToolUnionParam{
907 {OfMCPToolset: &anthropic.BetaMCPToolsetParam{
908 MCPServerName: "example-mcp",
909 Tools: pinnedTools,
910 }},
911 },
912 Messages: messages,
913 })
914 if err != nil {
915 log.Fatal(err)
916 }
917 
918 // With a pinned toolset, the response has no mcp_tool_listing block.
919 var blockTypes []string
920 for _, block := range second.Content {
921 blockTypes = append(blockTypes, block.Type)
922 }
923 fmt.Println(blockTypes)
924 ```
925 
926 ```java Java
927 import com.anthropic.models.beta.AnthropicBeta;
928 import com.anthropic.models.beta.messages.BetaMcpTool;
929 import com.anthropic.models.beta.messages.BetaMcpToolListingBlock;
930 import com.anthropic.models.beta.messages.BetaMcpToolset;
931 import com.anthropic.models.beta.messages.BetaMessage;
932 import com.anthropic.models.beta.messages.BetaRequestMcpServerUrlDefinition;
933 import com.anthropic.models.beta.messages.MessageCreateParams;
934 // ...
935 
936 void main() {
937 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
938 
939 BetaRequestMcpServerUrlDefinition mcpServer = BetaRequestMcpServerUrlDefinition.builder()
940 .url("https://example-server.modelcontextprotocol.io/sse")
941 .name("example-mcp")
942 .authorizationToken("YOUR_TOKEN")
943 .build();
944 
945 // First request: the toolset isn't pinned, so the API asks the server for
946 // its tools and the response starts with an mcp_tool_listing block.
947 BetaMessage first = client.beta().messages().create(MessageCreateParams.builder()
948 .model(Model.CLAUDE_OPUS_5_5)
949 .maxTokens(1024)
950 .addBeta(AnthropicBeta.MCP_CLIENT_2026_09_15)
951 .addMcpServer(mcpServer)
952 .addTool(BetaMcpToolset.builder()
953 .mcpServerName("example-mcp")
954 .build())
955 .addUserMessage("What tools do you have available?")
956 .build());
957 
958 BetaMcpToolListingBlock listing = first.content().stream()
959 .flatMap(block -> block.mcpToolListing().stream())
960 .findFirst()
961 .orElseThrow();
962 IO.println(listing.tools().stream().map(BetaMcpTool::name).toList());
963 
964 // Pin the list: copy the block's tools into the toolset. The API uses
965 // exactly these entries and doesn't ask the server again.
966 BetaMessage second = client.beta().messages().create(MessageCreateParams.builder()
967 .model(Model.CLAUDE_OPUS_5_5)
968 .maxTokens(1024)
969 .addBeta(AnthropicBeta.MCP_CLIENT_2026_09_15)
970 .addMcpServer(mcpServer)
971 .addTool(BetaMcpToolset.builder()
972 .mcpServerName("example-mcp")
973 .tools(listing.tools().stream().map(BetaMcpTool::toParam).toList())
974 .build())
975 .addUserMessage("What tools do you have available?")
976 .build());
977 
978 // With a pinned toolset, the response has no mcp_tool_listing block.
979 IO.println(second.content().stream()
980 .map(block -> block.type().asString())
981 .toList());
982 }
983 ```
984 
985 ```php PHP
986 use Anthropic\Beta\AnthropicBeta;
987 use Anthropic\Beta\Messages\BetaMCPTool;
988 use Anthropic\Beta\Messages\BetaMCPToolListingBlock;
989 // ...
990 
991 $client = new Client();
992 
993 $mcpServers = [
994 [
995 'type' => 'url',
996 'url' => 'https://example-server.modelcontextprotocol.io/sse',
997 'name' => 'example-mcp',
998 'authorization_token' => 'YOUR_TOKEN',
999 ],
1000 ];
1001 $messages = [['role' => 'user', 'content' => 'What tools do you have available?']];
1002 
1003 // First request: the toolset isn't pinned, so the API asks the server for
1004 // its tools and the response starts with an mcp_tool_listing block.
1005 $first = $client->beta->messages->create(
1006 model: Model::CLAUDE_OPUS_5_5,
1007 maxTokens: 1024,
1008 betas: [AnthropicBeta::MCP_CLIENT_2026_09_15],
1009 mcpServers: $mcpServers,
1010 tools: [['type' => 'mcp_toolset', 'mcp_server_name' => 'example-mcp']],
1011 messages: $messages,
1012 );
1013 
1014 $listing = array_find($first->content, fn ($block) => $block instanceof BetaMCPToolListingBlock);
1015 echo json_encode(array_map(fn (BetaMCPTool $tool) => $tool->name, $listing->tools)), PHP_EOL;
1016 
1017 // Pin the list: copy the block's tools into the toolset. The API uses
1018 // exactly these entries and doesn't ask the server again.
1019 $second = $client->beta->messages->create(
1020 model: Model::CLAUDE_OPUS_5_5,
1021 maxTokens: 1024,
1022 betas: [AnthropicBeta::MCP_CLIENT_2026_09_15],
1023 mcpServers: $mcpServers,
1024 tools: [
1025 [
1026 'type' => 'mcp_toolset',
1027 'mcp_server_name' => 'example-mcp',
1028 'tools' => array_map(
1029 fn (BetaMCPTool $tool) => [
1030 'name' => $tool->name,
1031 'description' => $tool->description,
1032 'input_schema' => $tool->inputSchema,
1033 ],
1034 $listing->tools,
1035 ),
1036 ],
1037 ],
1038 messages: $messages,
1039 );
1040 
1041 // With a pinned toolset, the response has no mcp_tool_listing block.
1042 echo json_encode(array_map(fn ($block) => $block->type, $second->content)), PHP_EOL;
1043 ```
1044 
1045 ```ruby Ruby
1046 client = Anthropic::Client.new
1047 
1048 mcp_servers = [
1049 {
1050 type: "url",
1051 url: "https://example-server.modelcontextprotocol.io/sse",
1052 name: "example-mcp",
1053 authorization_token: "YOUR_TOKEN"
1054 }
1055 ]
1056 messages = [{ role: "user", content: "What tools do you have available?" }]
1057 
1058 # First request: the toolset isn't pinned, so the API asks the server for
1059 # its tools and the response starts with an mcp_tool_listing block.
1060 first = client.beta.messages.create(
1061 model: Anthropic::Model::CLAUDE_OPUS_5_5,
1062 max_tokens: 1024,
1063 betas: [Anthropic::AnthropicBeta::MCP_CLIENT_2026_09_15],
1064 mcp_servers:,
1065 tools: [{ type: "mcp_toolset", mcp_server_name: "example-mcp" }],
1066 messages:
1067 )
1068 
1069 listing = first.content.find { it.is_a?(Anthropic::Beta::BetaMCPToolListingBlock) }
1070 puts listing.tools.map(&:name).inspect
1071 
1072 # Pin the list: copy the block's tools into the toolset. The API uses
1073 # exactly these entries and doesn't ask the server again.
1074 second = client.beta.messages.create(
1075 model: Anthropic::Model::CLAUDE_OPUS_5_5,
1076 max_tokens: 1024,
1077 betas: [Anthropic::AnthropicBeta::MCP_CLIENT_2026_09_15],
1078 mcp_servers:,
1079 tools: [
1080 {
1081 type: "mcp_toolset",
1082 mcp_server_name: "example-mcp",
1083 tools: listing.tools.map(&:to_h)
1084 }
1085 ],
1086 messages:
1087 )
1088 
1089 # With a pinned toolset, the response has no mcp_tool_listing block.
1090 puts second.content.map(&:type).inspect
1091 ```
1092</CodeGroup>
1093 
1094With the `inline-tools-2026-09-15` beta header as well, you can add an MCP server partway through a conversation. See [Add an MCP server mid-conversation](https://platform.claude.com/docs/en/build-with-claude/mid-conversation-system-messages#add-an-mcp-server-mid-conversation-beta).
1095 
1096## Multiple MCP servers
1097 
1098You can connect to multiple MCP servers by including multiple server definitions in `mcp_servers` and a corresponding MCPToolset for each in the `tools` array:
1099 
1100```json
1101{
1102 "model": "claude-opus-5-5",
5341103 "max_tokens": 1000,
5351104 "messages": [
5361105 {
from line 1236
6671236 <Tabs>
6681237 <Tab title="Gradle">
6691238 ```kotlin
670 implementation("com.anthropic:anthropic-java:2.63.0")
671 implementation("com.anthropic:anthropic-java-mcp:2.63.0")
1239 implementation("com.anthropic:anthropic-java:2.65.0")
1240 implementation("com.anthropic:anthropic-java-mcp:2.65.0")
6721241 ```
6731242 </Tab>
6741243 
from line 1246
6771246 <dependency>
6781247 <groupId>com.anthropic</groupId>
6791248 <artifactId>anthropic-java</artifactId>
680 <version>2.63.0</version>
1249 <version>2.65.0</version>
6811250 </dependency>
6821251 <dependency>
6831252 <groupId>com.anthropic</groupId>
6841253 <artifactId>anthropic-java-mcp</artifactId>
685 <version>2.63.0</version>
1254 <version>2.65.0</version>
6861255 </dependency>
6871256 ```
6881257 </Tab>
from line 1358
7891358 # List tools and convert them for the Claude API
7901359 tools_result = await mcp_client.list_tools()
7911360 runner = client.beta.messages.tool_runner(
792 model="claude-opus-5",
1361 model="claude-opus-5-5",
7931362 max_tokens=1024,
7941363 messages=[
7951364 {"role": "user", "content": "What tools do you have available?"},
from line 1399
8301399 };
8311400 
8321401 const finalMessage = await anthropic.beta.messages.toolRunner({
833 model: "claude-opus-5",
1402 model: "claude-opus-5-5",
8341403 max_tokens: 1024,
8351404 messages: [{ role: "user", content: "What tools do you have available?" }],
8361405 tools: mcpTools(tools, mcpClientForTools)
from line 1427
8581427 var runner = anthropic.Beta.Messages.ToolRunner(
8591428 new MessageCreateParams
8601429 {
861 Model = Messages::Model.ClaudeOpus5,
1430 Model = Messages::Model.ClaudeOpus5_5,
8621431 MaxTokens = 1024,
8631432 Messages =
8641433 [
from line 1478
9091478 
9101479 runner := client.Beta.Messages.NewToolRunner(betaTools, anthropic.BetaToolRunnerParams{
9111480 BetaMessageNewParams: anthropic.BetaMessageNewParams{
912 Model: anthropic.ModelClaudeOpus5,
1481 Model: anthropic.ModelClaudeOpus5_5,
9131482 MaxTokens: 1024,
9141483 Messages: []anthropic.BetaMessageParam{
9151484 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("What tools do you have available?")),
from line 1527
9581527 List<McpBetaTool> betaTools = BetaMcp.mcpTools(mcpClient.listTools().tools(), mcpClient);
9591528 
9601529 MessageCreateParams params = MessageCreateParams.builder()
961 .model(Model.CLAUDE_OPUS_5)
1530 .model(Model.CLAUDE_OPUS_5_5)
9621531 .maxTokens(1024L)
9631532 .addUserMessage("What tools do you have available?")
9641533 .addTools(betaTools)
from line 1560
9911560 $runner = $anthropic->beta->messages->toolRunner(
9921561 maxTokens: 1024,
9931562 messages: [['role' => 'user', 'content' => 'What tools do you have available?']],
994 model: 'claude-opus-5',
1563 model: 'claude-opus-5-5',
9951564 tools: BetaMcp::tools($mcp->listTools()->tools, $mcp),
9961565 );
9971566 
from line 1579
10101579 
10111580 # List tools and convert them for the Claude API
10121581 runner = anthropic.beta.messages.tool_runner(
1013 model: "claude-opus-5",
1582 model: "claude-opus-5-5",
10141583 max_tokens: 1024,
10151584 messages: [{ role: "user", content: "What tools do you have available?" }],
10161585 tools: Anthropic::Mcp.tools(mcp_client.tools, mcp_client)
from line 1600
10311600 
10321601 prompt = await mcp_client.get_prompt(name="my-prompt")
10331602 response = await client.beta.messages.create(
1034 model="claude-opus-5",
1603 model="claude-opus-5-5",
10351604 max_tokens=1024,
10361605 messages=[mcp_message(message) for message in prompt.messages],
10371606 )
from line 1613
10441613 
10451614 const { messages } = await mcpClient.getPrompt({ name: "my-prompt" });
10461615 const response = await anthropic.beta.messages.create({
1047 model: "claude-opus-5",
1616 model: "claude-opus-5-5",
10481617 max_tokens: 1024,
10491618 messages: mcpMessages(messages)
10501619 });
from line 1626
10571626 var response = await anthropic.Beta.Messages.Create(
10581627 new MessageCreateParams
10591628 {
1060 Model = Messages::Model.ClaudeOpus5,
1629 Model = Messages::Model.ClaudeOpus5_5,
10611630 MaxTokens = 1024,
10621631 Messages = BetaMcp.Messages(prompt.Messages),
10631632 }
from line 1651
10821651 }
10831652 
10841653 response, err := client.Beta.Messages.New(ctx, anthropic.BetaMessageNewParams{
1085 Model: anthropic.ModelClaudeOpus5,
1654 Model: anthropic.ModelClaudeOpus5_5,
10861655 MaxTokens: 1024,
10871656 Messages: messages,
10881657 })
from line 1666
10971666 new McpSchema.GetPromptRequest("my-prompt", Map.of()));
10981667 
10991668 BetaMessage response = anthropic.beta().messages().create(MessageCreateParams.builder()
1100 .model(Model.CLAUDE_OPUS_5)
1669 .model(Model.CLAUDE_OPUS_5_5)
11011670 .maxTokens(1024L)
11021671 .messages(BetaMcp.mcpMessages(prompt.messages()))
11031672 .build());
from line 1680
11111680 $response = $anthropic->beta->messages->create(
11121681 maxTokens: 1024,
11131682 messages: array_map(BetaMcp::message(...), $prompt->messages),
1114 model: 'claude-opus-5',
1683 model: 'claude-opus-5-5',
11151684 );
11161685 
11171686 echo $response, "\n";
from line 1690
11211690 prompt = mcp_client.get_prompt(name: "my-prompt")
11221691 
11231692 response = anthropic.beta.messages.create(
1124 model: "claude-opus-5",
1693 model: "claude-opus-5-5",
11251694 max_tokens: 1024,
11261695 messages: prompt["messages"].map { |message| Anthropic::Mcp.message(message) }
11271696 )
from line 1713
11441713 # As a content block in a message
11451714 resource = await mcp_client.read_resource(uri="file:///path/to/doc.txt")
11461715 response = await client.beta.messages.create(
1147 model="claude-opus-5",
1716 model="claude-opus-5-5",
11481717 max_tokens=1024,
11491718 messages=[
11501719 {
from line 1743
11741743 // As a content block in a message
11751744 const resource = await mcpClient.readResource({ uri: "file:///path/to/doc.txt" });
11761745 const response = await anthropic.beta.messages.create({
1177 model: "claude-opus-5",
1746 model: "claude-opus-5-5",
11781747 max_tokens: 1024,
11791748 messages: [
11801749 {
from line 1769
12001769 var response = await anthropic.Beta.Messages.Create(
12011770 new MessageCreateParams
12021771 {
1203 Model = Messages::Model.ClaudeOpus5,
1772 Model = Messages::Model.ClaudeOpus5_5,
12041773 MaxTokens = 1024,
12051774 Messages =
12061775 [
from line 1817
12481817 }
12491818 
12501819 response, err := client.Beta.Messages.New(ctx, anthropic.BetaMessageNewParams{
1251 Model: anthropic.ModelClaudeOpus5,
1820 Model: anthropic.ModelClaudeOpus5_5,
12521821 MaxTokens: 1024,
12531822 Messages: []anthropic.BetaMessageParam{
12541823 anthropic.NewBetaUserMessage(
from line 1865
12961865 BetaTextBlockParam.builder().text("Summarize this document").build()));
12971866 
12981867 BetaMessage response = anthropic.beta().messages().create(MessageCreateParams.builder()
1299 .model(Model.CLAUDE_OPUS_5)
1868 .model(Model.CLAUDE_OPUS_5_5)
13001869 .maxTokens(1024L)
13011870 .addUserMessageOfBetaContentBlockParams(content)
13021871 .build());
from line 1909
13401909 ],
13411910 ],
13421911 ],
1343 model: 'claude-opus-5',
1912 model: 'claude-opus-5-5',
13441913 );
13451914 
13461915 echo $response, "\n";
from line 1925
13561925 resource = mcp_client.read_resource(uri: "file:///path/to/doc.txt")
13571926 
13581927 response = anthropic.beta.messages.create(
1359 model: "claude-opus-5",
1928 model: "claude-opus-5-5",
13601929 max_tokens: 1024,
13611930 messages: [
13621931 {
from line 1978
14091978 
14101979```json
14111980{
1412 "model": "claude-opus-5",
1981 "model": "claude-opus-5-5",
14131982 "max_tokens": 1000,
14141983 "messages": [
14151984 // ...
from line 2002
14332002 
14342003```json
14352004{
1436 "model": "claude-opus-5",
2005 "model": "claude-opus-5-5",
14372006 "max_tokens": 1000,
14382007 "messages": [
14392008 // ...
14402009 

agents-and-tools/mcp-tunnels/overview Changed · +9 / -9 lines

from line 147
147147 -H "anthropic-version: 2023-06-01" \
148148 -H "anthropic-beta: mcp-client-2025-11-20" \
149149 -d '{
150 "model": "claude-opus-5",
150 "model": "claude-opus-5-5",
151151 "max_tokens": 1000,
152152 "messages": [{"role": "user", "content": "Use the hello tool to greet tunnel."}],
153153 "mcp_servers": [
from line 163
163163 
164164 ```bash CLI
165165 ant beta:messages create --beta mcp-client-2025-11-20 <<'YAML'
166 model: claude-opus-5
166 model: claude-opus-5-5
167167 max_tokens: 1000
168168 messages:
169169 - role: user
from line 182
182182 client = anthropic.Anthropic()
183183 
184184 response = client.beta.messages.create(
185 model="claude-opus-5",
185 model="claude-opus-5-5",
186186 max_tokens=1000,
187187 messages=[{"role": "user", "content": "Use the hello tool to greet tunnel."}],
188188 mcp_servers=[
from line 203
203203 const anthropic = new Anthropic();
204204 
205205 const response = await anthropic.beta.messages.create({
206 model: "claude-opus-5",
206 model: "claude-opus-5-5",
207207 max_tokens: 1000,
208208 messages: [
209209 {
from line 235
235235 
236236 var parameters = new MessageCreateParams
237237 {
238 Model = Messages::Model.ClaudeOpus5,
238 Model = Messages::Model.ClaudeOpus5_5,
239239 MaxTokens = 1000,
240240 Messages = new List<BetaMessageParam>
241241 {
from line 264
264264 client := anthropic.NewClient()
265265 
266266 response, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{
267 Model: anthropic.ModelClaudeOpus5,
267 Model: anthropic.ModelClaudeOpus5_5,
268268 MaxTokens: 1000,
269269 Messages: []anthropic.BetaMessageParam{
270270 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("Use the hello tool to greet tunnel.")),
from line 300
300300 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
301301 
302302 MessageCreateParams params = MessageCreateParams.builder()
303 .model(Model.CLAUDE_OPUS_5)
303 .model(Model.CLAUDE_OPUS_5_5)
304304 .maxTokens(1000L)
305305 .addUserMessage("Use the hello tool to greet tunnel.")
306306 .addMcpServer(BetaRequestMcpServerUrlDefinition.builder()
from line 326
326326 messages: [
327327 ['role' => 'user', 'content' => 'Use the hello tool to greet tunnel.']
328328 ],
329 model: 'claude-opus-5',
329 model: 'claude-opus-5-5',
330330 mcpServers: [
331331 [
332332 'type' => 'url',
from line 350
350350 client = Anthropic::Client.new
351351 
352352 response = client.beta.messages.create(
353 model: "claude-opus-5",
353 model: "claude-opus-5-5",
354354 max_tokens: 1000,
355355 messages: [
356356 { role: "user", content: "Use the hello tool to greet tunnel." }

agents-and-tools/tool-use/bash-tool Changed · +19 / -19 lines

from line 30
3030 -H "x-api-key: $ANTHROPIC_API_KEY" \
3131 -H "anthropic-version: 2023-06-01" \
3232 -d '{
33 "model": "claude-opus-5",
33 "model": "claude-opus-5-5",
3434 "max_tokens": 1024,
3535 "tools": [
3636 {
from line 49
4949 
5050 ```bash CLI
5151 ant messages create \
52 --model claude-opus-5 \
52 --model claude-opus-5-5 \
5353 --max-tokens 1024 \
5454 --tool '{type: bash_20250124, name: bash}' \
5555 --message '{role: user, content: List all Python files in the current directory.}'
from line 59
5959 client = anthropic.Anthropic()
6060 
6161 response = client.messages.create(
62 model="claude-opus-5",
62 model="claude-opus-5-5",
6363 max_tokens=1024,
6464 tools=[{"type": "bash_20250124", "name": "bash"}],
6565 messages=[
from line 74
7474 const client = new Anthropic();
7575 
7676 const response = await client.messages.create({
77 model: "claude-opus-5",
77 model: "claude-opus-5-5",
7878 max_tokens: 1024,
7979 tools: [{ type: "bash_20250124", name: "bash" }],
8080 messages: [
from line 94
9494 var response = await client.Messages.Create(
9595 new()
9696 {
97 Model = Model.ClaudeOpus5,
97 Model = Model.ClaudeOpus5_5,
9898 MaxTokens = 1024,
9999 Tools = [new ToolBash20250124()],
100100 Messages =
from line 115
115115 client := anthropic.NewClient()
116116 
117117 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
118 Model: anthropic.ModelClaudeOpus5,
118 Model: anthropic.ModelClaudeOpus5_5,
119119 MaxTokens: 1024,
120120 Tools: []anthropic.ToolUnionParam{
121121 {OfBashTool20250124: &anthropic.ToolBash20250124Param{}},
from line 138
138138 
139139 Message response = client.messages().create(
140140 MessageCreateParams.builder()
141 .model(Model.CLAUDE_OPUS_5)
141 .model(Model.CLAUDE_OPUS_5_5)
142142 .maxTokens(1024)
143143 .addTool(ToolBash20250124.builder().build())
144144 .addUserMessage("List all Python files in the current directory.")
from line 155
155155 $client = new Client();
156156 
157157 $response = $client->messages->create(
158 model: 'claude-opus-5',
158 model: 'claude-opus-5-5',
159159 maxTokens: 1024,
160160 tools: [new ToolBash20250124()],
161161 messages: [
from line 170
170170 client = Anthropic::Client.new
171171 
172172 response = client.messages.create(
173 model: "claude-opus-5",
173 model: "claude-opus-5-5",
174174 max_tokens: 1024,
175175 tools: [{type: "bash_20250124", name: "bash"}],
176176 messages: [
from line 187
187187```json Output
188188{
189189 "id": "msg_01XAbCDeFgHiJkLmNoPQrStU",
190 "model": "claude-opus-5",
190 "model": "claude-opus-5-5",
191191 "stop_reason": "tool_use",
192192 "role": "assistant",
193193 "content": [
from line 841
841841 -H "x-api-key: $ANTHROPIC_API_KEY" \
842842 -H "anthropic-version: 2023-06-01" \
843843 -d '{
844 "model": "claude-opus-5",
844 "model": "claude-opus-5-5",
845845 "max_tokens": 1024,
846846 "tools": [
847847 {
from line 883
883883 
884884 ```bash CLI
885885 ant messages create <<'YAML'
886 model: claude-opus-5
886 model: claude-opus-5-5
887887 max_tokens: 1024
888888 tools:
889889 - type: bash_20250124
from line 912
912912 client = anthropic.Anthropic()
913913 
914914 response = client.messages.create(
915 model="claude-opus-5",
915 model="claude-opus-5-5",
916916 max_tokens=1024,
917917 tools=[{"type": "bash_20250124", "name": "bash"}],
918918 messages=[
from line 948
948948 const client = new Anthropic();
949949 
950950 const response = await client.messages.create({
951 model: "claude-opus-5",
951 model: "claude-opus-5-5",
952952 max_tokens: 1024,
953953 tools: [{ type: "bash_20250124", name: "bash" }],
954954 messages: [
from line 989
989989 var response = await client.Messages.Create(
990990 new()
991991 {
992 Model = Model.ClaudeOpus5,
992 Model = Model.ClaudeOpus5_5,
993993 MaxTokens = 1024,
994994 Tools = [new ToolBash20250124()],
995995 Messages =
from line 1038
10381038 client := anthropic.NewClient()
10391039 
10401040 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
1041 Model: anthropic.ModelClaudeOpus5,
1041 Model: anthropic.ModelClaudeOpus5_5,
10421042 MaxTokens: 1024,
10431043 Tools: []anthropic.ToolUnionParam{
10441044 {OfBashTool20250124: &anthropic.ToolBash20250124Param{}},
from line 1079
10791079 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
10801080 
10811081 MessageCreateParams params = MessageCreateParams.builder()
1082 .model(Model.CLAUDE_OPUS_5)
1082 .model(Model.CLAUDE_OPUS_5_5)
10831083 .maxTokens(1024)
10841084 .addTool(ToolBash20250124.builder().build())
10851085 .addUserMessage("List all Python files in the current directory.")
from line 1121
11211121 $client = new Client();
11221122 
11231123 $response = $client->messages->create(
1124 model: 'claude-opus-5',
1124 model: 'claude-opus-5-5',
11251125 maxTokens: 1024,
11261126 tools: [new ToolBash20250124()],
11271127 messages: [
from line 1157
11571157 client = Anthropic::Client.new
11581158 
11591159 response = client.messages.create(
1160 model: "claude-opus-5",
1160 model: "claude-opus-5-5",
11611161 max_tokens: 1024,
11621162 tools: [{type: "bash_20250124", name: "bash"}],
11631163 messages: [

agents-and-tools/tool-use/browser-use-tool Changed · +11 / -10 lines

from line 12
1212 - claude-mythos-5-1
1313 - claude-fable-5
1414 - claude-mythos-5
15 - claude-opus-5-5
1516 - claude-opus-5
1617 - claude-sonnet-5
1718 - claude-opus-4-8
from line 43
4243 -H "x-api-key: $ANTHROPIC_API_KEY" \
4344 -H "anthropic-version: 2023-06-01" \
4445 -d '{
45 "model": "claude-opus-5",
46 "model": "claude-opus-5-5",
4647 "max_tokens": 2048,
4748 "tools": [
4849 {
from line 61
6061 
6162 ```bash CLI
6263 ant messages create <<'YAML'
63 model: claude-opus-5
64 model: claude-opus-5-5
6465 max_tokens: 2048
6566 tools:
6667 - type: browser_toolset_20260801
from line 75
7475 client = anthropic.Anthropic()
7576 
7677 response = client.messages.create(
77 model="claude-opus-5",
78 model="claude-opus-5-5",
7879 max_tokens=2048,
7980 tools=[{"type": "browser_toolset_20260801"}],
8081 messages=[
from line 92
9192 const client = new Anthropic();
9293 
9394 const response = await client.messages.create({
94 model: "claude-opus-5",
95 model: "claude-opus-5-5",
9596 max_tokens: 2048,
9697 tools: [{ type: "browser_toolset_20260801" }],
9798 messages: [
from line 111
110111 
111112 var parameters = new MessageCreateParams
112113 {
113 Model = Model.ClaudeOpus5,
114 Model = Model.ClaudeOpus5_5,
114115 MaxTokens = 2048,
115116 Tools = [new BrowserToolset20260801()],
116117 Messages =
from line 132
131132 client := anthropic.NewClient()
132133 
133134 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
134 Model: anthropic.ModelClaudeOpus5,
135 Model: anthropic.ModelClaudeOpus5_5,
135136 MaxTokens: 2048,
136137 Tools: []anthropic.ToolUnionParam{
137138 {OfBrowserToolset20260801: &anthropic.BrowserToolset20260801Param{}},
from line 155
154155 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
155156 
156157 MessageCreateParams params = MessageCreateParams.builder()
157 .model(Model.CLAUDE_OPUS_5)
158 .model(Model.CLAUDE_OPUS_5_5)
158159 .maxTokens(2048L)
159160 .addTool(BrowserToolset20260801.builder().build())
160161 .addUserMessage("Open example.com/docs and tell me how to get started.")
from line 174
173174 messages: [
174175 ['role' => 'user', 'content' => 'Open example.com/docs and tell me how to get started.'],
175176 ],
176 model: 'claude-opus-5',
177 model: 'claude-opus-5-5',
177178 tools: [
178179 ['type' => 'browser_toolset_20260801'],
179180 ],
from line 187
186187 client = Anthropic::Client.new
187188 
188189 response = client.messages.create(
189 model: "claude-opus-5",
190 model: "claude-opus-5-5",
190191 max_tokens: 2048,
191192 tools: [
192193 { type: "browser_toolset_20260801" }
from line 211
210211 "id": "msg_01HCDu4XSTLzTAcodEQ58vDo",
211212 "type": "message",
212213 "role": "assistant",
213 "model": "claude-opus-5",
214 "model": "claude-opus-5-5",
214215 "content": [
215216 {
216217 "type": "text",

agents-and-tools/tool-use/build-a-tool-using-agent Changed · +74 / -74 lines

from line 67
6767 --argjson tools "$TOOLS" \
6868 --arg msg "$USER_MSG" \
6969 '{
70 model: "claude-opus-5",
70 model: "claude-opus-5-5",
7171 max_tokens: 1024,
7272 tools: $tools,
7373 tool_choice: {type: "auto", disable_parallel_tool_use: true},
from line 104
104104 --arg tool_use_id "$TOOL_USE_ID" \
105105 --arg result "$RESULT" \
106106 '{
107 model: "claude-opus-5",
107 model: "claude-opus-5-5",
108108 max_tokens: 1024,
109109 tools: $tools,
110110 tool_choice: {type: "auto", disable_parallel_tool_use: true},
from line 144
144144 # JSON, which YAML accepts as flow syntax.
145145 {
146146 cat <<'YAML'
147 model: claude-opus-5
147 model: claude-opus-5-5
148148 max_tokens: 1024
149149 tool_choice: {type: auto, disable_parallel_tool_use: true}
150150 tools:
from line 255
255255 # Send the user's request along with the tool definition. Claude decides
256256 # whether to call the tool based on the request and the tool description.
257257 response = client.messages.create(
258 model="claude-opus-5",
258 model="claude-opus-5-5",
259259 max_tokens=1024,
260260 tools=tools,
261261 tool_choice={"type": "auto", "disable_parallel_tool_use": True},
from line 285
285285 # its tool_use_id must match the id from the tool_use block above. The
286286 # assistant's previous response is included so Claude has the full history.
287287 followup = client.messages.create(
288 model="claude-opus-5",
288 model="claude-opus-5-5",
289289 max_tokens=1024,
290290 tools=tools,
291291 tool_choice={"type": "auto", "disable_parallel_tool_use": True},
from line 358
358358 // Send the user's request along with the tool definition. Claude decides
359359 // whether to call the tool based on the request and the tool description.
360360 const response = await client.messages.create({
361 model: "claude-opus-5",
361 model: "claude-opus-5-5",
362362 max_tokens: 1024,
363363 tools,
364364 tool_choice: { type: "auto", disable_parallel_tool_use: true },
from line 391
391391 // its tool_use_id must match the id from the tool_use block above. The
392392 // assistant's previous response is included so Claude has the full history.
393393 const followup = await client.messages.create({
394 model: "claude-opus-5",
394 model: "claude-opus-5-5",
395395 max_tokens: 1024,
396396 tools,
397397 tool_choice: { type: "auto", disable_parallel_tool_use: true },
from line 487
487487 // whether to call the tool based on the request and the tool description.
488488 var response = await client.Messages.Create(new MessageCreateParams
489489 {
490 Model = Model.ClaudeOpus5,
490 Model = Model.ClaudeOpus5_5,
491491 MaxTokens = 1024,
492492 Tools = tools,
493493 ToolChoice = toolChoice,
from line 530
530530 
531531 var followup = await client.Messages.Create(new MessageCreateParams
532532 {
533 Model = Model.ClaudeOpus5,
533 Model = Model.ClaudeOpus5_5,
534534 MaxTokens = 1024,
535535 Tools = tools,
536536 ToolChoice = toolChoice,
from line 615
615615 // Send the user's request along with the tool definition. Claude decides
616616 // whether to call the tool based on the request and the tool description.
617617 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
618 Model: anthropic.ModelClaudeOpus5,
618 Model: anthropic.ModelClaudeOpus5_5,
619619 MaxTokens: 1024,
620620 Tools: tools,
621621 ToolChoice: toolChoice,
from line 654
654654 }
655655 
656656 followup, err := client.Messages.New(ctx, anthropic.MessageNewParams{
657 Model: anthropic.ModelClaudeOpus5,
657 Model: anthropic.ModelClaudeOpus5_5,
658658 MaxTokens: 1024,
659659 Tools: tools,
660660 ToolChoice: toolChoice,
from line 741
741741 // Send the user's request along with the tool definition. Claude decides
742742 // whether to call the tool based on the request and the tool description.
743743 Message response = client.messages().create(MessageCreateParams.builder()
744 .model(Model.CLAUDE_OPUS_5)
744 .model(Model.CLAUDE_OPUS_5_5)
745745 .maxTokens(1024L)
746746 .addTool(calendarTool)
747747 .toolChoice(toolChoice)
from line 769
769769 // its tool_use_id must match the id from the tool_use block above. The
770770 // assistant's previous response is included so Claude has the full history.
771771 Message followup = client.messages().create(MessageCreateParams.builder()
772 .model(Model.CLAUDE_OPUS_5)
772 .model(Model.CLAUDE_OPUS_5_5)
773773 .maxTokens(1024L)
774774 .addTool(calendarTool)
775775 .toolChoice(toolChoice)
from line 845
845845 // Send the user's request along with the tool definition. Claude decides
846846 // whether to call the tool based on the request and the tool description.
847847 $response = $client->messages->create(
848 model: 'claude-opus-5',
848 model: 'claude-opus-5-5',
849849 maxTokens: 1024,
850850 tools: $tools,
851851 toolChoice: $toolChoice,
from line 876
876876 // its tool_use_id must match the id from the tool_use block above. The
877877 // assistant's previous response is included so Claude has the full history.
878878 $followup = $client->messages->create(
879 model: 'claude-opus-5',
879 model: 'claude-opus-5-5',
880880 maxTokens: 1024,
881881 tools: $tools,
882882 toolChoice: $toolChoice,
from line 957
957957 # Send the user's request along with the tool definition. Claude decides
958958 # whether to call the tool based on the request and the tool description.
959959 response = client.messages.create(
960 model: "claude-opus-5",
960 model: "claude-opus-5-5",
961961 max_tokens: 1024,
962962 tools: tools,
963963 tool_choice: tool_choice,
from line 982
982982 # its tool_use_id must match the id from the tool_use block above. The
983983 # assistant's previous response is included so Claude has the full history.
984984 followup = client.messages.create(
985 model: "claude-opus-5",
985 model: "claude-opus-5-5",
986986 max_tokens: 1024,
987987 tools: tools,
988988 tool_choice: tool_choice,
from line 1078
10781078 -H "anthropic-version: 2023-06-01" \
10791079 -H "content-type: application/json" \
10801080 -d "$(jq -n --argjson tools "$TOOLS" --argjson messages "$MESSAGES" \
1081 '{model: "claude-opus-5", max_tokens: 1024, tools: $tools, tool_choice: {type: "auto", disable_parallel_tool_use: true}, messages: $messages}')"
1081 '{model: "claude-opus-5-5", max_tokens: 1024, tools: $tools, tool_choice: {type: "auto", disable_parallel_tool_use: true}, messages: $messages}')"
10821082 }
10831083 
10841084 RESPONSE=$(call_api)
from line 1136
11361136 # JSON, which YAML accepts as flow syntax.
11371137 {
11381138 cat <<'YAML'
1139 model: claude-opus-5
1139 model: claude-opus-5-5
11401140 max_tokens: 1024
11411141 tool_choice: {type: auto, disable_parallel_tool_use: true}
11421142 tools:
from line 1243
12431243 ]
12441244 
12451245 response = client.messages.create(
1246 model="claude-opus-5",
1246 model="claude-opus-5-5",
12471247 max_tokens=1024,
12481248 tools=tools,
12491249 tool_choice={"type": "auto", "disable_parallel_tool_use": True},
from line 1271
12711271 )
12721272 
12731273 response = client.messages.create(
1274 model="claude-opus-5",
1274 model="claude-opus-5-5",
12751275 max_tokens=1024,
12761276 tools=tools,
12771277 tool_choice={"type": "auto", "disable_parallel_tool_use": True},
from line 1334
13341334 ];
13351335 
13361336 let response = await client.messages.create({
1337 model: "claude-opus-5",
1337 model: "claude-opus-5-5",
13381338 max_tokens: 1024,
13391339 tools,
13401340 tool_choice: { type: "auto", disable_parallel_tool_use: true },
from line 1362
13621362 });
13631363 
13641364 response = await client.messages.create({
1365 model: "claude-opus-5",
1365 model: "claude-opus-5-5",
13661366 max_tokens: 1024,
13671367 tools,
13681368 tool_choice: { type: "auto", disable_parallel_tool_use: true },
from line 1448
14481448 
14491449 var response = await client.Messages.Create(new MessageCreateParams
14501450 {
1451 Model = Model.ClaudeOpus5,
1451 Model = Model.ClaudeOpus5_5,
14521452 MaxTokens = 1024,
14531453 Tools = tools,
14541454 ToolChoice = toolChoice,
from line 1486
14861486 
14871487 response = await client.Messages.Create(new MessageCreateParams
14881488 {
1489 Model = Model.ClaudeOpus5,
1489 Model = Model.ClaudeOpus5_5,
14901490 MaxTokens = 1024,
14911491 Tools = tools,
14921492 ToolChoice = toolChoice,
from line 1567
15671567 }
15681568 
15691569 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
1570 Model: anthropic.ModelClaudeOpus5,
1570 Model: anthropic.ModelClaudeOpus5_5,
15711571 MaxTokens: 1024,
15721572 Tools: tools,
15731573 ToolChoice: toolChoice,
from line 1604
16041604 ))
16051605 
16061606 response, err = client.Messages.New(ctx, anthropic.MessageNewParams{
1607 Model: anthropic.ModelClaudeOpus5,
1607 Model: anthropic.ModelClaudeOpus5_5,
16081608 MaxTokens: 1024,
16091609 Tools: tools,
16101610 ToolChoice: toolChoice,
from line 1693
16931693 .build());
16941694 
16951695 Message response = client.messages().create(MessageCreateParams.builder()
1696 .model(Model.CLAUDE_OPUS_5)
1696 .model(Model.CLAUDE_OPUS_5_5)
16971697 .maxTokens(1024L)
16981698 .addTool(calendarTool)
16991699 .toolChoice(toolChoice)
from line 1721
17211721 .build());
17221722 
17231723 response = client.messages().create(MessageCreateParams.builder()
1724 .model(Model.CLAUDE_OPUS_5)
1724 .model(Model.CLAUDE_OPUS_5_5)
17251725 .maxTokens(1024L)
17261726 .addTool(calendarTool)
17271727 .toolChoice(toolChoice)
from line 1796
17961796 ];
17971797 
17981798 $response = $client->messages->create(
1799 model: 'claude-opus-5',
1799 model: 'claude-opus-5-5',
18001800 maxTokens: 1024,
18011801 tools: $tools,
18021802 toolChoice: $toolChoice,
from line 1829
18291829 ];
18301830 
18311831 $response = $client->messages->create(
1832 model: 'claude-opus-5',
1832 model: 'claude-opus-5-5',
18331833 maxTokens: 1024,
18341834 tools: $tools,
18351835 toolChoice: $toolChoice,
from line 1898
18981898 ]
18991899 
19001900 response = client.messages.create(
1901 model: "claude-opus-5",
1901 model: "claude-opus-5-5",
19021902 max_tokens: 1024,
19031903 tools: tools,
19041904 tool_choice: tool_choice,
from line 1924
19241924 }
19251925 
19261926 response = client.messages.create(
1927 model: "claude-opus-5",
1927 model: "claude-opus-5-5",
19281928 max_tokens: 1024,
19291929 tools: tools,
19301930 tool_choice: tool_choice,
from line 2009
20092009 -H "anthropic-version: 2023-06-01" \
20102010 -H "content-type: application/json" \
20112011 -d "$(jq -n --argjson tools "$TOOLS" --argjson messages "$MESSAGES" \
2012 '{model: "claude-opus-5", max_tokens: 1024, tools: $tools, messages: $messages}')"
2012 '{model: "claude-opus-5-5", max_tokens: 1024, tools: $tools, messages: $messages}')"
20132013 }
20142014 
20152015 RESPONSE=$(call_api)
from line 2066
20662066 # which YAML accepts as flow syntax.
20672067 {
20682068 cat <<'YAML'
2069 model: claude-opus-5
2069 model: claude-opus-5-5
20702070 max_tokens: 1024
20712071 tools:
20722072 - name: create_calendar_event
from line 2192
21922192 ]
21932193 
21942194 response = client.messages.create(
2195 model="claude-opus-5",
2195 model="claude-opus-5-5",
21962196 max_tokens=1024,
21972197 tools=tools,
21982198 messages=messages,
from line 2217
22172217 messages.append({"role": "user", "content": tool_results})
22182218 
22192219 response = client.messages.create(
2220 model="claude-opus-5",
2220 model="claude-opus-5-5",
22212221 max_tokens=1024,
22222222 tools=tools,
22232223 messages=messages,
from line 2294
22942294 ];
22952295 
22962296 let response = await client.messages.create({
2297 model: "claude-opus-5",
2297 model: "claude-opus-5-5",
22982298 max_tokens: 1024,
22992299 tools,
23002300 messages,
from line 2319
23192319 messages.push({ role: "user", content: toolResults });
23202320 
23212321 response = await client.messages.create({
2322 model: "claude-opus-5",
2322 model: "claude-opus-5-5",
23232323 max_tokens: 1024,
23242324 tools,
23252325 messages,
from line 2417
24172417 
24182418 var response = await client.Messages.Create(new MessageCreateParams
24192419 {
2420 Model = Model.ClaudeOpus5,
2420 Model = Model.ClaudeOpus5_5,
24212421 MaxTokens = 1024,
24222422 Tools = tools,
24232423 Messages = messages,
from line 2449
24492449 
24502450 response = await client.Messages.Create(new MessageCreateParams
24512451 {
2452 Model = Model.ClaudeOpus5,
2452 Model = Model.ClaudeOpus5_5,
24532453 MaxTokens = 1024,
24542454 Tools = tools,
24552455 Messages = messages,
from line 2537
25372537 }
25382538 
25392539 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
2540 Model: anthropic.ModelClaudeOpus5,
2540 Model: anthropic.ModelClaudeOpus5_5,
25412541 MaxTokens: 1024,
25422542 Tools: tools,
25432543 Messages: messages,
from line 2569
25692569 messages = append(messages, anthropic.NewUserMessage(toolResults...))
25702570 
25712571 response, err = client.Messages.New(ctx, anthropic.MessageNewParams{
2572 Model: anthropic.ModelClaudeOpus5,
2572 Model: anthropic.ModelClaudeOpus5_5,
25732573 MaxTokens: 1024,
25742574 Tools: tools,
25752575 Messages: messages,
from line 2666
26662666 .build());
26672667 
26682668 Message response = client.messages().create(MessageCreateParams.builder()
2669 .model(Model.CLAUDE_OPUS_5)
2669 .model(Model.CLAUDE_OPUS_5_5)
26702670 .maxTokens(1024L)
26712671 .addTool(calendarTool)
26722672 .addTool(listTool)
from line 2696
26962696 .build());
26972697 
26982698 response = client.messages().create(MessageCreateParams.builder()
2699 .model(Model.CLAUDE_OPUS_5)
2699 .model(Model.CLAUDE_OPUS_5_5)
27002700 .maxTokens(1024L)
27012701 .addTool(calendarTool)
27022702 .addTool(listTool)
from line 2783
27832783 ];
27842784 
27852785 $response = $client->messages->create(
2786 model: 'claude-opus-5',
2786 model: 'claude-opus-5-5',
27872787 maxTokens: 1024,
27882788 tools: $tools,
27892789 messages: $messages,
from line 2807
28072807 $messages[] = ['role' => 'user', 'content' => $toolResults];
28082808 
28092809 $response = $client->messages->create(
2810 model: 'claude-opus-5',
2810 model: 'claude-opus-5-5',
28112811 maxTokens: 1024,
28122812 tools: $tools,
28132813 messages: $messages,
from line 2885
28852885 ]
28862886 
28872887 response = client.messages.create(
2888 model: "claude-opus-5",
2888 model: "claude-opus-5-5",
28892889 max_tokens: 1024,
28902890 tools: tools,
28912891 messages: messages
from line 2906
29062906 messages << {role: "user", content: tool_results}
29072907 
29082908 response = client.messages.create(
2909 model: "claude-opus-5",
2909 model: "claude-opus-5-5",
29102910 max_tokens: 1024,
29112911 tools: tools,
29122912 messages: messages
from line 2922
29222922**What to expect**
29232923 
29242924```text Output wrap
2925I checked your calendar for next Monday and found an existing meeting from 2pm to 3pm. I've scheduled the planning session for 10am to 11am to avoid the conflict.
2925I checked your calendar for Monday, March 30 and found an existing meeting from 2pm to 3pm. I've scheduled the planning session for 10am to 11am to avoid the conflict.
29262926```
29272927 
29282928For more on concurrent execution and ordering guarantees, see [Parallel tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use).
from line 2995
29952995 -H "anthropic-version: 2023-06-01" \
29962996 -H "content-type: application/json" \
29972997 -d "$(jq -n --argjson tools "$TOOLS" --argjson messages "$MESSAGES" \
2998 '{model: "claude-opus-5", max_tokens: 1024, tools: $tools, messages: $messages}')"
2998 '{model: "claude-opus-5-5", max_tokens: 1024, tools: $tools, messages: $messages}')"
29992999 }
30003000 
30013001 RESPONSE=$(call_api)
from line 3064
30643064 # which YAML accepts as flow syntax.
30653065 {
30663066 cat <<'YAML'
3067 model: claude-opus-5
3067 model: claude-opus-5-5
30683068 max_tokens: 1024
30693069 tools:
30703070 - name: create_calendar_event
from line 3196
31963196 ]
31973197 
31983198 response = client.messages.create(
3199 model="claude-opus-5",
3199 model="claude-opus-5-5",
32003200 max_tokens=1024,
32013201 tools=tools,
32023202 messages=messages,
from line 3226
32263226 messages.append({"role": "user", "content": tool_results})
32273227 
32283228 response = client.messages.create(
3229 model="claude-opus-5",
3229 model="claude-opus-5-5",
32303230 max_tokens=1024,
32313231 tools=tools,
32323232 messages=messages,
from line 3307
33073307 ];
33083308 
33093309 let response = await client.messages.create({
3310 model: "claude-opus-5",
3310 model: "claude-opus-5-5",
33113311 max_tokens: 1024,
33123312 tools,
33133313 messages,
from line 3340
33403340 messages.push({ role: "user", content: toolResults });
33413341 
33423342 response = await client.messages.create({
3343 model: "claude-opus-5",
3343 model: "claude-opus-5-5",
33443344 max_tokens: 1024,
33453345 tools,
33463346 messages,
from line 3441
34413441 
34423442 var response = await client.Messages.Create(new MessageCreateParams
34433443 {
3444 Model = Model.ClaudeOpus5,
3444 Model = Model.ClaudeOpus5_5,
34453445 MaxTokens = 1024,
34463446 Tools = tools,
34473447 Messages = messages,
from line 3482
34823482 
34833483 response = await client.Messages.Create(new MessageCreateParams
34843484 {
3485 Model = Model.ClaudeOpus5,
3485 Model = Model.ClaudeOpus5_5,
34863486 MaxTokens = 1024,
34873487 Tools = tools,
34883488 Messages = messages,
from line 3579
35793579 }
35803580 
35813581 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
3582 Model: anthropic.ModelClaudeOpus5,
3582 Model: anthropic.ModelClaudeOpus5_5,
35833583 MaxTokens: 1024,
35843584 Tools: tools,
35853585 Messages: messages,
from line 3614
36143614 messages = append(messages, anthropic.NewUserMessage(toolResults...))
36153615 
36163616 response, err = client.Messages.New(ctx, anthropic.MessageNewParams{
3617 Model: anthropic.ModelClaudeOpus5,
3617 Model: anthropic.ModelClaudeOpus5_5,
36183618 MaxTokens: 1024,
36193619 Tools: tools,
36203620 Messages: messages,
from line 3724
37243724 .build());
37253725 
37263726 Message response = client.messages().create(MessageCreateParams.builder()
3727 .model(Model.CLAUDE_OPUS_5)
3727 .model(Model.CLAUDE_OPUS_5_5)
37283728 .maxTokens(1024L)
37293729 .addTool(calendarTool)
37303730 .addTool(listTool)
from line 3756
37563756 .build());
37573757 
37583758 response = client.messages().create(MessageCreateParams.builder()
3759 .model(Model.CLAUDE_OPUS_5)
3759 .model(Model.CLAUDE_OPUS_5_5)
37603760 .maxTokens(1024L)
37613761 .addTool(calendarTool)
37623762 .addTool(listTool)
from line 3849
38493849 ];
38503850 
38513851 $response = $client->messages->create(
3852 model: 'claude-opus-5',
3852 model: 'claude-opus-5-5',
38533853 maxTokens: 1024,
38543854 tools: $tools,
38553855 messages: $messages,
from line 3881
38813881 $messages[] = ['role' => 'user', 'content' => $toolResults];
38823882 
38833883 $response = $client->messages->create(
3884 model: 'claude-opus-5',
3884 model: 'claude-opus-5-5',
38853885 maxTokens: 1024,
38863886 tools: $tools,
38873887 messages: $messages,
from line 3963
39633963 ]
39643964 
39653965 response = client.messages.create(
3966 model: "claude-opus-5",
3966 model: "claude-opus-5-5",
39673967 max_tokens: 1024,
39683968 tools: tools,
39693969 messages: messages
from line 3992
39923992 messages << {role: "user", content: tool_results}
39933993 
39943994 response = client.messages.create(
3995 model: "claude-opus-5",
3995 model: "claude-opus-5-5",
39963996 max_tokens: 1024,
39973997 tools: tools,
39983998 messages: messages
from line 4089
40894089 
40904090 
40914091 final_message = client.beta.messages.tool_runner(
4092 model="claude-opus-5",
4092 model="claude-opus-5-5",
40934093 max_tokens=1024,
40944094 tools=[create_calendar_event, list_calendar_events],
40954095 messages=[
from line 4156
41564156 });
41574157 
41584158 const finalMessage = await client.beta.messages.toolRunner({
4159 model: "claude-opus-5",
4159 model: "claude-opus-5-5",
41604160 max_tokens: 1024,
41614161 tools: [createCalendarEvent, listCalendarEvents],
41624162 messages: [
from line 4267
42674267 var runner = client.Beta.Messages.ToolRunner(
42684268 new MessageCreateParams
42694269 {
4270 Model = Model.ClaudeOpus5,
4270 Model = Model.ClaudeOpus5_5,
42714271 MaxTokens = 1024,
42724272 Messages =
42734273 [
from line 4374
43744374 []anthropic.BetaTool{createCalendarEvent, listCalendarEvents},
43754375 anthropic.BetaToolRunnerParams{
43764376 BetaMessageNewParams: anthropic.BetaMessageNewParams{
4377 Model: anthropic.ModelClaudeOpus5,
4377 Model: anthropic.ModelClaudeOpus5_5,
43784378 MaxTokens: 1024,
43794379 Messages: []anthropic.BetaMessageParam{
43804380 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(
from line 4460
44604460 BetaToolRunner runner = client.beta()
44614461 .messages()
44624462 .toolRunner(MessageCreateParams.builder()
4463 .model(Model.CLAUDE_OPUS_5)
4463 .model(Model.CLAUDE_OPUS_5_5)
44644464 .maxTokens(1024)
44654465 .addBeta("structured-outputs-2025-11-13")
44664466 .addUserMessage("Check what I have next Monday, then schedule a planning session that avoids any conflicts.")
from line 4559
45594559 'content' => 'Check what I have next Monday, then schedule a planning session that avoids any conflicts.',
45604560 ],
45614561 ],
4562 model: Model::CLAUDE_OPUS_5,
4562 model: Model::CLAUDE_OPUS_5_5,
45634563 tools: [$createCalendarEvent, $listCalendarEvents],
45644564 );
45654565 
from line 4625
46254625 # The runner calls the API, runs requested tools, and feeds results back
46264626 # until Claude produces a final answer.
46274627 runner = client.beta.messages.tool_runner(
4628 model: "claude-opus-5",
4628 model: "claude-opus-5-5",
46294629 max_tokens: 1024,
46304630 tools: [CreateCalendarEvent.new, ListCalendarEvents.new],
46314631 messages: [
from line 4648
46484648**What to expect**
46494649 
46504650```text Output wrap
4651I checked your calendar for next Monday and found an existing meeting from 2pm to 3pm. I've scheduled the planning session for 10am to 11am to avoid the conflict.
4651I checked your calendar for Monday, March 30 and found an existing meeting from 2pm to 3pm. I've scheduled the planning session for 10am to 11am to avoid the conflict.
46524652```
46534653 
46544654The output is identical to Ring 3. The difference is in the code: roughly half the lines, no manual loop, and the schema lives next to the implementation.

agents-and-tools/tool-use/code-execution-tool Changed · +44 / -43 lines

from line 10
1010 - claude-mythos-5-1
1111 - claude-fable-5
1212 - claude-mythos-5
13 - claude-opus-5-5
1314 - claude-opus-5
1415 - claude-opus-4-8
1516 - claude-opus-4-7
from line 72
7172 -H "anthropic-version: 2023-06-01" \
7273 -H "content-type: application/json" \
7374 -d '{
74 "model": "claude-opus-5",
75 "model": "claude-opus-5-5",
7576 "max_tokens": 4096,
7677 "messages": [
7778 {
from line 91
9091 
9192 ```bash CLI
9293 ant messages create \
93 --model claude-opus-5 \
94 --model claude-opus-5-5 \
9495 --max-tokens 4096 \
9596 --message '{
9697 role: user,
from line 105
104105 client = anthropic.Anthropic()
105106 
106107 response = client.messages.create(
107 model="claude-opus-5",
108 model="claude-opus-5-5",
108109 max_tokens=4096,
109110 messages=[
110111 {
from line 123
122123 const client = new Anthropic();
123124 
124125 const response = await client.messages.create({
125 model: "claude-opus-5",
126 model: "claude-opus-5-5",
126127 max_tokens: 4096,
127128 messages: [
128129 {
from line 143
142143 
143144 var message = await client.Messages.Create(new()
144145 {
145 Model = Model.ClaudeOpus5,
146 Model = Model.ClaudeOpus5_5,
146147 MaxTokens = 4096,
147148 Messages = [new() { Role = Role.User, Content = "Use the code execution tool to calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" }],
148149 Tools = [new CodeExecutionTool20250825()]
from line 156
155156 client := anthropic.NewClient()
156157 
157158 response, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
158 Model: anthropic.ModelClaudeOpus5,
159 Model: anthropic.ModelClaudeOpus5_5,
159160 MaxTokens: 4096,
160161 Messages: []anthropic.MessageParam{
161162 anthropic.NewUserMessage(anthropic.NewTextBlock("Use the code execution tool to calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]")),
from line 175
174175 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
175176 
176177 MessageCreateParams params = MessageCreateParams.builder()
177 .model(Model.CLAUDE_OPUS_5)
178 .model(Model.CLAUDE_OPUS_5_5)
178179 .maxTokens(4096L)
179180 .addUserMessage("Use the code execution tool to calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]")
180181 .addTool(CodeExecutionTool20250825.builder().build())
from line 196
195196 'content' => 'Use the code execution tool to calculate the mean and standard deviation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]',
196197 ],
197198 ],
198 model: Model::CLAUDE_OPUS_5,
199 model: Model::CLAUDE_OPUS_5_5,
199200 tools: [new CodeExecutionTool20250825()],
200201 );
201202 
from line 207
206207 client = Anthropic::Client.new
207208 
208209 message = client.messages.create(
209 model: Anthropic::Model::CLAUDE_OPUS_5,
210 model: Anthropic::Model::CLAUDE_OPUS_5_5,
210211 max_tokens: 4096,
211212 messages: [
212213 {
from line 299
298299 -H "anthropic-version: 2023-06-01" \
299300 -H "content-type: application/json" \
300301 -d '{
301 "model": "claude-opus-5",
302 "model": "claude-opus-5-5",
302303 "max_tokens": 4096,
303304 "messages": [{
304305 "role": "user",
from line 321
320321 
321322 # Then use the file_id with code execution
322323 ant messages create <<YAML
323 model: claude-opus-5
324 model: claude-opus-5-5
324325 max_tokens: 4096
325326 messages:
326327 - role: user
from line 344
343344 
344345 # Use the file_id with code execution
345346 response = client.messages.create(
346 model="claude-opus-5",
347 model="claude-opus-5-5",
347348 max_tokens=4096,
348349 messages=[
349350 {
from line 373
372373 
373374 // Use the file_id with code execution
374375 const response = await client.messages.create({
375 model: "claude-opus-5",
376 model: "claude-opus-5-5",
376377 max_tokens: 4096,
377378 messages: [
378379 {
from line 407
406407 // Use the file_id with code execution
407408 var parameters = new MessageCreateParams
408409 {
409 Model = Model.ClaudeOpus5,
410 Model = Model.ClaudeOpus5_5,
410411 MaxTokens = 4096,
411412 Messages = [
412413 new()
from line 446
445446 
446447 // Use the file_id with code execution
447448 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
448 Model: anthropic.ModelClaudeOpus5,
449 Model: anthropic.ModelClaudeOpus5_5,
449450 MaxTokens: 4096,
450451 Messages: []anthropic.MessageParam{
451452 anthropic.NewUserMessage(
from line 478
477478 // Use the file_id with code execution
478479 Message response = client.messages().create(
479480 MessageCreateParams.builder()
480 .model(Model.CLAUDE_OPUS_5)
481 .model(Model.CLAUDE_OPUS_5_5)
481482 .maxTokens(4096L)
482483 .addUserMessageOfBlockParams(List.of(
483484 ContentBlockParam.ofText(TextBlockParam.builder()
from line 505
504505 
505506 // Use the file_id with code execution
506507 $response = $client->messages->create(
507 model: Model::CLAUDE_OPUS_5,
508 model: Model::CLAUDE_OPUS_5_5,
508509 maxTokens: 4096,
509510 messages: [
510511 [
from line 532
531532 
532533 # Use the file_id with code execution
533534 response = client.messages.create(
534 model: Anthropic::Model::CLAUDE_OPUS_5,
535 model: Anthropic::Model::CLAUDE_OPUS_5_5,
535536 max_tokens: 4096,
536537 messages: [
537538 {
from line 574
573574 
574575 # Request code execution that creates files
575576 response = client.messages.create(
576 model="claude-opus-5",
577 model="claude-opus-5-5",
577578 max_tokens=4096,
578579 messages=[
579580 {
from line 613
612613 
613614 // Request code execution that creates files
614615 const response = await client.messages.create({
615 model: "claude-opus-5",
616 model: "claude-opus-5-5",
616617 max_tokens: 4096,
617618 messages: [
618619 {
from line 652
651652 
652653 var parameters = new MessageCreateParams
653654 {
654 Model = Model.ClaudeOpus5,
655 Model = Model.ClaudeOpus5_5,
655656 MaxTokens = 4096,
656657 Messages = [new() { Role = Role.User, Content = "Create a matplotlib visualization and save it as output.png" }],
657658 Tools = [new CodeExecutionTool20250825()]
from line 691
690691 ctx := context.Background()
691692 
692693 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
693 Model: anthropic.ModelClaudeOpus5,
694 Model: anthropic.ModelClaudeOpus5_5,
694695 MaxTokens: 4096,
695696 Messages: []anthropic.MessageParam{
696697 anthropic.NewUserMessage(anthropic.NewTextBlock("Create a matplotlib visualization and save it as output.png")),
from line 755
754755 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
755756 
756757 MessageCreateParams params = MessageCreateParams.builder()
757 .model(Model.CLAUDE_OPUS_5)
758 .model(Model.CLAUDE_OPUS_5_5)
758759 .maxTokens(4096L)
759760 .addUserMessage("Create a matplotlib visualization and save it as output.png")
760761 .addTool(CodeExecutionTool20250825.builder().build())
from line 807
806807 'content' => 'Create a matplotlib visualization and save it as output.png',
807808 ],
808809 ],
809 model: Model::CLAUDE_OPUS_5,
810 model: Model::CLAUDE_OPUS_5_5,
810811 tools: [new CodeExecutionTool20250825()],
811812 );
812813 
from line 848
847848 client = Anthropic::Client.new
848849 
849850 response = client.messages.create(
850 model: Anthropic::Model::CLAUDE_OPUS_5,
851 model: Anthropic::Model::CLAUDE_OPUS_5_5,
851852 max_tokens: 4096,
852853 messages: [
853854 {
from line 1147
11461147 -H "anthropic-version: 2023-06-01" \
11471148 -H "content-type: application/json" \
11481149 -d '{
1149 "model": "claude-opus-5",
1150 "model": "claude-opus-5-5",
11501151 "max_tokens": 4096,
11511152 "messages": [{
11521153 "role": "user",
from line 1166
11651166 -H "content-type: application/json" \
11661167 -d '{
11671168 "container": "'"$CONTAINER_ID"'",
1168 "model": "claude-opus-5",
1169 "model": "claude-opus-5-5",
11691170 "max_tokens": 4096,
11701171 "messages": [{
11711172 "role": "user",
from line 1182
11811182 ```bash CLI
11821183 # First request: Create a file with a random number
11831184 CONTAINER_ID=$(ant messages create \
1184 --model claude-opus-5 \
1185 --model claude-opus-5-5 \
11851186 --max-tokens 4096 \
11861187 --message '{role: user, content: Write a file with a random number and save it to "/tmp/number.txt"}' \
11871188 --tool '{type: code_execution_20250825, name: code_execution}' \
from line 1191
11901191 # Second request: Reuse the container to read the file
11911192 ant messages create \
11921193 --container "$CONTAINER_ID" \
1193 --model claude-opus-5 \
1194 --model claude-opus-5-5 \
11941195 --max-tokens 4096 \
11951196 --message '{role: user, content: Read the number from "/tmp/number.txt" and calculate its square}' \
11961197 --tool '{type: code_execution_20250825, name: code_execution}'
from line 1202
12011202 
12021203 # First request: create a file with a random number in a new container
12031204 response1 = client.messages.create(
1204 model="claude-opus-5",
1205 model="claude-opus-5-5",
12051206 max_tokens=4096,
12061207 messages=[
12071208 {
from line 1216
12151216 # Second request: pass the container ID back so Claude reuses the same container
12161217 response2 = client.messages.create(
12171218 container=response1.container.id,
1218 model="claude-opus-5",
1219 model="claude-opus-5-5",
12191220 max_tokens=4096,
12201221 messages=[
12211222 {
from line 1235
12341235 
12351236 // First request: Claude creates a file inside a fresh code execution container
12361237 const response1 = await client.messages.create({
1237 model: "claude-opus-5",
1238 model: "claude-opus-5-5",
12381239 max_tokens: 4096,
12391240 messages: [
12401241 {
from line 1254
12531254 // Second request: pass the container ID back so it reuses the same container
12541255 const response2 = await client.messages.create({
12551256 container: response1.container.id,
1256 model: "claude-opus-5",
1257 model: "claude-opus-5-5",
12571258 max_tokens: 4096,
12581259 messages: [
12591260 { role: "user", content: "Read the number from /tmp/number.txt and calculate its square" }
from line 1271
12701271 // First request: Claude creates a file inside a fresh code execution container
12711272 var response1 = await client.Messages.Create(new()
12721273 {
1273 Model = Model.ClaudeOpus5,
1274 Model = Model.ClaudeOpus5_5,
12741275 MaxTokens = 4096,
12751276 Messages = [new() { Role = Role.User, Content = "Write a file with a random number and save it to '/tmp/number.txt'" }],
12761277 Tools = [new CodeExecutionTool20250825()]
from line 1281
12801281 var response2 = await client.Messages.Create(new()
12811282 {
12821283 Container = response1.Container!.ID,
1283 Model = Model.ClaudeOpus5,
1284 Model = Model.ClaudeOpus5_5,
12841285 MaxTokens = 4096,
12851286 Messages = [new() { Role = Role.User, Content = "Read the number from '/tmp/number.txt' and calculate its square" }],
12861287 Tools = [new CodeExecutionTool20250825()]
from line 1300
12991300 
13001301 // First request: create a file with a random number in a new container
13011302 response1, err := client.Messages.New(ctx, anthropic.MessageNewParams{
1302 Model: anthropic.ModelClaudeOpus5,
1303 Model: anthropic.ModelClaudeOpus5_5,
13031304 MaxTokens: 4096,
13041305 Messages: []anthropic.MessageParam{
13051306 anthropic.NewUserMessage(anthropic.NewTextBlock("Write a file with a random number and save it to '/tmp/number.txt'")),
from line 1316
13151316 Container: anthropic.MessageCreateParamsContainerUnion{
13161317 OfString: anthropic.String(response1.Container.ID),
13171318 },
1318 Model: anthropic.ModelClaudeOpus5,
1319 Model: anthropic.ModelClaudeOpus5_5,
13191320 MaxTokens: 4096,
13201321 Messages: []anthropic.MessageParam{
13211322 anthropic.NewUserMessage(anthropic.NewTextBlock("Read the number from '/tmp/number.txt' and calculate its square")),
from line 1335
13341335 
13351336 // First request: create a file with a random number in a new container
13361337 MessageCreateParams params1 = MessageCreateParams.builder()
1337 .model(Model.CLAUDE_OPUS_5)
1338 .model(Model.CLAUDE_OPUS_5_5)
13381339 .maxTokens(4096L)
13391340 .addUserMessage("Write a file with a random number and save it to '/tmp/number.txt'")
13401341 .addTool(CodeExecutionTool20250825.builder().build())
from line 1346
13451346 // Second request: pass the container ID back so it reuses the same container
13461347 MessageCreateParams params2 = MessageCreateParams.builder()
13471348 .container(response1.container().orElseThrow().id())
1348 .model(Model.CLAUDE_OPUS_5)
1349 .model(Model.CLAUDE_OPUS_5_5)
13491350 .maxTokens(4096L)
13501351 .addUserMessage("Read the number from '/tmp/number.txt' and calculate its square")
13511352 .addTool(CodeExecutionTool20250825.builder().build())
from line 1368
13671368 'content' => "Write a file with a random number and save it to '/tmp/number.txt'",
13681369 ],
13691370 ],
1370 model: Model::CLAUDE_OPUS_5,
1371 model: Model::CLAUDE_OPUS_5_5,
13711372 tools: [new CodeExecutionTool20250825()],
13721373 );
13731374 
from line 1382
13811382 'content' => "Read the number from '/tmp/number.txt' and calculate its square",
13821383 ],
13831384 ],
1384 model: Model::CLAUDE_OPUS_5,
1385 model: Model::CLAUDE_OPUS_5_5,
13851386 tools: [new CodeExecutionTool20250825()],
13861387 );
13871388 
from line 1394
13931394 
13941395 # First request: Claude creates the file inside a fresh code execution container
13951396 response1 = client.messages.create(
1396 model: Anthropic::Model::CLAUDE_OPUS_5,
1397 model: Anthropic::Model::CLAUDE_OPUS_5_5,
13971398 max_tokens: 4096,
13981399 messages: [
13991400 {
from line 1408
14071408 # Second request: pass the container ID back so Claude reuses the same container
14081409 response2 = client.messages.create(
14091410 container: response1.container.id,
1410 model: Anthropic::Model::CLAUDE_OPUS_5,
1411 model: Anthropic::Model::CLAUDE_OPUS_5_5,
14111412 max_tokens: 4096,
14121413 messages: [
14131414 {

agents-and-tools/tool-use/computer-use-tool Changed · +16 / -13 lines

from line 12
1212 - claude-mythos-5-1
1313 - claude-fable-5
1414 - claude-mythos-5
15 - claude-opus-5-5
1516 - claude-opus-5
1617 - claude-sonnet-5
1718 - claude-opus-4-8
from line 23
2223 Google Cloud: ga
2324 Microsoft Foundry: beta
2425 details:
26 - On the Claude API and Google Cloud, Claude Opus 5.5 supports computer use only through the `computer_toolset_20260801` toolset and returns an error for the earlier `computer_20251124` tool version. To move an existing integration, see [Migrate from `computer_20251124`](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#migrate-from-computer-20251124).
27 - On Amazon Bedrock, Claude Opus 5.5 accepts the earlier `computer_20251124` tool version as Claude Opus 5 does.
2528 - Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, and Claude Opus 4.5 support computer use only through the earlier `computer_20251124` tool version, which requires a beta header; see [Earlier tool versions](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#earlier-tool-versions).
2629 - Platforms other than the Claude API and Google Cloud currently offer only the [earlier beta tool versions](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#earlier-tool-versions).
2730---
from line 73
7073 -H "x-api-key: $ANTHROPIC_API_KEY" \
7174 -H "anthropic-version: 2023-06-01" \
7275 -d '{
73 "model": "claude-opus-5",
76 "model": "claude-opus-5-5",
7477 "max_tokens": 1024,
7578 "tools": [
7679 {
from line 99
9699 
97100 ```bash CLI
98101 ant messages create <<'YAML'
99 model: claude-opus-5
102 model: claude-opus-5-5
100103 max_tokens: 1024
101104 tools:
102105 - type: computer_toolset_20260801
from line 117
114117 client = anthropic.Anthropic()
115118 
116119 response = client.messages.create(
117 model="claude-opus-5",
120 model="claude-opus-5-5",
118121 max_tokens=1024,
119122 tools=[
120123 {"type": "computer_toolset_20260801"},
from line 133
130133 const client = new Anthropic();
131134 
132135 const response = await client.messages.create({
133 model: "claude-opus-5",
136 model: "claude-opus-5-5",
134137 max_tokens: 1024,
135138 tools: [
136139 {
from line 159
156159 
157160 var parameters = new MessageCreateParams
158161 {
159 Model = Model.ClaudeOpus5,
162 Model = Model.ClaudeOpus5_5,
160163 MaxTokens = 1024,
161164 Tools =
162165 [
from line 185
182185 client := anthropic.NewClient()
183186 
184187 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
185 Model: anthropic.ModelClaudeOpus5,
188 Model: anthropic.ModelClaudeOpus5_5,
186189 MaxTokens: 1024,
187190 Tools: []anthropic.ToolUnionParam{
188191 {OfComputerToolset20260801: &anthropic.ComputerToolset20260801Param{}},
from line 212
209212 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
210213 
211214 MessageCreateParams params = MessageCreateParams.builder()
212 .model(Model.CLAUDE_OPUS_5)
215 .model(Model.CLAUDE_OPUS_5_5)
213216 .maxTokens(1024L)
214217 .addTool(ComputerToolset20260801.builder().build())
215218 .addTool(ToolTextEditor20250728.builder().build())
from line 233
230233 messages: [
231234 ['role' => 'user', 'content' => 'Save a picture of a cat to my desktop.'],
232235 ],
233 model: 'claude-opus-5',
236 model: 'claude-opus-5-5',
234237 tools: [
235238 ['type' => 'computer_toolset_20260801'],
236239 [
from line 254
251254 client = Anthropic::Client.new
252255 
253256 response = client.messages.create(
254 model: "claude-opus-5",
257 model: "claude-opus-5-5",
255258 max_tokens: 1024,
256259 tools: [
257260 { type: "computer_toolset_20260801" },
from line 283
280283 "id": "msg_01UZ3bXcQH8mTqNhVfL9eK2p",
281284 "type": "message",
282285 "role": "assistant",
283 "model": "claude-opus-5",
286 "model": "claude-opus-5-5",
284287 "content": [
285288 {
286289 "type": "text",
from line 1828
18251828 
18261829* Place one `cache_control` breakpoint after the system prompt and tool definitions, and up to three more on the last `tool_result` block of each of the most recent turns, advancing them each turn. Within a [batch action](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#batch-actions), markers on several blocks act as a single breakpoint but each still counts toward the limit of four, so use one per turn.
18271830* Prune old screenshots in *batches*, not one each turn. Dropping a screenshot every turn changes the prefix every turn and invalidates the cache. A reasonable default is to keep the last three screenshots and prune every 25 turns, so the prefix stays byte-identical between prune events; if your screenshots exceed 2000 px on either side, choose an interval that keeps each request at 20 or fewer images.
1828* On Claude Fable 5.1, avoid pruning on the client: removing an earlier screenshot [invalidates every later thinking block](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-in-conversation) in every request that still carries those turns. Resize screenshots to 2000 px or less per side instead, and use server-side [tool result clearing](https://platform.claude.com/docs/en/build-with-claude/context-editing#tool-result-clearing) to drop old ones from the context. If you must prune, keep [`prefix_mismatch_behavior: "drop_block"`](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-thinking-controls) set from then on; after each prune, Claude continues without the thinking produced since the pruned screenshot, on that request and every later one.
1831* On Claude Fable 5.1 and Claude Opus 5.5, avoid pruning on the client: removing an earlier screenshot [invalidates every later thinking block](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-in-conversation) in every request that still carries those turns. Resize screenshots to 2000 px or less per side instead, and use server-side [tool result clearing](https://platform.claude.com/docs/en/build-with-claude/context-editing#tool-result-clearing) to drop old ones from the context. If you must prune, keep [`prefix_mismatch_behavior: "drop_block"`](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-thinking-controls) set from then on; after each prune, Claude continues without the thinking produced since the pruned screenshot, on that request and every later one.
18291832 
18301833### Diagnose click issues
18311834 
from line 2115
21122115 
21132116## Migrate from `computer_20251124`
21142117 
2115Upgrading from `computer_20251124` to the toolset is optional: the models listed for `computer_20251124` under [Earlier tool versions](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#earlier-tool-versions) keep accepting it with its beta header, so an existing integration keeps working until you change it. To upgrade, make the following changes together:
2118Upgrading from `computer_20251124` to the toolset is optional: the models listed for `computer_20251124` under [Earlier tool versions](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#earlier-tool-versions) keep accepting it with its beta header, so an existing integration keeps working until you change it. Claude Opus 5.5 is the exception on the Claude API and Google Cloud: there it accepts only the toolset, so upgrade an integration before moving it to that model. On Amazon Bedrock it keeps accepting `computer_20251124`. To upgrade, make the following changes together:
21162119 
211721201. **Remove the beta header.** Drop `anthropic-beta: computer-use-2025-11-24` from your requests. In the SDKs, remove the `betas` parameter and call the Messages API through the standard client rather than the beta namespace.
211821212. **Change the `tools` entry.** Set `type` to `computer_toolset_20260801` and delete `name`, `display_width_px`, `display_height_px`, `display_number`, and `enable_zoom`. The toolset rejects each of these fields.
from line 2177
21742177 
21752178| Tool version | Beta header | Use with | Parameters |
21762179| ------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
2177| `computer_20251124` | `computer-use-2025-11-24` | Claude Fable 5.1, Claude Mythos 5.1, Claude Fable 5, Claude Mythos 5, Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, and Claude Opus 4.5 | [API reference](https://platform.claude.com/docs/en/api/beta/messages/create) |
2180| `computer_20251124` | `computer-use-2025-11-24` | Claude Fable 5.1, Claude Mythos 5.1, Claude Fable 5, Claude Mythos 5, Claude Opus 5, Claude Sonnet 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, and Claude Opus 4.5; on Amazon Bedrock, also Claude Opus 5.5 | [API reference](https://platform.claude.com/docs/en/api/beta/messages/create) |
21782181| `computer_20250124` | `computer-use-2025-01-24` | Claude Sonnet 4.5, Claude Haiku 4.5, Claude Opus 4.1 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)), Claude Sonnet 4 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)), and Claude Opus 4 ([retired, except on Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | [API reference](https://platform.claude.com/docs/en/api/beta/messages/create) |
21792182 
21802183***

agents-and-tools/tool-use/define-tools Changed · +11 / -11 lines

from line 146
146146 -H "anthropic-version: 2023-06-01" \
147147 -d @- <<'EOF'
148148 {
149 "model": "claude-opus-5",
149 "model": "claude-opus-5-5",
150150 "max_tokens": 1024,
151151 "tools": [
152152 {
from line 183
183183 
184184 ```bash CLI
185185 ant messages create <<'YAML'
186 model: claude-opus-5
186 model: claude-opus-5-5
187187 max_tokens: 1024
188188 tools:
189189 - name: get_weather
from line 215
215215 client = anthropic.Anthropic()
216216 
217217 response = client.messages.create(
218 model="claude-opus-5",
218 model="claude-opus-5-5",
219219 max_tokens=1024,
220220 tools=[
221221 {
from line 255
255255 const client = new Anthropic();
256256 
257257 const response = await client.messages.create({
258 model: "claude-opus-5",
258 model: "claude-opus-5-5",
259259 max_tokens: 1024,
260260 tools: [
261261 {
from line 303
303303 
304304 var parameters = new MessageCreateParams
305305 {
306 Model = Model.ClaudeOpus5,
306 Model = Model.ClaudeOpus5_5,
307307 MaxTokens = 1024,
308308 Tools = [
309309 new ToolUnion(new Tool()
from line 351
351351 client := anthropic.NewClient()
352352 
353353 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
354 Model: anthropic.ModelClaudeOpus5,
354 Model: anthropic.ModelClaudeOpus5_5,
355355 MaxTokens: 1024,
356356 Tools: []anthropic.ToolUnionParam{
357357 {OfTool: &anthropic.ToolParam{
from line 405
405405 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
406406 
407407 MessageCreateParams params = MessageCreateParams.builder()
408 .model(Model.CLAUDE_OPUS_5)
408 .model(Model.CLAUDE_OPUS_5_5)
409409 .maxTokens(1024L)
410410 .addTool(Tool.builder()
411411 .name("get_weather")
from line 454
454454 messages: [
455455 ['role' => 'user', 'content' => "What's the weather like in San Francisco?"]
456456 ],
457 model: 'claude-opus-5',
457 model: 'claude-opus-5-5',
458458 tools: [
459459 [
460460 'name' => 'get_weather',
from line 496
496496 client = Anthropic::Client.new
497497 
498498 message = client.messages.create(
499 model: "claude-opus-5",
499 model: "claude-opus-5-5",
500500 max_tokens: 1024,
501501 tools: [
502502 {
from line 558
558558 
559559| Model or setting | Restriction | What to use instead |
560560| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
561| Manual [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) (`thinking: {type: "enabled"}`) | `any` and `tool` are not supported and result in an error | `auto` or `none`. [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking), including on models where thinking is on by default such as Claude Opus 5, supports forced tool use |
562| Claude Fable 5.1 and [Claude Mythos 5.1](https://anthropic.com/glasswing) | `any` and `tool` return a [400 error](https://platform.claude.com/docs/en/api/errors#forced-tool-use-not-supported) | `auto` with [strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use) to guarantee schema-valid tool inputs, or [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) when you need a response in a fixed JSON shape. Prompting still influences which tool `auto` picks. `none` is also supported |
561| Manual [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) (`thinking: {type: "enabled"}`) | `any` and `tool` are not supported and result in an error | `auto` or `none`. [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) itself doesn't block forced tool use (Claude Opus 5 supports it with thinking on); the models in the next row reject forced tool use regardless of thinking settings |
562| Claude Opus 5.5, Claude Fable 5.1, and [Claude Mythos 5.1](https://anthropic.com/glasswing) | `any` and `tool` return a [400 error](https://platform.claude.com/docs/en/api/errors#forced-tool-use-not-supported) | `auto` with [strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use) to guarantee schema-valid tool inputs, or [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) when you need a response in a fixed JSON shape. Prompting still influences which tool `auto` picks. `none` is also supported |
563563 
564564On models that support it, the highlighted lines are the only difference from a standard tool use request:
565565 

agents-and-tools/tool-use/fine-grained-tool-streaming Changed · +16 / -16 lines

from line 29
2929 -H "x-api-key: $ANTHROPIC_API_KEY" \
3030 -H "anthropic-version: 2023-06-01" \
3131 -d '{
32 "model": "claude-opus-5",
32 "model": "claude-opus-5-5",
3333 "max_tokens": 65536,
3434 "tools": [
3535 {
from line 64
6464 
6565 ```bash CLI
6666 ant messages create --stream --format jsonl <<'YAML' |
67 model: claude-opus-5
67 model: claude-opus-5-5
6868 max_tokens: 65536
6969 tools:
7070 - name: make_file
from line 94
9494 
9595 with client.messages.stream(
9696 max_tokens=65536,
97 model="claude-opus-5",
97 model="claude-opus-5-5",
9898 tools=[
9999 {
100100 "name": "make_file",
from line 138
138138 const client = new Anthropic();
139139 
140140 const stream = client.messages.stream({
141 model: "claude-opus-5",
141 model: "claude-opus-5-5",
142142 max_tokens: 65536,
143143 tools: [
144144 {
from line 187
187187 
188188 MessageCreateParams parameters = new()
189189 {
190 Model = Model.ClaudeOpus5,
190 Model = Model.ClaudeOpus5_5,
191191 MaxTokens = 65536,
192192 Tools =
193193 [
from line 273
273273 }
274274 
275275 stream := client.Messages.NewStreaming(context.Background(), anthropic.MessageNewParams{
276 Model: anthropic.ModelClaudeOpus5,
276 Model: anthropic.ModelClaudeOpus5_5,
277277 MaxTokens: 65536,
278278 Tools: []anthropic.ToolUnionParam{{OfTool: &makeFileTool}},
279279 Messages: []anthropic.MessageParam{
from line 329
329329 .build();
330330 
331331 MessageCreateParams params = MessageCreateParams.builder()
332 .model(Model.CLAUDE_OPUS_5)
332 .model(Model.CLAUDE_OPUS_5_5)
333333 .maxTokens(65536L)
334334 .addTool(makeFileTool)
335335 .addUserMessage("Can you write a long poem and make a file called poem.txt?")
from line 368
368368 
369369 $stream = $client->messages->createStream(
370370 maxTokens: 65536,
371 model: Model::CLAUDE_OPUS_5,
371 model: Model::CLAUDE_OPUS_5_5,
372372 tools: [
373373 [
374374 'name' => 'make_file',
from line 427
427427 client = Anthropic::Client.new
428428 
429429 stream = client.messages.stream(
430 model: Anthropic::Models::Model::CLAUDE_OPUS_5,
430 model: Anthropic::Models::Model::CLAUDE_OPUS_5_5,
431431 max_tokens: 65_536,
432432 tools: [
433433 {
from line 513
513513 tool_inputs: dict[int, str] = {} # index -> accumulated JSON string
514514 
515515 with client.messages.stream(
516 model="claude-opus-5",
516 model="claude-opus-5-5",
517517 max_tokens=1024,
518518 tools=[
519519 {
from line 553
553553 const toolInputs = new Map<number, string>();
554554 
555555 const stream = client.messages.stream({
556 model: "claude-opus-5",
556 model: "claude-opus-5-5",
557557 max_tokens: 1024,
558558 tools: [
559559 {
from line 606
606606 
607607 MessageCreateParams parameters = new()
608608 {
609 Model = Model.ClaudeOpus5,
609 Model = Model.ClaudeOpus5_5,
610610 MaxTokens = 1024,
611611 Tools =
612612 [
from line 675
675675 toolInputs := map[int64]string{} // content block index -> accumulated JSON
676676 
677677 stream := client.Messages.NewStreaming(context.Background(), anthropic.MessageNewParams{
678 Model: anthropic.ModelClaudeOpus5,
678 Model: anthropic.ModelClaudeOpus5_5,
679679 MaxTokens: 1024,
680680 Tools: []anthropic.ToolUnionParam{{
681681 OfTool: &anthropic.ToolParam{
from line 740
740740 .build();
741741 
742742 MessageCreateParams createParams = MessageCreateParams.builder()
743 .model(Model.CLAUDE_OPUS_5)
743 .model(Model.CLAUDE_OPUS_5_5)
744744 .maxTokens(1024)
745745 .addTool(weatherTool)
746746 .addUserMessage("Weather in Paris?")
from line 801
801801 
802802 $stream = $client->messages->createStream(
803803 maxTokens: 1024,
804 model: Model::CLAUDE_OPUS_5,
804 model: Model::CLAUDE_OPUS_5_5,
805805 tools: [
806806 [
807807 'name' => 'get_weather',
from line 852
852852 tool_inputs = {} # index -> accumulated JSON string
853853 
854854 stream = client.messages.stream_raw(
855 model: Anthropic::Models::Model::CLAUDE_OPUS_5,
855 model: Anthropic::Models::Model::CLAUDE_OPUS_5_5,
856856 max_tokens: 1024,
857857 tools: [
858858 {

agents-and-tools/tool-use/memory-tool Changed · +16 / -16 lines

from line 118
118118 -H "anthropic-version: 2023-06-01" \
119119 -H "content-type: application/json" \
120120 -d '{
121 "model": "claude-opus-5",
121 "model": "claude-opus-5-5",
122122 "max_tokens": 2048,
123123 "messages": [
124124 {
from line 135
135135 
136136 ```bash CLI
137137 ant messages create <<'YAML'
138 model: claude-opus-5
138 model: claude-opus-5-5
139139 max_tokens: 2048
140140 tools:
141141 - type: memory_20250818
from line 150
150150 client = anthropic.Anthropic()
151151 
152152 message = client.messages.create(
153 model="claude-opus-5",
153 model="claude-opus-5-5",
154154 max_tokens=2048,
155155 messages=[
156156 {
from line 168
168168 const anthropic = new Anthropic();
169169 
170170 const message = await anthropic.messages.create({
171 model: "claude-opus-5",
171 model: "claude-opus-5-5",
172172 max_tokens: 2048,
173173 messages: [
174174 {
from line 188
188188 var message = await client.Messages.Create(
189189 new()
190190 {
191 Model = Model.ClaudeOpus5,
191 Model = Model.ClaudeOpus5_5,
192192 MaxTokens = 2048,
193193 Messages =
194194 [
from line 209
209209 client := anthropic.NewClient()
210210 
211211 message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
212 Model: anthropic.ModelClaudeOpus5,
212 Model: anthropic.ModelClaudeOpus5_5,
213213 MaxTokens: 2048,
214214 Messages: []anthropic.MessageParam{
215215 anthropic.NewUserMessage(anthropic.NewTextBlock("Help me respond to this customer service ticket.")),
from line 230
230230 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
231231 
232232 MessageCreateParams params = MessageCreateParams.builder()
233 .model(Model.CLAUDE_OPUS_5)
233 .model(Model.CLAUDE_OPUS_5_5)
234234 .maxTokens(2048L)
235235 .addTool(MemoryTool20250818.builder().build())
236236 .addUserMessage("Help me respond to this customer service ticket.")
from line 244
244244 $client = new Client();
245245 
246246 $message = $client->messages->create(
247 model: Model::CLAUDE_OPUS_5,
247 model: Model::CLAUDE_OPUS_5_5,
248248 maxTokens: 2048,
249249 messages: [
250250 [
from line 262
262262 client = Anthropic::Client.new
263263 
264264 message = client.messages.create(
265 model: Anthropic::Model::CLAUDE_OPUS_5,
265 model: Anthropic::Model::CLAUDE_OPUS_5_5,
266266 max_tokens: 2048,
267267 messages: [
268268 {
from line 296
296296 memory = BetaLocalFilesystemMemoryTool(base_path="./memory")
297297 
298298 runner = client.beta.messages.tool_runner(
299 model="claude-opus-5",
299 model="claude-opus-5-5",
300300 max_tokens=1024,
301301 messages=[
302302 {
from line 322
322322 const memory = betaMemoryTool(backend); // or pass your own handlers object
323323 
324324 const runner = client.beta.messages.toolRunner({
325 model: "claude-opus-5",
325 model: "claude-opus-5-5",
326326 max_tokens: 1024,
327327 messages: [
328328 {
from line 351
351351 var runner = client.Beta.Messages.ToolRunner(
352352 new MessageCreateParams
353353 {
354 Model = Anthropic.Models.Messages.Model.ClaudeOpus5,
354 Model = Anthropic.Models.Messages.Model.ClaudeOpus5_5,
355355 MaxTokens = 1024,
356356 Messages =
357357 [
from line 476
476476 
477477 for {
478478 message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
479 Model: anthropic.ModelClaudeOpus5,
479 Model: anthropic.ModelClaudeOpus5_5,
480480 MaxTokens: 1024,
481481 Messages: messages,
482482 Tools: tools,
from line 522
522522 BetaMemoryToolHandler handler = new FileSystemMemoryToolHandler(Path.of("memories"));
523523 
524524 MessageCreateParams createParams = MessageCreateParams.builder()
525 .model(Model.CLAUDE_OPUS_5)
525 .model(Model.CLAUDE_OPUS_5_5)
526526 .maxTokens(1024L)
527527 .addTool(BetaMemoryTool20250818.builder().build())
528528 .addUserMessage("Remember that customer Acme Corp prefers email follow-ups.")
from line 622
622622 $runner = $client->beta->messages->toolRunner(
623623 maxTokens: 1024,
624624 messages: [['role' => 'user', 'content' => 'Remember that customer Acme Corp prefers email follow-ups.']],
625 model: Model::CLAUDE_OPUS_5,
625 model: Model::CLAUDE_OPUS_5_5,
626626 tools: [$memory],
627627 maxIterations: 10,
628628 );
from line 692
692692 messages = [{role: "user", content: "Remember that customer Acme Corp prefers email follow-ups."}]
693693 loop do
694694 message = client.messages.create(
695 model: Anthropic::Model::CLAUDE_OPUS_5,
695 model: Anthropic::Model::CLAUDE_OPUS_5_5,
696696 max_tokens: 1024,
697697 messages: messages,
698698 tools: TOOLS

agents-and-tools/tool-use/overview Changed · +27 / -26 lines

from line 15
1515 -H "anthropic-version: 2023-06-01" \
1616 -H "content-type: application/json" \
1717 -d '{
18 "model": "claude-opus-5",
18 "model": "claude-opus-5-5",
1919 "max_tokens": 1024,
2020 "tools": [{"type": "web_search_20260209", "name": "web_search"}],
2121 "messages": [{"role": "user", "content": "What'\''s the latest on the Mars rover?"}]
from line 24
2424 
2525 ```bash CLI
2626 ant messages create --transform content --format yaml \
27 --model claude-opus-5 \
27 --model claude-opus-5-5 \
2828 --max-tokens 1024 \
2929 --tool '{type: web_search_20260209, name: web_search}' \
3030 --message '{role: user, content: "What is the latest on the Mars rover?"}'
from line 33
3333 ```python Python
3434 client = anthropic.Anthropic()
3535 response = client.messages.create(
36 model="claude-opus-5",
36 model="claude-opus-5-5",
3737 max_tokens=1024,
3838 tools=[{"type": "web_search_20260209", "name": "web_search"}],
3939 messages=[{"role": "user", "content": "What's the latest on the Mars rover?"}],
from line 44
4444 ```typescript TypeScript
4545 const client = new Anthropic();
4646 const response = await client.messages.create({
47 model: "claude-opus-5",
47 model: "claude-opus-5-5",
4848 max_tokens: 1024,
4949 tools: [{ type: "web_search_20260209", name: "web_search" }],
5050 messages: [{ role: "user", content: "What's the latest on the Mars rover?" }]
from line 57
5757 
5858 var parameters = new MessageCreateParams
5959 {
60 Model = Model.ClaudeOpus5,
60 Model = Model.ClaudeOpus5_5,
6161 MaxTokens = 1024,
6262 Tools = [new ToolUnion(new WebSearchTool20260209())],
6363 Messages = [new() { Role = Role.User, Content = "What's the latest on the Mars rover?" }]
from line 71
7171 client := anthropic.NewClient()
7272 
7373 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
74 Model: anthropic.ModelClaudeOpus5,
74 Model: anthropic.ModelClaudeOpus5_5,
7575 MaxTokens: 1024,
7676 Tools: []anthropic.ToolUnionParam{
7777 {OfWebSearchTool20260209: &anthropic.WebSearchTool20260209Param{}},
from line 93
9393 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
9494 
9595 MessageCreateParams params = MessageCreateParams.builder()
96 .model(Model.CLAUDE_OPUS_5)
96 .model(Model.CLAUDE_OPUS_5_5)
9797 .maxTokens(1024L)
9898 .addTool(WebSearchTool20260209.builder().build())
9999 .addUserMessage("What's the latest on the Mars rover?")
from line 108
108108 $client = new Client();
109109 
110110 $message = $client->messages->create(
111 model: 'claude-opus-5',
111 model: 'claude-opus-5-5',
112112 maxTokens: 1024,
113113 tools: [
114114 ['type' => 'web_search_20260209', 'name' => 'web_search'],
from line 125
125125 client = Anthropic::Client.new
126126 
127127 message = client.messages.create(
128 model: "claude-opus-5",
128 model: "claude-opus-5-5",
129129 max_tokens: 1024,
130130 tools: [{ type: "web_search_20260209", name: "web_search" }],
131131 messages: [{ role: "user", content: "What's the latest on the Mars rover?" }]
from line 164
164164 -H "anthropic-version: 2023-06-01" \
165165 -H "content-type: application/json" \
166166 -d "$(jq -n --argjson tools "$TOOLS" --arg msg "$USER_MSG" '{
167 model: "claude-opus-5",
167 model: "claude-opus-5-5",
168168 max_tokens: 1024,
169169 tools: $tools,
170170 # Ask for at most one tool call per turn.
from line 188
188188 --arg tool_use_id "$(echo "$TOOL_USE" | jq -r '.id')" \
189189 --arg weather "$WEATHER" \
190190 '{
191 model: "claude-opus-5",
191 model: "claude-opus-5-5",
192192 max_tokens: 1024,
193193 tools: $tools,
194194 tool_choice: {type: "auto", disable_parallel_tool_use: true},
from line 210
210210 call_api() {
211211 {
212212 cat <<'YAML'
213 model: claude-opus-5
213 model: claude-opus-5-5
214214 max_tokens: 1024
215215 # Ask for at most one tool call per turn.
216216 tool_choice: {type: auto, disable_parallel_tool_use: true}
from line 272
272272 
273273 # Claude replies with a tool_use block naming the tool and its arguments.
274274 response = client.messages.create(
275 model="claude-opus-5",
275 model="claude-opus-5-5",
276276 max_tokens=1024,
277277 tools=tools,
278278 # Ask for at most one tool call per turn.
from line 294
294294 },
295295 ]
296296 followup = client.messages.create(
297 model="claude-opus-5",
297 model="claude-opus-5-5",
298298 max_tokens=1024,
299299 tools=tools,
300300 tool_choice={"type": "auto", "disable_parallel_tool_use": True},
from line 328
328328 
329329 // Claude replies with a tool_use block naming the tool and its arguments.
330330 const response = await client.messages.create({
331 model: "claude-opus-5",
331 model: "claude-opus-5-5",
332332 max_tokens: 1024,
333333 tools,
334334 // Ask for at most one tool call per turn.
from line 350
350350 }
351351 );
352352 const followup = await client.messages.create({
353 model: "claude-opus-5",
353 model: "claude-opus-5-5",
354354 max_tokens: 1024,
355355 tools,
356356 tool_choice: { type: "auto", disable_parallel_tool_use: true },
from line 396
396396 // Claude replies with a tool_use block naming the tool and its arguments.
397397 var response = await client.Messages.Create(new MessageCreateParams
398398 {
399 Model = Model.ClaudeOpus5,
399 Model = Model.ClaudeOpus5_5,
400400 MaxTokens = 1024,
401401 Tools = tools,
402402 ToolChoice = toolChoice,
from line 425
425425 ];
426426 var followup = await client.Messages.Create(new MessageCreateParams
427427 {
428 Model = Model.ClaudeOpus5,
428 Model = Model.ClaudeOpus5_5,
429429 MaxTokens = 1024,
430430 Tools = tools,
431431 ToolChoice = toolChoice,
from line 476
476476 
477477 // Claude replies with a tool_use block naming the tool and its arguments.
478478 response, err := client.Messages.New(ctx, anthropic.MessageNewParams{
479 Model: anthropic.ModelClaudeOpus5,
479 Model: anthropic.ModelClaudeOpus5_5,
480480 MaxTokens: 1024,
481481 Tools: tools,
482482 ToolChoice: toolChoice,
from line 505
505505 anthropic.NewUserMessage(anthropic.NewToolResultBlock(toolUse.ID, weather, false)),
506506 )
507507 followup, err := client.Messages.New(ctx, anthropic.MessageNewParams{
508 Model: anthropic.ModelClaudeOpus5,
508 Model: anthropic.ModelClaudeOpus5_5,
509509 MaxTokens: 1024,
510510 Tools: tools,
511511 ToolChoice: toolChoice,
from line 560
560560 
561561 // Claude replies with a tool_use block naming the tool and its arguments.
562562 Message response = client.messages().create(MessageCreateParams.builder()
563 .model(Model.CLAUDE_OPUS_5)
563 .model(Model.CLAUDE_OPUS_5_5)
564564 .maxTokens(1024L)
565565 .addTool(weatherTool)
566566 .toolChoice(toolChoice)
from line 575
575575 // Run the tool, then send the result back in a tool_result block.
576576 String weather = "15 degrees Celsius, partly cloudy";
577577 Message followup = client.messages().create(MessageCreateParams.builder()
578 .model(Model.CLAUDE_OPUS_5)
578 .model(Model.CLAUDE_OPUS_5_5)
579579 .maxTokens(1024L)
580580 .addTool(weatherTool)
581581 .toolChoice(toolChoice)
from line 623
623623 
624624 // Claude replies with a tool_use block naming the tool and its arguments.
625625 $response = $client->messages->create(
626 model: 'claude-opus-5',
626 model: 'claude-opus-5-5',
627627 maxTokens: 1024,
628628 tools: $tools,
629629 toolChoice: $toolChoice,
from line 641
641641 // Run the tool, then send the result back in a tool_result block.
642642 $weather = '15 degrees Celsius, partly cloudy';
643643 $followup = $client->messages->create(
644 model: 'claude-opus-5',
644 model: 'claude-opus-5-5',
645645 maxTokens: 1024,
646646 tools: $tools,
647647 toolChoice: $toolChoice,
from line 689
689689 
690690 # Claude replies with a tool_use block naming the tool and its arguments.
691691 response = client.messages.create(
692 model: "claude-opus-5",
692 model: "claude-opus-5-5",
693693 max_tokens: 1024,
694694 tools: tools,
695695 # Ask for at most one tool call per turn.
from line 711
711711 }
712712 ]
713713 followup = client.messages.create(
714 model: "claude-opus-5",
714 model: "claude-opus-5-5",
715715 max_tokens: 1024,
716716 tools: tools,
717717 tool_choice: {type: "auto", disable_parallel_tool_use: true},
from line 866
866866 
867867| Model | Tool choice | Tool use system prompt token count |
868868| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ---------------------------------- |
869| Claude Opus 5.5 | `auto`, `none` | 286 tokens |
869870| Claude Opus 5 | `auto`, `none`***`any`, `tool` | 286 tokens***406 tokens |
870871| Claude Opus 4.8 | `auto`, `none`***`any`, `tool` | 290 tokens***410 tokens |
871872| Claude Opus 4.7 | `auto`, `none`***`any`, `tool` | 675 tokens***804 tokens |

agents-and-tools/tool-use/parallel-tool-use Changed · +24 / -24 lines

from line 91
9191 # Make initial request
9292 print("Requesting parallel tool calls...")
9393 response = client.messages.create(
94 model="claude-opus-5", max_tokens=1024, messages=messages, tools=tools
94 model="claude-opus-5-5", max_tokens=1024, messages=messages, tools=tools
9595 )
9696 
9797 # Check for parallel tool calls
from line 134
134134 # Get final response
135135 print("\nGetting final response...")
136136 final_response = client.messages.create(
137 model="claude-opus-5", max_tokens=1024, messages=messages, tools=tools
137 model="claude-opus-5-5", max_tokens=1024, messages=messages, tools=tools
138138 )
139139 
140140 final_text = next(
from line 187
187187 // Make initial request
188188 console.log("Requesting parallel tool calls...");
189189 const response = await client.messages.create({
190 model: "claude-opus-5",
190 model: "claude-opus-5-5",
191191 max_tokens: 1024,
192192 messages: [
193193 {
from line 237
237237 // Get final response with correct formatting
238238 console.log("\nGetting final response...");
239239 const finalResponse = await client.messages.create({
240 model: "claude-opus-5",
240 model: "claude-opus-5-5",
241241 max_tokens: 1024,
242242 messages: [
243243 {
from line 299
299299 Console.WriteLine("Requesting parallel tool calls...");
300300 var parameters = new MessageCreateParams
301301 {
302 Model = Model.ClaudeOpus5,
302 Model = Model.ClaudeOpus5_5,
303303 MaxTokens = 1024,
304304 Messages = [new() { Role = Role.User, Content = "What's the weather in SF and NYC, and what time is it there?" }],
305305 Tools = tools
from line 357
357357 Console.WriteLine("\nGetting final response...");
358358 var finalParameters = new MessageCreateParams
359359 {
360 Model = Model.ClaudeOpus5,
360 Model = Model.ClaudeOpus5_5,
361361 MaxTokens = 1024,
362362 Messages = [
363363 new() { Role = Role.User, Content = "What's the weather in SF and NYC, and what time is it there?" },
from line 411
411411 
412412 fmt.Println("Requesting parallel tool calls...")
413413 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
414 Model: anthropic.ModelClaudeOpus5,
414 Model: anthropic.ModelClaudeOpus5_5,
415415 MaxTokens: 1024,
416416 Messages: []anthropic.MessageParam{
417417 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in SF and NYC, and what time is it there?")),
from line 476
476476 
477477 fmt.Println("\nGetting final response...")
478478 finalResponse, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
479 Model: anthropic.ModelClaudeOpus5,
479 Model: anthropic.ModelClaudeOpus5_5,
480480 MaxTokens: 1024,
481481 Messages: []anthropic.MessageParam{
482482 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in SF and NYC, and what time is it there?")),
from line 537
537537 .build();
538538 
539539 MessageCreateParams params = MessageCreateParams.builder()
540 .model(Model.CLAUDE_OPUS_5)
540 .model(Model.CLAUDE_OPUS_5_5)
541541 .maxTokens(1024L)
542542 .addTool(weatherTool)
543543 .addTool(timeTool)
from line 589
589589 
590590 IO.println("\nGetting final response...");
591591 MessageCreateParams finalParams = MessageCreateParams.builder()
592 .model(Model.CLAUDE_OPUS_5)
592 .model(Model.CLAUDE_OPUS_5_5)
593593 .maxTokens(1024L)
594594 .addTool(weatherTool)
595595 .addTool(timeTool)
from line 649
649649 messages: [
650650 ['role' => 'user', 'content' => "What's the weather in SF and NYC, and what time is it there?"]
651651 ],
652 model: 'claude-opus-5',
652 model: 'claude-opus-5-5',
653653 tools: $tools,
654654 );
655655 
from line 692
692692 ['role' => 'assistant', 'content' => $response->content],
693693 ['role' => 'user', 'content' => $toolResults]
694694 ],
695 model: 'claude-opus-5',
695 model: 'claude-opus-5-5',
696696 tools: $tools,
697697 );
698698 
from line 741
741741 
742742 puts "Requesting parallel tool calls..."
743743 response = client.messages.create(
744 model: "claude-opus-5",
744 model: "claude-opus-5-5",
745745 max_tokens: 1024,
746746 messages: [
747747 { role: "user", content: "What's the weather in SF and NYC, and what time is it there?" }
from line 779
779779 
780780 puts "\nGetting final response..."
781781 final_response = client.messages.create(
782 model: "claude-opus-5",
782 model: "claude-opus-5-5",
783783 max_tokens: 1024,
784784 messages: [
785785 { role: "user", content: "What's the weather in SF and NYC, and what time is it there?" },
from line 859
859859 -H "x-api-key: $ANTHROPIC_API_KEY" \
860860 -H "anthropic-version: 2023-06-01" \
861861 -d '{
862 "model": "claude-opus-5",
862 "model": "claude-opus-5-5",
863863 "max_tokens": 1024,
864864 "tools": [{
865865 "name": "get_weather",
from line 884
884884 
885885 ```bash CLI
886886 ant messages create <<'YAML'
887 model: claude-opus-5
887 model: claude-opus-5-5
888888 max_tokens: 1024
889889 tools:
890890 - name: get_weather
from line 909
909909 client = Anthropic()
910910 
911911 response = client.messages.create(
912 model="claude-opus-5",
912 model="claude-opus-5-5",
913913 max_tokens=1024,
914914 tools=[
915915 {
from line 942
942942 const client = new Anthropic();
943943 
944944 const response = await client.messages.create({
945 model: "claude-opus-5",
945 model: "claude-opus-5-5",
946946 max_tokens: 1024,
947947 tools: [
948948 {
from line 971
971971 
972972 var parameters = new MessageCreateParams
973973 {
974 Model = Model.ClaudeOpus5,
974 Model = Model.ClaudeOpus5_5,
975975 MaxTokens = 1024,
976976 Tools = [
977977 new ToolUnion(new Tool()
from line 1000
10001000 client := anthropic.NewClient()
10011001 
10021002 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
1003 Model: anthropic.ModelClaudeOpus5,
1003 Model: anthropic.ModelClaudeOpus5_5,
10041004 MaxTokens: 1024,
10051005 Tools: []anthropic.ToolUnionParam{
10061006 {OfTool: &anthropic.ToolParam{
from line 1050
10501050 .build();
10511051 
10521052 MessageCreateParams params = MessageCreateParams.builder()
1053 .model(Model.CLAUDE_OPUS_5)
1053 .model(Model.CLAUDE_OPUS_5_5)
10541054 .maxTokens(1024L)
10551055 .addTool(
10561056 Tool.builder()
from line 1075
10751075 messages: [
10761076 ['role' => 'user', 'content' => 'What is the weather in San Francisco and New York?']
10771077 ],
1078 model: 'claude-opus-5',
1078 model: 'claude-opus-5-5',
10791079 toolChoice: ['type' => 'auto', 'disableParallelToolUse' => true],
10801080 tools: [
10811081 [
from line 1102
11021102 client = Anthropic::Client.new
11031103 
11041104 response = client.messages.create(
1105 model: "claude-opus-5",
1105 model: "claude-opus-5-5",
11061106 max_tokens: 1024,
11071107 tools: [
11081108 {
from line 1131
11311131 
11321132### Exactly one tool call
11331133 
1134When `tool_choice` type is `any` or `tool`, setting `disable_parallel_tool_use: true` means Claude calls exactly one tool. Claude Fable 5.1 and Claude Mythos 5.1 don't support these `tool_choice` types (see [Forcing tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use)). The following example uses `any`. The same field works with `tool`:
1134When `tool_choice` type is `any` or `tool`, setting `disable_parallel_tool_use: true` means Claude calls exactly one tool. Claude Opus 5.5, Claude Fable 5.1, and Claude Mythos 5.1 don't support these `tool_choice` types (see [Forcing tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use)). The following example uses `any`. The same field works with `tool`:
11351135 
11361136<CodeGroup>
11371137 ```bash cURL

agents-and-tools/tool-use/programmatic-tool-calling Changed · +19 / -18 lines

from line 10
1010 - claude-mythos-5-1
1111 - claude-fable-5
1212 - claude-mythos-5
13 - claude-opus-5-5
1314 - claude-opus-5
1415 - claude-opus-4-8
1516 - claude-opus-4-7
from line 53
5253 --header "anthropic-version: 2023-06-01" \
5354 --header "content-type: application/json" \
5455 --data '{
55 "model": "claude-opus-5",
56 "model": "claude-opus-5-5",
5657 "max_tokens": 4096,
5758 "messages": [
5859 {
from line 87
8687 
8788 ```bash CLI
8889 ant messages create <<'YAML'
89 model: claude-opus-5
90 model: claude-opus-5-5
9091 max_tokens: 4096
9192 messages:
9293 - role: user
from line 118
117118 client = anthropic.Anthropic()
118119 
119120 response = client.messages.create(
120 model="claude-opus-5",
121 model="claude-opus-5-5",
121122 max_tokens=4096,
122123 messages=[
123124 {
from line 150
149150 const client = new Anthropic();
150151 
151152 const response = await client.messages.create({
152 model: "claude-opus-5",
153 model: "claude-opus-5-5",
153154 max_tokens: 4096,
154155 messages: [
155156 {
from line 191
190191 
191192 var parameters = new MessageCreateParams
192193 {
193 Model = Model.ClaudeOpus5,
194 Model = Model.ClaudeOpus5_5,
194195 MaxTokens = 4096,
195196 Messages = [
196197 new() {
from line 226
225226 client := anthropic.NewClient()
226227 
227228 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
228 Model: anthropic.ModelClaudeOpus5,
229 Model: anthropic.ModelClaudeOpus5_5,
229230 MaxTokens: 4096,
230231 Messages: []anthropic.MessageParam{
231232 anthropic.NewUserMessage(anthropic.NewTextBlock("Query sales data for the West, East, and Central regions, then tell me which region had the highest revenue")),
from line 263
262263 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
263264 
264265 MessageCreateParams params = MessageCreateParams.builder()
265 .model(Model.CLAUDE_OPUS_5)
266 .model(Model.CLAUDE_OPUS_5_5)
266267 .maxTokens(4096L)
267268 .addUserMessage("Query sales data for the West, East, and Central regions, then tell me which region had the highest revenue")
268269 .addTool(CodeExecutionTool20260120.builder().build())
from line 296
295296 messages: [
296297 ['role' => 'user', 'content' => 'Query sales data for the West, East, and Central regions, then tell me which region had the highest revenue'],
297298 ],
298 model: 'claude-opus-5',
299 model: 'claude-opus-5-5',
299300 tools: [
300301 [
301302 'type' => 'code_execution_20260120',
from line 327
326327 client = Anthropic::Client.new
327328 
328329 message = client.messages.create(
329 model: "claude-opus-5",
330 model: "claude-opus-5-5",
330331 max_tokens: 4096,
331332 messages: [
332333 {
from line 531
530531 --header "anthropic-version: 2023-06-01" \
531532 --header "content-type: application/json" \
532533 --data '{
533 "model": "claude-opus-5",
534 "model": "claude-opus-5-5",
534535 "max_tokens": 4096,
535536 "container": "container_xyz789",
536537 "messages": [
from line 601
600601 
601602 ```bash CLI
602603 ant messages create <<'YAML'
603 model: claude-opus-5
604 model: claude-opus-5-5
604605 max_tokens: 4096
605606 container: container_xyz789
606607 messages:
from line 656
655656 
656657 ```python Python
657658 response = client.messages.create(
658 model="claude-opus-5",
659 model="claude-opus-5-5",
659660 max_tokens=4096,
660661 container="container_xyz789", # Reuse the container
661662 messages=[
from line 723
722723 
723724 ```typescript TypeScript
724725 const response = await client.messages.create({
725 model: "claude-opus-5",
726 model: "claude-opus-5-5",
726727 max_tokens: 4096,
727728 container: "container_xyz789", // Reuse the container
728729 messages: [
from line 799
798799 
799800 var parameters = new MessageCreateParams
800801 {
801 Model = Model.ClaudeOpus5,
802 Model = Model.ClaudeOpus5_5,
802803 MaxTokens = 4096,
803804 Container = "container_xyz789",
804805 Messages =
from line 875
874875 client := anthropic.NewClient()
875876 
876877 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
877 Model: anthropic.ModelClaudeOpus5,
878 Model: anthropic.ModelClaudeOpus5_5,
878879 MaxTokens: 4096,
879880 Container: anthropic.MessageCreateParamsContainerUnion{
880881 OfString: anthropic.String("container_xyz789"),
from line 950
949950 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
950951 
951952 MessageCreateParams params = MessageCreateParams.builder()
952 .model(Model.CLAUDE_OPUS_5)
953 .model(Model.CLAUDE_OPUS_5_5)
953954 .maxTokens(4096L)
954955 .container("container_xyz789")
955956 .addUserMessage("Query customer purchase history from the last quarter and identify our top 5 customers by revenue")
from line 1049
10481049 ],
10491050 ],
10501051 ],
1051 model: 'claude-opus-5',
1052 model: 'claude-opus-5-5',
10521053 container: 'container_xyz789',
10531054 // Same tools array as the original request
10541055 tools: [
from line 1084
10831084 client = Anthropic::Client.new
10841085 
10851086 message = client.messages.create(
1086 model: "claude-opus-5",
1087 model: "claude-opus-5-5",
10871088 max_tokens: 4096,
10881089 container: "container_xyz789",
10891090 messages: [

agents-and-tools/tool-use/server-tools Changed · +16 / -16 lines

from line 36
3636 -H "anthropic-version: 2023-06-01" \
3737 -H "content-type: application/json" \
3838 -d '{
39 "model": "claude-opus-5",
39 "model": "claude-opus-5-5",
4040 "max_tokens": 1024,
4141 "messages": [
4242 {
from line 52
5252 # Initial request. If "stop_reason" in the output is "pause_turn", re-run with
5353 # the assistant content appended to messages (see the SDK tabs).
5454 ant messages create <<'YAML'
55 model: claude-opus-5
55 model: claude-opus-5-5
5656 max_tokens: 1024
5757 tools:
5858 - {type: web_search_20250305, name: web_search, max_uses: 10}
from line 66
6666 
6767 # Initial request with web search
6868 response = client.messages.create(
69 model="claude-opus-5",
69 model="claude-opus-5-5",
7070 max_tokens=1024,
7171 messages=[
7272 {
from line 90
9090 
9191 # Send the continuation request
9292 continuation = client.messages.create(
93 model="claude-opus-5",
93 model="claude-opus-5-5",
9494 max_tokens=1024,
9595 messages=messages,
9696 tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}],
from line 106
106106 
107107 // Initial request with web search
108108 const response = await client.messages.create({
109 model: "claude-opus-5",
109 model: "claude-opus-5-5",
110110 max_tokens: 1024,
111111 messages: [
112112 {
from line 138
138138 
139139 // Send the continuation request
140140 const continuation = await client.messages.create({
141 model: "claude-opus-5",
141 model: "claude-opus-5-5",
142142 max_tokens: 1024,
143143 messages,
144144 tools: [
from line 161
161161 
162162 var parameters = new MessageCreateParams
163163 {
164 Model = Model.ClaudeOpus5,
164 Model = Model.ClaudeOpus5_5,
165165 MaxTokens = 1024,
166166 Messages = [
167167 new() {
from line 179
179179 // Continue the conversation with the paused content
180180 var continuationParams = new MessageCreateParams
181181 {
182 Model = Model.ClaudeOpus5,
182 Model = Model.ClaudeOpus5_5,
183183 MaxTokens = 1024,
184184 Messages = [
185185 new() {
from line 213
213213 }
214214 
215215 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
216 Model: anthropic.ModelClaudeOpus5,
216 Model: anthropic.ModelClaudeOpus5_5,
217217 MaxTokens: 1024,
218218 Messages: []anthropic.MessageParam{
219219 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for comprehensive information about quantum computing breakthroughs in 2025")),
from line 227
227227 if response.StopReason == anthropic.StopReasonPauseTurn {
228228 // Pass the paused response back as-is so Claude can continue the turn
229229 continuation, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
230 Model: anthropic.ModelClaudeOpus5,
230 Model: anthropic.ModelClaudeOpus5_5,
231231 MaxTokens: 1024,
232232 Messages: []anthropic.MessageParam{
233233 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for comprehensive information about quantum computing breakthroughs in 2025")),
from line 252
252252 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
253253 
254254 MessageCreateParams params = MessageCreateParams.builder()
255 .model(Model.CLAUDE_OPUS_5)
255 .model(Model.CLAUDE_OPUS_5_5)
256256 .maxTokens(1024L)
257257 .addUserMessage("Search for comprehensive information about quantum computing breakthroughs in 2025")
258258 .addTool(WebSearchTool20250305.builder()
from line 265
265265 if (response.stopReason().isPresent()
266266 && response.stopReason().get().equals(StopReason.PAUSE_TURN)) {
267267 MessageCreateParams continuationParams = MessageCreateParams.builder()
268 .model(Model.CLAUDE_OPUS_5)
268 .model(Model.CLAUDE_OPUS_5_5)
269269 .maxTokens(1024L)
270270 .addUserMessage("Search for comprehensive information about quantum computing breakthroughs in 2025")
271271 .addMessage(response)
from line 293
293293 'content' => 'Search for comprehensive information about quantum computing breakthroughs in 2025'
294294 ]
295295 ],
296 model: 'claude-opus-5',
296 model: 'claude-opus-5-5',
297297 tools: [
298298 [
299299 'type' => 'web_search_20250305',
from line 318
318318 $continuation = $client->messages->create(
319319 maxTokens: 1024,
320320 messages: $messages,
321 model: 'claude-opus-5',
321 model: 'claude-opus-5-5',
322322 tools: [
323323 [
324324 'type' => 'web_search_20250305',
from line 338
338338 client = Anthropic::Client.new
339339 
340340 response = client.messages.create(
341 model: "claude-opus-5",
341 model: "claude-opus-5-5",
342342 max_tokens: 1024,
343343 messages: [
344344 {
from line 369
369369 ]
370370 
371371 continuation = client.messages.create(
372 model: "claude-opus-5",
372 model: "claude-opus-5-5",
373373 max_tokens: 1024,
374374 messages: messages,
375375 tools: [

agents-and-tools/tool-use/strict-tool-use Changed · +27 / -27 lines

from line 34
3434 -H "x-api-key: $ANTHROPIC_API_KEY" \
3535 -H "anthropic-version: 2023-06-01" \
3636 -d '{
37 "model": "claude-opus-5",
37 "model": "claude-opus-5-5",
3838 "max_tokens": 1024,
3939 "messages": [
4040 {"role": "user", "content": "What is the weather in San Francisco?"}
from line 64
6464 
6565 ```bash CLI
6666 ant messages create --transform content <<'YAML'
67 model: claude-opus-5
67 model: claude-opus-5-5
6868 max_tokens: 1024
6969 messages:
7070 - role: user
from line 91
9191 client = anthropic.Anthropic()
9292 
9393 response = client.messages.create(
94 model="claude-opus-5",
94 model="claude-opus-5-5",
9595 max_tokens=1024,
9696 messages=[{"role": "user", "content": "What's the weather like in San Francisco?"}],
9797 tools=[
from line 127
127127 });
128128 
129129 const response = await client.messages.create({
130 model: "claude-opus-5",
130 model: "claude-opus-5-5",
131131 max_tokens: 1024,
132132 messages: [
133133 {
from line 170
170170 
171171 var parameters = new MessageCreateParams
172172 {
173 Model = Model.ClaudeOpus5,
173 Model = Model.ClaudeOpus5_5,
174174 MaxTokens = 1024,
175175 Messages = [new() { Role = Role.User, Content = "What's the weather like in San Francisco?" }],
176176 Tools = [
from line 201
201201 client := anthropic.NewClient()
202202 
203203 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
204 Model: anthropic.ModelClaudeOpus5,
204 Model: anthropic.ModelClaudeOpus5_5,
205205 MaxTokens: 1024,
206206 Messages: []anthropic.MessageParam{
207207 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather like in San Francisco?")),
from line 258
258258 .build();
259259 
260260 MessageCreateParams params = MessageCreateParams.builder()
261 .model(Model.CLAUDE_OPUS_5)
261 .model(Model.CLAUDE_OPUS_5_5)
262262 .maxTokens(1024L)
263263 .addUserMessage("What's the weather like in San Francisco?")
264264 .addTool(
from line 283
283283 messages: [
284284 ['role' => 'user', 'content' => "What's the weather like in San Francisco?"]
285285 ],
286 model: 'claude-opus-5',
286 model: 'claude-opus-5-5',
287287 tools: [
288288 [
289289 'name' => 'get_weather',
from line 315
315315 client = Anthropic::Client.new
316316 
317317 message = client.messages.create(
318 model: "claude-opus-5",
318 model: "claude-opus-5-5",
319319 max_tokens: 1024,
320320 messages: [
321321 { role: "user", content: "What's the weather like in San Francisco?" }
from line 395
395395 -H "x-api-key: $ANTHROPIC_API_KEY" \
396396 -H "anthropic-version: 2023-06-01" \
397397 -d '{
398 "model": "claude-opus-5",
398 "model": "claude-opus-5-5",
399399 "max_tokens": 1024,
400400 "messages": [
401401 {"role": "user", "content": "Search for flights to Tokyo departing June 1, 2026"}
from line 419
419419 
420420 ```bash CLI
421421 ant messages create <<'YAML'
422 model: claude-opus-5
422 model: claude-opus-5-5
423423 max_tokens: 1024
424424 messages:
425425 - role: user
from line 446
446446 ```python Python
447447 client = Anthropic()
448448 response = client.messages.create(
449 model="claude-opus-5",
449 model="claude-opus-5-5",
450450 max_tokens=1024,
451451 messages=[
452452 {
from line 497
497497 };
498498 
499499 const response = await client.messages.create({
500 model: "claude-opus-5",
500 model: "claude-opus-5-5",
501501 max_tokens: 1024,
502502 messages: [{ role: "user", content: "Search for flights to Tokyo departing June 1, 2026" }],
503503 tools: [searchFlightsTool]
from line 515
515515 
516516 var parameters = new MessageCreateParams
517517 {
518 Model = Model.ClaudeOpus5,
518 Model = Model.ClaudeOpus5_5,
519519 MaxTokens = 1024,
520520 Messages = [new() { Role = Role.User, Content = "Search for flights to Tokyo departing June 1, 2026" }],
521521 Tools = [
from line 546
546546 client := anthropic.NewClient()
547547 
548548 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
549 Model: anthropic.ModelClaudeOpus5,
549 Model: anthropic.ModelClaudeOpus5_5,
550550 MaxTokens: 1024,
551551 Messages: []anthropic.MessageParam{
552552 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for flights to Tokyo departing June 1, 2026")),
from line 603
603603 .build();
604604 
605605 MessageCreateParams params = MessageCreateParams.builder()
606 .model(Model.CLAUDE_OPUS_5)
606 .model(Model.CLAUDE_OPUS_5_5)
607607 .maxTokens(1024L)
608608 .addUserMessage("Search for flights to Tokyo departing June 1, 2026")
609609 .addTool(
from line 627
627627 messages: [
628628 ['role' => 'user', 'content' => 'Search for flights to Tokyo departing June 1, 2026']
629629 ],
630 model: 'claude-opus-5',
630 model: 'claude-opus-5-5',
631631 tools: [
632632 [
633633 'name' => 'search_flights',
from line 656
656656 client = Anthropic::Client.new
657657 
658658 message = client.messages.create(
659 model: "claude-opus-5",
659 model: "claude-opus-5-5",
660660 max_tokens: 1024,
661661 messages: [
662662 { role: "user", content: "Search for flights to Tokyo departing June 1, 2026" }
from line 696
696696 -H "x-api-key: $ANTHROPIC_API_KEY" \
697697 -H "anthropic-version: 2023-06-01" \
698698 -d '{
699 "model": "claude-opus-5",
699 "model": "claude-opus-5-5",
700700 "max_tokens": 1024,
701701 "messages": [
702702 {"role": "user", "content": "Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026"}
from line 737
737737 
738738 ```bash CLI
739739 ant messages create <<'YAML'
740 model: claude-opus-5
740 model: claude-opus-5-5
741741 max_tokens: 1024
742742 messages:
743743 - role: user
from line 772
772772 ```python Python
773773 client = Anthropic()
774774 response = client.messages.create(
775 model="claude-opus-5",
775 model="claude-opus-5-5",
776776 max_tokens=1024,
777777 messages=[
778778 {
from line 852
852852 ];
853853 
854854 const response = await client.messages.create({
855 model: "claude-opus-5",
855 model: "claude-opus-5-5",
856856 max_tokens: 1024,
857857 messages: [
858858 {
from line 876
876876 
877877 var parameters = new MessageCreateParams
878878 {
879 Model = Model.ClaudeOpus5,
879 Model = Model.ClaudeOpus5_5,
880880 MaxTokens = 1024,
881881 Messages = [new() { Role = Role.User, Content = "Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026" }],
882882 Tools = [
from line 924
924924 client := anthropic.NewClient()
925925 
926926 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
927 Model: anthropic.ModelClaudeOpus5,
927 Model: anthropic.ModelClaudeOpus5_5,
928928 MaxTokens: 1024,
929929 Messages: []anthropic.MessageParam{
930930 anthropic.NewUserMessage(anthropic.NewTextBlock("Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026")),
from line 1000
10001000 .build();
10011001 
10021002 MessageCreateParams params = MessageCreateParams.builder()
1003 .model(Model.CLAUDE_OPUS_5)
1003 .model(Model.CLAUDE_OPUS_5_5)
10041004 .maxTokens(1024L)
10051005 .addUserMessage("Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026")
10061006 .addTool(
from line 1031
10311031 messages: [
10321032 ['role' => 'user', 'content' => 'Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026']
10331033 ],
1034 model: 'claude-opus-5',
1034 model: 'claude-opus-5-5',
10351035 tools: [
10361036 [
10371037 'name' => 'search_flights',
from line 1072
10721072 client = Anthropic::Client.new
10731073 
10741074 message = client.messages.create(
1075 model: "claude-opus-5",
1075 model: "claude-opus-5-5",
10761076 max_tokens: 1024,
10771077 messages: [
10781078 { role: "user", content: "Help me plan a trip from New York to Paris for 2 people, departing June 1, 2026" }

agents-and-tools/tool-use/text-editor-tool Changed · +39 / -39 lines

from line 38
3838 -H "x-api-key: $ANTHROPIC_API_KEY" \
3939 -H "anthropic-version: 2023-06-01" \
4040 -d '{
41 "model": "claude-opus-5",
41 "model": "claude-opus-5-5",
4242 "max_tokens": 1024,
4343 "tools": [
4444 {
from line 58
5858 
5959 ```bash CLI
6060 ant messages create \
61 --model claude-opus-5 \
61 --model claude-opus-5-5 \
6262 --max-tokens 1024 \
6363 --tool '{type: text_editor_20250728, name: str_replace_based_edit_tool, max_characters: 10000}' \
6464 --message '{role: user, content: There is a syntax error in my primes.py file. Can you help me fix it?}'
from line 68
6868 client = anthropic.Anthropic()
6969 
7070 response = client.messages.create(
71 model="claude-opus-5",
71 model="claude-opus-5-5",
7272 max_tokens=1024,
7373 tools=[
7474 {
from line 92
9292 const anthropic = new Anthropic();
9393 
9494 const response = await anthropic.messages.create({
95 model: "claude-opus-5",
95 model: "claude-opus-5-5",
9696 max_tokens: 1024,
9797 tools: [
9898 {
from line 118
118118 var response = await client.Messages.Create(
119119 new()
120120 {
121 Model = Model.ClaudeOpus5,
121 Model = Model.ClaudeOpus5_5,
122122 MaxTokens = 1024,
123123 Tools = [new ToolTextEditor20250728 { MaxCharacters = 10000 }],
124124 Messages =
from line 139
139139 client := anthropic.NewClient()
140140 
141141 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
142 Model: anthropic.ModelClaudeOpus5,
142 Model: anthropic.ModelClaudeOpus5_5,
143143 MaxTokens: 1024,
144144 Tools: []anthropic.ToolUnionParam{
145145 {OfTextEditor20250728: &anthropic.ToolTextEditor20250728Param{
from line 168
168168 .build();
169169 
170170 MessageCreateParams params = MessageCreateParams.builder()
171 .model(Model.CLAUDE_OPUS_5)
171 .model(Model.CLAUDE_OPUS_5_5)
172172 .maxTokens(1024)
173173 .addTool(editorTool)
174174 .addUserMessage("There's a syntax error in my primes.py file. Can you help me fix it?")
from line 183
183183 $client = new Client();
184184 
185185 $response = $client->messages->create(
186 model: 'claude-opus-5',
186 model: 'claude-opus-5-5',
187187 maxTokens: 1024,
188188 tools: [ToolTextEditor20250728::with(maxCharacters: 10000)],
189189 messages: [
from line 201
201201 client = Anthropic::Client.new
202202 
203203 response = client.messages.create(
204 model: "claude-opus-5",
204 model: "claude-opus-5-5",
205205 max_tokens: 1024,
206206 tools: [
207207 {
from line 394
394394 -H "x-api-key: $ANTHROPIC_API_KEY" \
395395 -H "anthropic-version: 2023-06-01" \
396396 -d '{
397 "model": "claude-opus-5",
397 "model": "claude-opus-5-5",
398398 "max_tokens": 1024,
399399 "tools": [
400400 {
from line 413
413413 
414414 ```bash CLI
415415 ant messages create \
416 --model claude-opus-5 \
416 --model claude-opus-5-5 \
417417 --max-tokens 1024 \
418418 --tool '{type: text_editor_20250728, name: str_replace_based_edit_tool}' \
419419 --message '{role: user, content: There is a syntax error in my primes.py file. Can you help me fix it?}'
from line 423
423423 client = anthropic.Anthropic()
424424 
425425 response = client.messages.create(
426 model="claude-opus-5",
426 model="claude-opus-5-5",
427427 max_tokens=1024,
428428 tools=[{"type": "text_editor_20250728", "name": "str_replace_based_edit_tool"}],
429429 messages=[
from line 441
441441 const anthropic = new Anthropic();
442442 
443443 const response = await anthropic.messages.create({
444 model: "claude-opus-5",
444 model: "claude-opus-5-5",
445445 max_tokens: 1024,
446446 tools: [
447447 {
from line 466
466466 var response = await client.Messages.Create(
467467 new()
468468 {
469 Model = Model.ClaudeOpus5,
469 Model = Model.ClaudeOpus5_5,
470470 MaxTokens = 1024,
471471 Tools = [new ToolTextEditor20250728()],
472472 Messages =
from line 487
487487 client := anthropic.NewClient()
488488 
489489 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
490 Model: anthropic.ModelClaudeOpus5,
490 Model: anthropic.ModelClaudeOpus5_5,
491491 MaxTokens: 1024,
492492 Tools: []anthropic.ToolUnionParam{
493493 {OfTextEditor20250728: &anthropic.ToolTextEditor20250728Param{}},
from line 512
512512 ToolTextEditor20250728.builder().build();
513513 
514514 MessageCreateParams params = MessageCreateParams.builder()
515 .model(Model.CLAUDE_OPUS_5)
515 .model(Model.CLAUDE_OPUS_5_5)
516516 .maxTokens(1024)
517517 .addTool(editorTool)
518518 .addUserMessage("There's a syntax error in my primes.py file. Can you help me fix it?")
from line 527
527527 $client = new Client();
528528 
529529 $response = $client->messages->create(
530 model: 'claude-opus-5',
530 model: 'claude-opus-5-5',
531531 maxTokens: 1024,
532532 tools: [new ToolTextEditor20250728()],
533533 messages: [
from line 545
545545 client = Anthropic::Client.new
546546 
547547 response = client.messages.create(
548 model: "claude-opus-5",
548 model: "claude-opus-5-5",
549549 max_tokens: 1024,
550550 tools: [{type: "text_editor_20250728", name: "str_replace_based_edit_tool"}],
551551 messages: [
from line 565
565565```json Output
566566{
567567 "id": "msg_01XAbCDeFgHiJkLmNoPQrStU",
568 "model": "claude-opus-5",
568 "model": "claude-opus-5-5",
569569 "stop_reason": "tool_use",
570570 "role": "assistant",
571571 "content": [
from line 595
595595 -H "x-api-key: $ANTHROPIC_API_KEY" \
596596 -H "anthropic-version: 2023-06-01" \
597597 -d '{
598 "model": "claude-opus-5",
598 "model": "claude-opus-5-5",
599599 "max_tokens": 1024,
600600 "tools": [
601601 {
from line 642
642642 
643643 ```bash CLI
644644 ant messages create <<'YAML'
645 model: claude-opus-5
645 model: claude-opus-5-5
646646 max_tokens: 1024
647647 tools:
648648 - type: text_editor_20250728
from line 705
705705 
706706 ```python Python
707707 response = client.messages.create(
708 model="claude-opus-5",
708 model="claude-opus-5-5",
709709 max_tokens=1024,
710710 tools=[{"type": "text_editor_20250728", "name": "str_replace_based_edit_tool"}],
711711 messages=[
from line 748
748748 const anthropic = new Anthropic();
749749 
750750 const response = await anthropic.messages.create({
751 model: "claude-opus-5",
751 model: "claude-opus-5-5",
752752 max_tokens: 1024,
753753 tools: [
754754 {
from line 802
802802 var response = await client.Messages.Create(
803803 new()
804804 {
805 Model = Model.ClaudeOpus5,
805 Model = Model.ClaudeOpus5_5,
806806 MaxTokens = 1024,
807807 Tools = [new ToolTextEditor20250728()],
808808 Messages =
from line 856
856856 client := anthropic.NewClient()
857857 
858858 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
859 Model: anthropic.ModelClaudeOpus5,
859 Model: anthropic.ModelClaudeOpus5_5,
860860 MaxTokens: 1024,
861861 Tools: []anthropic.ToolUnionParam{
862862 {OfTextEditor20250728: &anthropic.ToolTextEditor20250728Param{}},
from line 890
890890 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
891891 
892892 MessageCreateParams params = MessageCreateParams.builder()
893 .model(Model.CLAUDE_OPUS_5)
893 .model(Model.CLAUDE_OPUS_5_5)
894894 .maxTokens(1024)
895895 .addTool(ToolTextEditor20250728.builder().build())
896896 .addUserMessage("There's a syntax error in my primes.py file. Can you help me fix it?")
from line 935
935935 $client = new Client();
936936 
937937 $response = $client->messages->create(
938 model: 'claude-opus-5',
938 model: 'claude-opus-5-5',
939939 maxTokens: 1024,
940940 tools: [new ToolTextEditor20250728()],
941941 messages: [
from line 978
978978 client = Anthropic::Client.new
979979 
980980 response = client.messages.create(
981 model: "claude-opus-5",
981 model: "claude-opus-5-5",
982982 max_tokens: 1024,
983983 tools: [{type: "text_editor_20250728", name: "str_replace_based_edit_tool"}],
984984 messages: [
from line 1029
10291029```json Output
10301030{
10311031 "id": "msg_01VwXyZAbCdEfGhIjKlMnO",
1032 "model": "claude-opus-5",
1032 "model": "claude-opus-5-5",
10331033 "stop_reason": "tool_use",
10341034 "role": "assistant",
10351035 "content": [
from line 1061
10611061 -H "x-api-key: $ANTHROPIC_API_KEY" \
10621062 -H "anthropic-version: 2023-06-01" \
10631063 -d '{
1064 "model": "claude-opus-5",
1064 "model": "claude-opus-5-5",
10651065 "max_tokens": 1024,
10661066 "tools": [
10671067 {
from line 1106
11061106 
11071107 ```bash CLI
11081108 ant messages create <<'YAML'
1109 model: claude-opus-5
1109 model: claude-opus-5-5
11101110 max_tokens: 1024
11111111 tools:
11121112 - type: text_editor_20250728
from line 1138
11381138 
11391139 ```python Python
11401140 response = client.messages.create(
1141 model="claude-opus-5",
1141 model="claude-opus-5-5",
11421142 max_tokens=1024,
11431143 tools=[{"type": "text_editor_20250728", "name": "str_replace_based_edit_tool"}],
11441144 messages=[
from line 1181
11811181 
11821182 ```typescript TypeScript
11831183 const response = await client.messages.create({
1184 model: "claude-opus-5",
1184 model: "claude-opus-5-5",
11851185 max_tokens: 1024,
11861186 tools: [
11871187 {
from line 1233
12331233 var response = await client.Messages.Create(
12341234 new()
12351235 {
1236 Model = Model.ClaudeOpus5,
1236 Model = Model.ClaudeOpus5_5,
12371237 MaxTokens = 1024,
12381238 Tools = [new ToolTextEditor20250728()],
12391239 Messages =
from line 1285
12851285 client := anthropic.NewClient()
12861286 
12871287 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
1288 Model: anthropic.ModelClaudeOpus5,
1288 Model: anthropic.ModelClaudeOpus5_5,
12891289 MaxTokens: 1024,
12901290 Tools: []anthropic.ToolUnionParam{
12911291 {OfTextEditor20250728: &anthropic.ToolTextEditor20250728Param{}},
from line 1324
13241324 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
13251325 
13261326 MessageCreateParams params = MessageCreateParams.builder()
1327 .model(Model.CLAUDE_OPUS_5)
1327 .model(Model.CLAUDE_OPUS_5_5)
13281328 .maxTokens(1024)
13291329 .addTool(ToolTextEditor20250728.builder().build())
13301330 // Previous messages would go here
from line 1379
13791379 $client = new Client();
13801380 
13811381 $response = $client->messages->create(
1382 model: 'claude-opus-5',
1382 model: 'claude-opus-5-5',
13831383 maxTokens: 1024,
13841384 tools: [new ToolTextEditor20250728()],
13851385 messages: [
from line 1424
14241424 client = Anthropic::Client.new
14251425 
14261426 response = client.messages.create(
1427 model: "claude-opus-5",
1427 model: "claude-opus-5-5",
14281428 max_tokens: 1024,
14291429 tools: [{type: "text_editor_20250728", name: "str_replace_based_edit_tool"}],
14301430 messages: [
from line 1471
14711471````json Output
14721472{
14731473 "id": "msg_01IjKlMnOpQrStUvWxYzAb",
1474 "model": "claude-opus-5",
1474 "model": "claude-opus-5-5",
14751475 "stop_reason": "end_turn",
14761476 "role": "assistant",
14771477 "content": [

agents-and-tools/tool-use/tool-runner Changed · +37 / -37 lines

from line 61
6161 
6262 
6363 runner = client.beta.messages.tool_runner(
64 model="claude-opus-5",
64 model="claude-opus-5-5",
6565 max_tokens=1024,
6666 tools=[get_weather, calculate_sum],
6767 messages=[
from line 105
105105 });
106106 
107107 const finalMessage = await client.beta.messages.toolRunner({
108 model: "claude-opus-5",
108 model: "claude-opus-5-5",
109109 max_tokens: 1024,
110110 tools: [getWeatherTool],
111111 messages: [{ role: "user", content: "What's the weather like in Paris?" }]
from line 147
147147 });
148148 
149149 const finalMessage = await client.beta.messages.toolRunner({
150 model: "claude-opus-5",
150 model: "claude-opus-5-5",
151151 max_tokens: 1024,
152152 tools: [calculateSumTool],
153153 messages: [{ role: "user", content: "What's 15 + 27?" }]
from line 231
231231 var runner = client.Beta.Messages.ToolRunner(
232232 new MessageCreateParams
233233 {
234 Model = Model.ClaudeOpus5,
234 Model = Model.ClaudeOpus5_5,
235235 MaxTokens = 1024,
236236 Messages =
237237 [
from line 311
311311 []anthropic.BetaTool{getWeather, calculateSum},
312312 anthropic.BetaToolRunnerParams{
313313 BetaMessageNewParams: anthropic.BetaMessageNewParams{
314 Model: anthropic.ModelClaudeOpus5,
314 Model: anthropic.ModelClaudeOpus5_5,
315315 MaxTokens: 1024,
316316 Messages: []anthropic.BetaMessageParam{
317317 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(
from line 397
397397 BetaToolRunner runner = client.beta()
398398 .messages()
399399 .toolRunner(MessageCreateParams.builder()
400 .model(Model.CLAUDE_OPUS_5)
400 .model(Model.CLAUDE_OPUS_5_5)
401401 .maxTokens(1024)
402402 .addBeta("structured-outputs-2025-11-13")
403403 .addUserMessage("What's the weather like in Paris? Also, what's 15 + 27?")
from line 491
491491 messages: [
492492 ['role' => 'user', 'content' => "What's the weather like in Paris? Also, what's 15 + 27?"],
493493 ],
494 model: Model::CLAUDE_OPUS_5,
494 model: Model::CLAUDE_OPUS_5_5,
495495 tools: [$getWeather, $calculateSum],
496496 );
497497 
from line 553
553553 
554554 # Use the tool runner
555555 runner = client.beta.messages.tool_runner(
556 model: "claude-opus-5",
556 model: "claude-opus-5-5",
557557 max_tokens: 1024,
558558 tools: [GetWeather.new, CalculateSum.new],
559559 messages: [
from line 588
588588 client = anthropic.Anthropic()
589589 # ...
590590 runner = client.beta.messages.tool_runner(
591 model="claude-opus-5",
591 model="claude-opus-5-5",
592592 max_tokens=1024,
593593 tools=[get_weather, calculate_sum],
594594 messages=[
from line 612
612612 const client = new Anthropic();
613613 // ...
614614 const runner = client.beta.messages.toolRunner({
615 model: "claude-opus-5",
615 model: "claude-opus-5-5",
616616 max_tokens: 1024,
617617 tools: [getWeatherTool],
618618 messages: [{ role: "user", content: "What's the weather like in Paris?" }]
from line 636
636636 var runner = client.Beta.Messages.ToolRunner(
637637 new MessageCreateParams
638638 {
639 Model = Model.ClaudeOpus5,
639 Model = Model.ClaudeOpus5_5,
640640 MaxTokens = 1024,
641641 Messages =
642642 [
from line 672
672672 []anthropic.BetaTool{getWeather},
673673 anthropic.BetaToolRunnerParams{
674674 BetaMessageNewParams: anthropic.BetaMessageNewParams{
675 Model: anthropic.ModelClaudeOpus5,
675 Model: anthropic.ModelClaudeOpus5_5,
676676 MaxTokens: 1024,
677677 Messages: []anthropic.BetaMessageParam{
678678 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(
from line 704
704704 BetaToolRunner runner = client.beta()
705705 .messages()
706706 .toolRunner(MessageCreateParams.builder()
707 .model(Model.CLAUDE_OPUS_5)
707 .model(Model.CLAUDE_OPUS_5_5)
708708 .maxTokens(1024)
709709 .addBeta("structured-outputs-2025-11-13")
710710 .addUserMessage("What's the weather like in Paris? Also, what's 15 + 27?")
from line 733
733733 messages: [
734734 ['role' => 'user', 'content' => "What's the weather like in Paris? Also, what's 15 + 27?"],
735735 ],
736 model: Model::CLAUDE_OPUS_5,
736 model: Model::CLAUDE_OPUS_5_5,
737737 tools: [$getWeather, $calculateSum],
738738 );
739739 
from line 753
753753 client = Anthropic::Client.new
754754 # ...
755755 runner = client.beta.messages.tool_runner(
756 model: "claude-opus-5",
756 model: "claude-opus-5-5",
757757 max_tokens: 1024,
758758 tools: [GetWeather.new, CalculateSum.new],
759759 messages: [
from line 816
816816 
817817 ```python
818818 runner = client.beta.messages.tool_runner(
819 model="claude-opus-5",
819 model="claude-opus-5-5",
820820 max_tokens=1024,
821821 max_iterations=10,
822822 tools=[get_weather],
from line 852
852852 
853853 ```typescript
854854 const runner = client.beta.messages.toolRunner({
855 model: "claude-opus-5",
855 model: "claude-opus-5-5",
856856 max_tokens: 1024,
857857 max_iterations: 10,
858858 tools: [getWeatherTool],
from line 892
892892 var runner = client.Beta.Messages.ToolRunner(
893893 new MessageCreateParams
894894 {
895 Model = Model.ClaudeOpus5,
895 Model = Model.ClaudeOpus5_5,
896896 MaxTokens = 1024,
897897 Messages = [new() { Role = Role.User, Content = "What's the weather in San Francisco?" }],
898898 },
from line 949
949949 []anthropic.BetaTool{getWeather},
950950 anthropic.BetaToolRunnerParams{
951951 BetaMessageNewParams: anthropic.BetaMessageNewParams{
952 Model: anthropic.ModelClaudeOpus5,
952 Model: anthropic.ModelClaudeOpus5_5,
953953 MaxTokens: 1024,
954954 Messages: []anthropic.BetaMessageParam{
955955 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(
from line 987
987987 .messages()
988988 .toolRunner(ToolRunnerCreateParams.builder()
989989 .initialMessageParams(MessageCreateParams.builder()
990 .model(Model.CLAUDE_OPUS_5)
990 .model(Model.CLAUDE_OPUS_5_5)
991991 .maxTokens(1024)
992992 .addBeta("structured-outputs-2025-11-13")
993993 .addUserMessage("Give me a detailed weather report for every major US city.")
from line 1031
10311031 messages: [
10321032 ['role' => 'user', 'content' => 'Give a detailed weather report for every major US city.'],
10331033 ],
1034 model: Model::CLAUDE_OPUS_5,
1034 model: Model::CLAUDE_OPUS_5_5,
10351035 tools: [$getWeather],
10361036 maxIterations: 10,
10371037 );
from line 1067
10671067 
10681068 ```ruby
10691069 runner = client.beta.messages.tool_runner(
1070 model: "claude-opus-5",
1070 model: "claude-opus-5-5",
10711071 max_tokens: 1024,
10721072 max_iterations: 10,
10731073 tools: [GetWeather.new],
from line 1123
11231123 client = anthropic.Anthropic()
11241124 # ...
11251125 runner = client.beta.messages.tool_runner(
1126 model="claude-opus-5",
1126 model="claude-opus-5-5",
11271127 max_tokens=1024,
11281128 tools=[my_tool],
11291129 messages=[{"role": "user", "content": "Run my_tool with the query 'hello'."}],
from line 1153
11531153 const client = new Anthropic();
11541154 // ...
11551155 const runner = client.beta.messages.toolRunner({
1156 model: "claude-opus-5",
1156 model: "claude-opus-5-5",
11571157 max_tokens: 1024,
11581158 tools: [myTool],
11591159 messages: [{ role: "user", content: "Run my_tool with the query 'hello'." }]
from line 1223
12231223 var runner = client.Beta.Messages.ToolRunner(
12241224 new MessageCreateParams
12251225 {
1226 Model = Model.ClaudeOpus5,
1226 Model = Model.ClaudeOpus5_5,
12271227 MaxTokens = 1024,
12281228 Messages =
12291229 [
from line 1254
12541254 client = Anthropic::Client.new
12551255 # ...
12561256 runner = client.beta.messages.tool_runner(
1257 model: "claude-opus-5",
1257 model: "claude-opus-5-5",
12581258 max_tokens: 1024,
12591259 tools: [MyTool.new],
12601260 messages: [{role: "user", content: "Run my_tool with the query 'hello'."}]
from line 1300
13001300 client = anthropic.Anthropic()
13011301 # ...
13021302 runner = client.beta.messages.tool_runner(
1303 model="claude-opus-5",
1303 model="claude-opus-5-5",
13041304 max_tokens=1024,
13051305 tools=[search_documents],
13061306 messages=[
from line 1334
13341334 const client = new Anthropic();
13351335 // ...
13361336 const runner = client.beta.messages.toolRunner({
1337 model: "claude-opus-5",
1337 model: "claude-opus-5-5",
13381338 max_tokens: 1024,
13391339 tools: [searchDocuments],
13401340 messages: [
from line 1396
13961396 []anthropic.BetaTool{searchDocuments},
13971397 anthropic.BetaToolRunnerParams{
13981398 BetaMessageNewParams: anthropic.BetaMessageNewParams{
1399 Model: anthropic.ModelClaudeOpus5,
1399 Model: anthropic.ModelClaudeOpus5_5,
14001400 MaxTokens: 1024,
14011401 Messages: []anthropic.BetaMessageParam{
14021402 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock(
from line 1449
14491449 messages: [
14501450 ['role' => 'user', 'content' => 'Search for information about the climate of San Francisco.'],
14511451 ],
1452 model: Model::CLAUDE_OPUS_5,
1452 model: Model::CLAUDE_OPUS_5_5,
14531453 tools: [$searchDocuments],
14541454 );
14551455 
from line 1485
14851485 client = Anthropic::Client.new
14861486 # ...
14871487 runner = client.beta.messages.tool_runner(
1488 model: "claude-opus-5",
1488 model: "claude-opus-5-5",
14891489 max_tokens: 1024,
14901490 tools: [SearchDocuments.new],
14911491 messages: [{role: "user", content: "Search for information about the climate of San Francisco"}]
from line 1531
15311531 client = anthropic.Anthropic()
15321532 # ...
15331533 runner = client.beta.messages.tool_runner(
1534 model="claude-opus-5",
1534 model="claude-opus-5-5",
15351535 max_tokens=1024,
15361536 tools=[calculate_sum],
15371537 messages=[{"role": "user", "content": "What is 15 + 27?"}],
from line 1555
15551555 const client = new Anthropic();
15561556 // ...
15571557 const runner = client.beta.messages.toolRunner({
1558 model: "claude-opus-5",
1558 model: "claude-opus-5-5",
15591559 max_tokens: 1024,
15601560 messages: [{ role: "user", content: "What is the weather in San Francisco?" }],
15611561 tools: [getWeatherTool],
from line 1583
15831583 var runner = client.Beta.Messages.ToolRunner(
15841584 new MessageCreateParams
15851585 {
1586 Model = Model.ClaudeOpus5,
1586 Model = Model.ClaudeOpus5_5,
15871587 MaxTokens = 1024,
15881588 Messages =
15891589 [
from line 1621
16211621 []anthropic.BetaTool{calculateSum},
16221622 anthropic.BetaToolRunnerParams{
16231623 BetaMessageNewParams: anthropic.BetaMessageNewParams{
1624 Model: anthropic.ModelClaudeOpus5,
1624 Model: anthropic.ModelClaudeOpus5_5,
16251625 MaxTokens: 1024,
16261626 Messages: []anthropic.BetaMessageParam{
16271627 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("What is 15 + 27?")),
from line 1664
16641664 BetaToolRunner runner = client.beta()
16651665 .messages()
16661666 .toolRunner(MessageCreateParams.builder()
1667 .model(Model.CLAUDE_OPUS_5)
1667 .model(Model.CLAUDE_OPUS_5_5)
16681668 .maxTokens(1024)
16691669 .addBeta("structured-outputs-2025-11-13")
16701670 .addUserMessage("What is 15 + 27?")
from line 1691
16911691 client = Anthropic::Client.new
16921692 # ...
16931693 runner = client.beta.messages.tool_runner(
1694 model: "claude-opus-5",
1694 model: "claude-opus-5-5",
16951695 max_tokens: 1024,
16961696 tools: [CalculateSum.new],
16971697 messages: [{role: "user", content: "What is 15 + 27?"}]

agents-and-tools/tool-use/tool-search-tool Changed · +10 / -9 lines

from line 45
4545| Claude Mythos 5.1 (claude-mythos-5-1) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
4646| Claude Fable 5 (claude-fable-5) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
4747| Claude Mythos 5 (claude-mythos-5) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
48| Claude Opus 5.5 (claude-opus-5-5) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
4849| Claude Opus 5 (claude-opus-5) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
4950| Claude Opus 4.8 (claude-opus-4-8) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
5051| Claude Opus 4.7 (claude-opus-4-7) | `tool_search_tool_regex_20251119`, `tool_search_tool_bm25_20251119` |
from line 85
8485 -H "anthropic-version: 2023-06-01" \
8586 -H "content-type: application/json" \
8687 -d '{
87 "model": "claude-opus-5",
88 "model": "claude-opus-5-5",
8889 "max_tokens": 2048,
8990 "messages": [
9091 {
from line 136
135136 
136137 ```bash CLI
137138 ant messages create <<'YAML'
138 model: claude-opus-5
139 model: claude-opus-5-5
139140 max_tokens: 2048
140141 messages:
141142 - role: user
from line 176
175176 client = anthropic.Anthropic()
176177 
177178 response = client.messages.create(
178 model="claude-opus-5",
179 model="claude-opus-5-5",
179180 max_tokens=2048,
180181 messages=[{"role": "user", "content": "What is the weather in San Francisco?"}],
181182 tools=[
from line 217
216217 const client = new Anthropic();
217218 
218219 const response = await client.messages.create({
219 model: "claude-opus-5",
220 model: "claude-opus-5-5",
220221 max_tokens: 2048,
221222 messages: [
222223 {
from line 273
272273 
273274 var parameters = new MessageCreateParams
274275 {
275 Model = Model.ClaudeOpus5,
276 Model = Model.ClaudeOpus5_5,
276277 MaxTokens = 2048,
277278 Messages = [
278279 new() {
from line 327
326327 client := anthropic.NewClient()
327328 
328329 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
329 Model: anthropic.ModelClaudeOpus5,
330 Model: anthropic.ModelClaudeOpus5_5,
330331 MaxTokens: 2048,
331332 Messages: []anthropic.MessageParam{
332333 anthropic.NewUserMessage(anthropic.NewTextBlock("What is the weather in San Francisco?")),
from line 400
399400 .build();
400401 
401402 MessageCreateParams params = MessageCreateParams.builder()
402 .model(Model.CLAUDE_OPUS_5)
403 .model(Model.CLAUDE_OPUS_5_5)
403404 .maxTokens(2048L)
404405 .addUserMessage("What is the weather in San Francisco?")
405406 .addTool(ToolSearchToolRegex20251119.builder()
from line 433
432433 messages: [
433434 ['role' => 'user', 'content' => 'What is the weather in San Francisco?'],
434435 ],
435 model: 'claude-opus-5',
436 model: 'claude-opus-5-5',
436437 tools: [
437438 [
438439 'type' => 'tool_search_tool_regex_20251119',
from line 481
480481 client = Anthropic::Client.new
481482 
482483 message = client.messages.create(
483 model: "claude-opus-5",
484 model: "claude-opus-5-5",
484485 max_tokens: 2048,
485486 messages: [
486487 { role: "user", content: "What is the weather in San Francisco?" }

agents-and-tools/tool-use/web-search-tool Changed · +18 / -18 lines

from line 75
7575 -H "anthropic-version: 2023-06-01" \
7676 -H "content-type: application/json" \
7777 -d '{
78 "model": "claude-opus-5",
78 "model": "claude-opus-5-5",
7979 "max_tokens": 4096,
8080 "messages": [
8181 {
from line 92
9292 
9393 ```bash CLI
9494 ant messages create <<'YAML'
95 model: claude-opus-5
95 model: claude-opus-5-5
9696 max_tokens: 4096
9797 messages:
9898 - role: user
from line 109
109109 client = anthropic.Anthropic()
110110 
111111 response = client.messages.create(
112 model="claude-opus-5",
112 model="claude-opus-5-5",
113113 max_tokens=4096,
114114 messages=[
115115 {
from line 126
126126 const client = new Anthropic();
127127 
128128 const response = await client.messages.create({
129 model: "claude-opus-5",
129 model: "claude-opus-5-5",
130130 max_tokens: 4096,
131131 messages: [
132132 {
from line 146
146146 
147147 var parameters = new MessageCreateParams
148148 {
149 Model = Model.ClaudeOpus5,
149 Model = Model.ClaudeOpus5_5,
150150 MaxTokens = 4096,
151151 Messages = [new() { Role = Role.User, Content = "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio." }],
152152 Tools = [new ToolUnion(new WebSearchTool20260318())]
from line 160
160160 client := anthropic.NewClient()
161161 
162162 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
163 Model: anthropic.ModelClaudeOpus5,
163 Model: anthropic.ModelClaudeOpus5_5,
164164 MaxTokens: 4096,
165165 Messages: []anthropic.MessageParam{
166166 anthropic.NewUserMessage(anthropic.NewTextBlock("Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.")),
from line 182
182182 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
183183 
184184 MessageCreateParams params = MessageCreateParams.builder()
185 .model(Model.CLAUDE_OPUS_5)
185 .model(Model.CLAUDE_OPUS_5_5)
186186 .maxTokens(4096L)
187187 .addUserMessage("Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.")
188188 .addTool(WebSearchTool20260318.builder().build())
from line 201
201201 messages: [
202202 ['role' => 'user', 'content' => 'Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.'],
203203 ],
204 model: 'claude-opus-5',
204 model: 'claude-opus-5-5',
205205 tools: [
206206 [
207207 'type' => 'web_search_20260318',
from line 217
217217 client = Anthropic::Client.new
218218 
219219 message = client.messages.create(
220 model: "claude-opus-5",
220 model: "claude-opus-5-5",
221221 max_tokens: 4096,
222222 messages: [
223223 { role: "user", content: "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio." }
from line 248
248248 -H "anthropic-version: 2023-06-01" \
249249 -H "content-type: application/json" \
250250 -d '{
251 "model": "claude-opus-5",
251 "model": "claude-opus-5-5",
252252 "max_tokens": 1024,
253253 "messages": [
254254 {
from line 266
266266 
267267 ```bash CLI
268268 ant messages create \
269 --model claude-opus-5 \
269 --model claude-opus-5-5 \
270270 --max-tokens 1024 \
271271 --message '{role: user, content: What is the weather in NYC?}' \
272272 --tool '{type: web_search_20250305, name: web_search, max_uses: 5}'
from line 276
276276 client = anthropic.Anthropic()
277277 
278278 response = client.messages.create(
279 model="claude-opus-5",
279 model="claude-opus-5-5",
280280 max_tokens=1024,
281281 messages=[{"role": "user", "content": "What's the weather in NYC?"}],
282282 tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}],
from line 288
288288 const client = new Anthropic();
289289 
290290 const response = await client.messages.create({
291 model: "claude-opus-5",
291 model: "claude-opus-5-5",
292292 max_tokens: 1024,
293293 messages: [
294294 {
from line 313
313313 
314314 var parameters = new MessageCreateParams
315315 {
316 Model = Model.ClaudeOpus5,
316 Model = Model.ClaudeOpus5_5,
317317 MaxTokens = 1024,
318318 Messages = [new() { Role = Role.User, Content = "What's the weather in NYC?" }],
319319 Tools = [new ToolUnion(new WebSearchTool20250305() { MaxUses = 5 })]
from line 327
327327 client := anthropic.NewClient()
328328 
329329 response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
330 Model: anthropic.ModelClaudeOpus5,
330 Model: anthropic.ModelClaudeOpus5_5,
331331 MaxTokens: 1024,
332332 Messages: []anthropic.MessageParam{
333333 anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in NYC?")),
from line 351
351351 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
352352 
353353 MessageCreateParams params = MessageCreateParams.builder()
354 .model(Model.CLAUDE_OPUS_5)
354 .model(Model.CLAUDE_OPUS_5_5)
355355 .maxTokens(1024L)
356356 .addUserMessage("What's the weather in NYC?")
357357 .addTool(WebSearchTool20250305.builder()
from line 372
372372 messages: [
373373 ['role' => 'user', 'content' => "What's the weather in NYC?"],
374374 ],
375 model: 'claude-opus-5',
375 model: 'claude-opus-5-5',
376376 tools: [
377377 [
378378 'type' => 'web_search_20250305',
from line 389
389389 client = Anthropic::Client.new
390390 
391391 message = client.messages.create(
392 model: "claude-opus-5",
392 model: "claude-opus-5-5",
393393 max_tokens: 1024,
394394 messages: [
395395 { role: "user", content: "What's the weather in NYC?" }

api/beta-headers Changed · +9 / -9 lines

from line 34
3434 -H "anthropic-beta: context-management-2025-06-27" \
3535 -H "content-type: application/json" \
3636 -d '{
37 "model": "claude-opus-5",
37 "model": "claude-opus-5-5",
3838 "max_tokens": 1024,
3939 "messages": [
4040 {"role": "user", "content": "Hello, Claude"}
from line 45
4545 ```bash CLI
4646 ant beta:messages create \
4747 --beta context-management-2025-06-27 \
48 --model claude-opus-5 \
48 --model claude-opus-5-5 \
4949 --max-tokens 1024 \
5050 --message '{role: user, content: "Hello, Claude"}'
5151 ```
from line 54
5454 client = Anthropic()
5555 
5656 response = client.beta.messages.create(
57 model="claude-opus-5",
57 model="claude-opus-5-5",
5858 max_tokens=1024,
5959 messages=[{"role": "user", "content": "Hello, Claude"}],
6060 betas=["context-management-2025-06-27"],
from line 67
6767 const client = new Anthropic();
6868 
6969 const msg = await client.beta.messages.create({
70 model: "claude-opus-5",
70 model: "claude-opus-5-5",
7171 max_tokens: 1024,
7272 messages: [{ role: "user", content: "Hello, Claude" }],
7373 betas: ["context-management-2025-06-27"]
from line 82
8282 var message = await client.Beta.Messages.Create(
8383 new MessageCreateParams
8484 {
85 Model = "claude-opus-5",
85 Model = "claude-opus-5-5",
8686 MaxTokens = 1024,
8787 Messages = [new() { Role = Role.User, Content = "Hello, Claude" }],
8888 Betas = ["context-management-2025-06-27"],
from line 96
9696 client := anthropic.NewClient()
9797 
9898 message, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{
99 Model: anthropic.ModelClaudeOpus5,
99 Model: anthropic.ModelClaudeOpus5_5,
100100 MaxTokens: 1024,
101101 Messages: []anthropic.BetaMessageParam{
102102 anthropic.NewBetaUserMessage(anthropic.NewBetaTextBlock("Hello, Claude")),
from line 114
114114 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
115115 
116116 MessageCreateParams params = MessageCreateParams.builder()
117 .model(Model.CLAUDE_OPUS_5)
117 .model(Model.CLAUDE_OPUS_5_5)
118118 .maxTokens(1024)
119119 .addUserMessage("Hello, Claude")
120120 .addBeta(AnthropicBeta.CONTEXT_MANAGEMENT_2025_06_27)
from line 130
130130 $message = $client->beta->messages->create(
131131 maxTokens: 1024,
132132 messages: [['role' => 'user', 'content' => 'Hello, Claude']],
133 model: 'claude-opus-5',
133 model: 'claude-opus-5-5',
134134 betas: ['context-management-2025-06-27'],
135135 );
136136 
from line 141
141141 client = Anthropic::Client.new
142142 
143143 message = client.beta.messages.create(
144 model: "claude-opus-5",
144 model: "claude-opus-5-5",
145145 max_tokens: 1024,
146146 messages: [{role: "user", content: "Hello, Claude"}],
147147 betas: ["context-management-2025-06-27"]