Migrating to Claude Opus 5
Migrate to Claude Opus 5 from earlier Claude models: model IDs, breaking changes, recommended changes, and migration checklists.
Claude Opus 5 is a step-change improvement over Claude Opus 4.8, strong on deep reasoning, agentic and long-horizon tasks, and test-time compute scaling. For behavioral differences and model-specific prompting patterns, see Prompting Claude Opus 5.
Claude Opus 5 is a drop-in upgrade for Claude Opus 4.8 at the same pricing of $5 USD per million input tokens and $25 USD per million output tokens; see Claude pricing. There are two breaking changes for code already running on Claude Opus 4.8, covered under Breaking changes. Claude Opus 5 supports the same set of features as Claude Opus 4.8, including the 1M token context window (the default, with no beta header), 128k max output tokens, adaptive thinking, prompt caching, batch processing, the Files API, PDF support, vision, and server-side and client-side tools, with two exceptions: web fetch is not available on Claude Opus 5, and Priority Tier is not supported on Claude Opus 5. See each tool page for model availability.
Migrating to Claude Opus 5 from Claude Opus 4.8
Update your model name
# Opus migration
model = "claude-opus-4-8" # Before
model = "claude-opus-5" # Afterclaude-opus-5 is a fixed model ID with no date suffix, the same scheme as claude-opus-4-8 and claude-sonnet-5.
Breaking changes
-
Thinking on by default: On Claude Opus 4.8, requests without a
thinkingfield run without thinking; on Claude Opus 5, the same requests run with adaptive thinking.max_tokensremains a hard limit on total output, thinking plus response text, so revisit it for workloads that ran without thinking on Claude Opus 4.8. Thinking tokens are billed as output tokens even when the thinking text is not returned to you, so although per-token pricing is unchanged, a workload that ran without thinking on Claude Opus 4.8 can produce more output tokens per request on Claude Opus 5; see Cost control. To preserve the old behavior, passthinking: {type: "disabled"}, subject to the effort cap in the next item; note that with thinking disabled the model can occasionally emit tool calls as plain text or include internal XML tags in its visible output, so prefer lower effort levels with thinking enabled where you can, and see Running with thinking disabled for mitigations where you can't.The response shape changes with it. With thinking on, a response can begin with one or more
thinkingblocks before the firsttextblock, and becausethinking.displaydefaults to"omitted"on Claude Opus 5, those blocks arrive with an emptythinkingfield alongside theirsignature. Code that reads the reply by position, such ascontent[0].textor a stream handler that treats the firstcontent_block_startevent as text, breaks on these responses. Select content blocks by theirtypefield instead: readtextfrom the blocks whosetypeis"text", and branch on the block type when handling stream events. To receive readable thinking summaries instead of an emptythinkingfield, setdisplay: "summarized"; see Controlling thinking display.If you run a tool-use loop, pass the
thinkingblocks from each assistant response back to the API complete and unmodified when you return tool results, including blocks whosethinkingfield is empty. Echo the assistant message as received rather than filtering its content blocks by type or rebuilding it: the API rejects edited, reordered, or partially dropped thinking blocks with a 400 error. See Preserving thinking blocks. -
Disabling thinking is capped at
higheffort: You can still turn thinking off withthinking: {type: "disabled"}, but only at an effort level ofhighor below. A request that combinesthinking: {type: "disabled"}with effortxhighormaxreturns a 400 error. Claude Opus 4.8 accepts this combination, so audit requests that disable thinking before you migrate.The check is enforced on each request: every request's effort and thinking configuration is validated independently, so a request that raises effort to
xhighormaxwhile thinking is disabled is rejected even if earlier requests in the conversation were accepted.Before (accepted on Claude Opus 4.8, rejected on Claude Opus 5):
client.messages.create( model="claude-opus-4-8", max_tokens=16000, thinking={"type": "disabled"}, output_config={"effort": "xhigh"}, messages=[{"role": "user", "content": "..."}], )After (Claude Opus 5), either remove the
thinkingfield to re-enable thinking:client.messages.create( model="claude-opus-5", max_tokens=16000, output_config={"effort": "xhigh"}, # thinking is on by default messages=[{"role": "user", "content": "..."}], )or keep thinking disabled and lower the effort:
client.messages.create( model="claude-opus-5", max_tokens=16000, thinking={"type": "disabled"}, output_config={"effort": "high"}, # or "medium", "low" messages=[{"role": "user", "content": "..."}], )
Recommended changes
These are not required but will improve your experience:
-
Test
maxeffort for capability-critical work: Claude Opus 5 supports the full set of effort levels (low,medium,high,xhigh,max). Where maximum capability matters more than token spend, testmaxeffort. It can deliver gains on the most demanding tasks but may show diminishing returns from increased token usage and can be prone to overthinking on simpler ones. If you run atxhighormaxeffort, set a largemax_tokensso the model has room to think and act; start at 64k tokens and tune from there. -
Consider automatic fallbacks: Claude Opus 5 ships with cybersecurity safety classifiers whose cyber-category refusals can fall back to Claude Opus 4.8. To re-run refused requests on another model automatically, consider the
fallbacksparameter with the"default"mode (fallbacks: "default"), which selects a recommended fallback model based on the refusal category instead of a hand-maintained model list. Server-side fallback is in beta; the"default"mode requires theserver-side-fallback-2026-07-01beta header. See Refusals and fallback. -
Cache shorter prompts: The minimum cacheable prompt length on Claude Opus 5 is 512 tokens, down from 1,024 tokens on Claude Opus 4.8. Prompts that were too short to cache on Claude Opus 4.8 can now create cache entries, with no code changes required. See Prompt caching for per-model minimums.
-
Change tools mid-conversation (beta): You can add or remove tools between turns of a conversation without invalidating prompt cache hits on earlier turns. Send the beta header
mid-conversation-tool-changes-2026-07-01. This is useful for agentic workloads that expose tools progressively or retire them as a task advances; without it, a changed tool list invalidates the cached prefix. -
Re-tune length and verbosity prompts: Default visible responses and written deliverables run longer on Claude Opus 5 than on Claude Opus 4.8, and lowering effort reduces thinking volume without reliably shortening the visible response. Prompt explicitly for conciseness or a target length instead. See Response length and verbosity and Written deliverable length.
-
Remove carried-over verification instructions and constrain scope: Claude Opus 5 verifies its own work without being told to, so remove explicit verification or self-check instructions carried over from prompts tuned for earlier models; leaving them in causes over-verification. For narrow tasks, constrain the task scope explicitly. In multi-agent frameworks, give explicit guidance on which scenarios warrant delegation or cap the number of subagents, because Claude Opus 5 delegates more readily than earlier models. See Task scope and over-verification and Controlling subagent spawning.
Migration checklist
- Update the model name from
claude-opus-4-8toclaude-opus-5. - Review workloads that ran without a
thinkingfield: they run with thinking on Claude Opus 5. Revisitmax_tokens, which remains a hard limit on total output (thinking plus response text), or passthinking: {type: "disabled"}at efforthighor below to preserve the old behavior. If you disable thinking, review Running with thinking disabled for the output artifacts that can appear and their prompting mitigations. - Update response parsing that reads content by position, such as
content[0].textor a stream handler that assumes the first content block is text: with thinking on,thinkingblocks arrive beforetextblocks. Select content blocks bytypeinstead. - If you run a tool-use loop, pass
thinkingblocks back complete and unmodified when you return tool results; modified blocks return a 400 error. See Preserving thinking blocks. - Verify any code that parses the
thinkingfield treats it as display text only.thinking.displaydefaults to"omitted"on Claude Opus 5, the same as on Claude Opus 4.8, so thinking blocks arrive with an emptythinkingfield; setdisplay: "summarized"to receive readable summaries. See Controlling thinking display. - Audit requests that disable thinking:
thinking: {type: "disabled"}with effortxhighormaxreturns a 400 error, enforced on each request. Re-enable thinking or lower the effort tohighor below. - Re-evaluate your
effortsetting: run a fresh effort sweep on your own evals rather than carrying over a setting tuned for an earlier model.lowandmediumeffort are worth testing as cost and latency controls, and testmaxeffort where maximum capability matters more than token spend. If you run atxhighormaxeffort, raisemax_tokensto at least 64k as a starting point. - Review prompts near the caching minimum: prompts of 512 tokens or more can now create cache entries, down from 1,024 tokens on Claude Opus 4.8.
- Handle
stop_reason: "refusal", and considerfallbacks: "default"(beta) to re-run refused requests on a recommended fallback model automatically. - If your organization has a Priority Tier commitment, plan capacity separately: Priority Tier is not supported on Claude Opus 5, while Claude Opus 4.8 keeps it.
- For agentic workloads, consider task budgets (beta) and mid-conversation tool changes (beta).
- Re-tune length and verbosity prompts: default visible responses and written deliverables run longer on Claude Opus 5, and lowering effort reduces thinking volume without reliably shortening the visible response. Prompt explicitly for conciseness or a target length. See Response length and verbosity and Written deliverable length.
- Remove verification and self-check instructions carried over from prompts tuned for earlier models (they cause over-verification on Claude Opus 5), constrain task scope explicitly for narrow tasks, and in multi-agent frameworks steer or cap subagent delegation. See Task scope and over-verification and Controlling subagent spawning.
- Re-baseline cost and latency on your own workloads. Per-token pricing is unchanged from Claude Opus 4.8, but thinking tokens are billed as output tokens, so workloads that ran without thinking can produce more output tokens per request.
Migrating to Claude Opus 5 from Claude Opus 4.7
Claude Opus 5 should have strong out-of-the-box performance on existing Claude Opus 4.7 prompts and evals, at the same pricing of $5 USD per million input tokens and $25 USD per million output tokens. It supports the same set of features as Claude Opus 4.7, including the 1M token context window, 128k max output tokens, adaptive thinking, prompt caching, batch processing, the Files API, PDF support, vision, and server-side and client-side tools, with two exceptions: web fetch is not available on Claude Opus 5, and Priority Tier is not supported on Claude Opus 5. It also adds mid-conversation system messages and publicly documents refusal stop details. On the Claude API and Google Cloud, Claude Opus 5 also supports computer use as the stable computer_toolset_20260801 toolset and the browser use tool for tasks inside webpages, neither of which Claude Opus 4.7 supports; existing integrations on the earlier computer_20251124 version continue to work unchanged on both models. To upgrade an existing integration, see Migrate from computer_20251124.
Update your model name
# Opus migration
model = "claude-opus-4-7" # Before
model = "claude-opus-5" # AfterBreaking changes
-
Thinking on by default: On Claude Opus 4.7, requests without a
thinkingfield run without thinking; on Claude Opus 5, the same requests run with adaptive thinking.max_tokensremains a hard limit on total output, thinking plus response text, so revisit it for workloads that ran without thinking on Claude Opus 4.7. Thinking tokens are billed as output tokens even when the thinking text is not returned to you, so although per-token pricing is unchanged, a workload that ran without thinking on Claude Opus 4.7 can produce more output tokens per request on Claude Opus 5; see Cost control. To preserve the old behavior, passthinking: {type: "disabled"}, subject to the effort cap in the next item; note that with thinking disabled the model can occasionally emit tool calls as plain text or include internal XML tags in its visible output, so prefer lower effort levels with thinking enabled where you can, and see Running with thinking disabled for mitigations where you can't.The response shape changes with it. With thinking on, a response can begin with one or more
thinkingblocks before the firsttextblock, and becausethinking.displaydefaults to"omitted"on Claude Opus 5, those blocks arrive with an emptythinkingfield alongside theirsignature. Code that reads the reply by position, such ascontent[0].textor a stream handler that treats the firstcontent_block_startevent as text, breaks on these responses. Select content blocks by theirtypefield instead: readtextfrom the blocks whosetypeis"text", and branch on the block type when handling stream events. To receive readable thinking summaries instead of an emptythinkingfield, setdisplay: "summarized"; see Controlling thinking display.If you run a tool-use loop, pass the
thinkingblocks from each assistant response back to the API complete and unmodified when you return tool results, including blocks whosethinkingfield is empty. Echo the assistant message as received rather than filtering its content blocks by type or rebuilding it: the API rejects edited, reordered, or partially dropped thinking blocks with a 400 error. See Preserving thinking blocks. -
Disabling thinking is capped at
higheffort: You can turn thinking off withthinking: {type: "disabled"}, but only at an effort level ofhighor below. A request that combinesthinking: {type: "disabled"}with effortxhighormaxreturns a 400 error. Claude Opus 4.7 accepts this combination, so audit requests that disable thinking before you migrate.The check is enforced on each request: every request's effort and thinking configuration is validated independently, so a request that raises effort to
xhighormaxwhile thinking is disabled is rejected even if earlier requests in the conversation were accepted.Before (accepted on Claude Opus 4.7, rejected on Claude Opus 5):
client.messages.create( model="claude-opus-4-7", max_tokens=16000, thinking={"type": "disabled"}, output_config={"effort": "xhigh"}, messages=[{"role": "user", "content": "..."}], )After (Claude Opus 5), either remove the
thinkingfield to run with thinking:client.messages.create( model="claude-opus-5", max_tokens=16000, output_config={"effort": "xhigh"}, # thinking is on by default messages=[{"role": "user", "content": "..."}], )or keep thinking disabled and lower the effort:
client.messages.create( model="claude-opus-5", max_tokens=16000, thinking={"type": "disabled"}, output_config={"effort": "high"}, # or "medium", "low" messages=[{"role": "user", "content": "..."}], )
What changed
The following items are not breaking changes; they describe behavior differences worth checking after you swap the model ID.
-
Sampling parameters (unchanged): Setting
temperature,top_p, ortop_kto a non-default value returns a 400 error on Claude Opus 5, the same as on Claude Opus 4.7. Most SDKs still define these fields for compatibility with earlier models, so code that sets them type-checks even though the API rejects the request. The Python SDK (v1.0 and later) does not define them, and passing them raises aTypeError. If you removed these parameters when migrating to Opus 4.7, no further changes are needed. -
Effort default is
high: The effort parameter default on Claude Opus 5 ishighon the Claude API and Claude Code. If you already set effort explicitly, your setting is unchanged. -
Effort levels recalibrated: The token allocation behind each effort level changes on Claude Opus 5 compared to Claude Opus 4.7, and Claude Opus 5 supports the full set of effort levels (
low,medium,high,xhigh,max). Run a fresh effort sweep on your own evals rather than carrying over a setting tuned for Claude Opus 4.7.lowandmediumeffort are worth testing as cost and latency controls, and testmaxeffort where maximum capability matters more than token spend. If you run atxhighormaxeffort, set a largemax_tokensso the model has room to think and act; start at 64k tokens and tune from there. See Effort. -
1M context window is the default: Claude Opus 5 serves the full 1M token context window by default with no beta header and no long-context premium. If your client passes a context-window beta header for compatibility with older models, you can remove it on Claude Opus 5.
-
Mid-conversation system messages: Claude Opus 5 accepts
role: "system"messages immediately after a user turn in themessagesarray (subject to placement rules). Use the top-levelsystemfield for instructions that apply from the start. Claude Opus 4.7 rejectsrole: "system"inmessageswith a 400 error. If you maintain code paths that rebuild the full message history to update instructions, you can simplify them and preserve prompt cache hits on earlier turns. -
Refusal stop details: The
stop_detailsobject on refusal responses (available since Claude Opus 4.7) is now publicly documented. When the model declines a request, it identifies the category of refusal, in addition to the existingrefusalstop reason. No beta header is required, and there is no opt-out. See Handling stop reasons. -
Lower prompt caching minimum: The minimum cacheable prompt length on Claude Opus 5 is 512 tokens, lower than on Claude Opus 4.7. Prompts that were too short to cache on Claude Opus 4.7 can now create cache entries, with no code changes required. See Prompt caching for per-model minimums.
-
Fast mode: Claude Opus 5 supports fast mode (research preview); fast mode is not available on Claude Opus 4.7, where requests with
speed: "fast"return an error. Thespeed: "fast"parameter andfast-mode-2026-02-01beta header work unchanged on Claude Opus 5.
Recommended changes
These are not required but will improve your experience:
-
Consider automatic fallbacks: Claude Opus 5 ships with cybersecurity safety classifiers whose cyber-category refusals can fall back to Claude Opus 4.8. To re-run refused requests on another model automatically, consider the
fallbacksparameter with the"default"mode (fallbacks: "default"), which selects a recommended fallback model based on the refusal category instead of a hand-maintained model list. Server-side fallback is in beta; the"default"mode requires theserver-side-fallback-2026-07-01beta header. See Refusals and fallback. -
Change tools mid-conversation (beta): You can add or remove tools between turns of a conversation without invalidating prompt cache hits on earlier turns. Send the beta header
mid-conversation-tool-changes-2026-07-01. This is useful for agentic workloads that expose tools progressively or retire them as a task advances; without it, a changed tool list invalidates the cached prefix. -
Re-tune length and verbosity prompts: Default visible responses and written deliverables run longer on Claude Opus 5 than on earlier Opus models, and lowering effort reduces thinking volume without reliably shortening the visible response. Prompt explicitly for conciseness or a target length instead. See Response length and verbosity and Written deliverable length.
-
Remove carried-over verification instructions and constrain scope: Claude Opus 5 verifies its own work without being told to, so remove explicit verification or self-check instructions carried over from prompts tuned for earlier models; leaving them in causes over-verification. For narrow tasks, constrain the task scope explicitly. In multi-agent frameworks, give explicit guidance on which scenarios warrant delegation or cap the number of subagents, because Claude Opus 5 delegates more readily than earlier models. See Task scope and over-verification and Controlling subagent spawning.
Migration checklist
- Update model name from
claude-opus-4-7toclaude-opus-5(or update aliases). - Review workloads that ran without a
thinkingfield: they run with thinking on Claude Opus 5. Revisitmax_tokens, which remains a hard limit on total output (thinking plus response text), or passthinking: {type: "disabled"}at efforthighor below to preserve the old behavior. If you disable thinking, review Running with thinking disabled for the output artifacts that can appear and their prompting mitigations. - Update response parsing that reads content by position, such as
content[0].textor a stream handler that assumes the first content block is text: with thinking on,thinkingblocks arrive beforetextblocks. Select content blocks bytypeinstead. - If you run a tool-use loop, pass
thinkingblocks back complete and unmodified when you return tool results; modified blocks return a 400 error. See Preserving thinking blocks. - Verify any code that parses the
thinkingfield treats it as display text only.thinking.displaydefaults to"omitted"on Claude Opus 5, the same as on Claude Opus 4.7, so thinking blocks arrive with an emptythinkingfield; setdisplay: "summarized"to receive readable summaries. See Controlling thinking display. - Audit requests that disable thinking:
thinking: {type: "disabled"}with effortxhighormaxreturns a 400 error, enforced on each request. Re-enable thinking or lower the effort tohighor below. - If you removed sampling parameters during the Opus 4.7 migration, no action is needed. If you re-added them with a 400-retry path, remove that retry path.
- Re-evaluate your
effortsetting: run a fresh effort sweep on your own evals rather than carrying over a setting tuned for Claude Opus 4.7. Testlowandmediumeffort as cost and latency controls, andmaxeffort where maximum capability matters more than token spend. If you run atxhighormaxeffort, raisemax_tokensto at least 64k as a starting point. - Remove any context-window beta header. The 1M context window is the default on the Claude API, Amazon Bedrock, Google Cloud, and Microsoft Foundry.
- If you rebuild conversation history to update instructions, consider switching to a mid-conversation system message to preserve prompt cache hits.
- Verify your stop-reason handling reads
stop_detailson refusals (available since Claude Opus 4.7; now publicly documented), and considerfallbacks: "default"(beta) to re-run refused requests on a recommended fallback model automatically. - Review prompts near the caching minimum: prompts of 512 tokens or more can now create cache entries.
- If you use web fetch, plan an alternative: it is not available on Claude Opus 5.
- If your organization has a Priority Tier commitment, note that Priority Tier is not supported on Claude Opus 5.
- If you used fast mode on Claude Opus 4.7, no request changes are needed beyond the model ID:
speed: "fast"and thefast-mode-2026-02-01beta header work unchanged on Claude Opus 5. - For agentic workloads, consider task budgets (beta) and mid-conversation tool changes (beta).
- Re-tune length and verbosity prompts, and remove verification and self-check instructions carried over from prompts tuned for earlier models.
- Re-baseline cost and latency at your chosen effort level. Per-token pricing is unchanged from Claude Opus 4.7, but thinking tokens are billed as output tokens, so workloads that ran without thinking can produce more output tokens per request.
Migrating to Claude Opus 5 from Claude Opus 4.6 and earlier Opus models
Claude Opus 5 should have strong out-of-the-box performance on existing Claude Opus 4.6 prompts and evals at the same pricing, but there are a handful of behavioral and API changes worth knowing about as you migrate. Most of these changes took effect in Claude Opus 4.7; two more, thinking on by default and an effort cap on disabling thinking, take effect on Claude Opus 5. All of them are covered in this section, so it is complete for code coming straight from Claude Opus 4.6. Claude Opus 5 supports the same set of features as Claude Opus 4.6, including:
- 1M token context window at standard API pricing with no long-context premium
- 128k max output tokens
- Adaptive thinking
- Prompt caching
- Batch processing
- Files API
- PDF support
- Vision
- Server-side and client-side tools (bash, code execution, computer use, text editor, web search, MCP connector, memory)
Two exceptions: web fetch is not available on Claude Opus 5, and Priority Tier is not supported on Claude Opus 5. On the Claude API and Google Cloud, Claude Opus 5 also supports computer use as the stable computer_toolset_20260801 toolset and the browser use tool for tasks inside webpages, neither of which Claude Opus 4.6 or earlier Opus models support; existing integrations on the earlier computer_20251124 version continue to work unchanged on Claude Opus 5. To upgrade an existing integration, see Migrate from computer_20251124.
Update your model name
# Opus migration
model = "claude-opus-4-6" # Before
model = "claude-opus-5" # AfterBreaking changes
-
Extended thinking removed:
thinking: {type: "enabled", budget_tokens: N}is no longer supported on Claude Opus 4.7 or later models and returns a 400 error. Switch to adaptive thinking (thinking: {type: "adaptive"}) and use the effort parameter to control thinking depth. On Claude Opus 5, adaptive thinking is on by default:thinking: {type: "adaptive"}is valid and equivalent to omitting thethinkingfield entirely (see the next item).Before (Claude Opus 4.6):
client.messages.create( model="claude-opus-4-6", max_tokens=16000, thinking={"type": "enabled", "budget_tokens": 10000}, messages=[{"role": "user", "content": "..."}], )After (Claude Opus 5):
client.messages.create( model="claude-opus-5", max_tokens=16000, thinking={"type": "adaptive"}, output_config={"effort": "high"}, # or "max", "xhigh", "medium", "low" messages=[{"role": "user", "content": "..."}], )Adaptive thinking is steerable through prompting and the effort parameter; see Choosing an effort level.
-
Thinking on by default: On Claude Opus 4.6 and Claude Opus 4.7, requests without a
thinkingfield run without thinking; on Claude Opus 5, the same requests run with adaptive thinking.max_tokensremains a hard limit on total output, thinking plus response text, so revisit it for workloads that ran without thinking. Thinking tokens are billed as output tokens even when the thinking text is not returned to you, so although per-token pricing is unchanged, a workload that ran without thinking can produce more output tokens per request on Claude Opus 5; see Cost control. To preserve the old behavior, passthinking: {type: "disabled"}, subject to the effort cap in the next item; note that with thinking disabled the model can occasionally emit tool calls as plain text or include internal XML tags in its visible output, so prefer lower effort levels with thinking enabled where you can, and see Running with thinking disabled for mitigations where you can't.The response shape changes with it. With thinking on, a response can begin with one or more
thinkingblocks before the firsttextblock, and because thinking content is omitted by default on Claude Opus 5 (item 5 in this list), those blocks arrive with an emptythinkingfield alongside theirsignature. Code that reads the reply by position, such ascontent[0].textor a stream handler that treats the firstcontent_block_startevent as text, breaks on these responses. Select content blocks by theirtypefield instead: readtextfrom the blocks whosetypeis"text", and branch on the block type when handling stream events.If you run a tool-use loop, pass the
thinkingblocks from each assistant response back to the API complete and unmodified when you return tool results, including blocks whosethinkingfield is empty. Echo the assistant message as received rather than filtering its content blocks by type or rebuilding it: the API rejects edited, reordered, or partially dropped thinking blocks with a 400 error. See Preserving thinking blocks. -
Disabling thinking is capped at
higheffort: You can turn thinking off withthinking: {type: "disabled"}, but only at an effort level ofhighor below. A request that combinesthinking: {type: "disabled"}with effortxhighormaxreturns a 400 error on Claude Opus 5, enforced on each request. Audit requests that disable thinking before you migrate: re-enable thinking or lower the effort tohighor below. -
Sampling parameters removed: Setting
temperature,top_p, ortop_kto any non-default value on Claude Opus 4.7 or later models, including Claude Opus 5, returns a 400 error. The Python SDK (v1.0 and later) does not define them, and passing them raises aTypeError. The safest migration path is to omit these parameters entirely from request payloads. Prompting is the recommended way to guide model behavior on Claude Opus 5. If you were usingtemperature = 0for determinism, note that it never guaranteed identical outputs on prior models. -
Thinking content omitted by default: Thinking blocks still appear in the response stream on Claude Opus 4.7 and later models, but their
thinkingfield is empty unless you explicitly opt in. This is a silent change from Claude Opus 4.6, where the default was to return summarized thinking text. To restore summarized thinking content, setthinking.displayto"summarized":thinking = { "type": "adaptive", "display": "summarized", }The default is
"omitted"on Claude Opus 4.7 and later models. If your product streams reasoning to users, the new default appears as a long pause before output begins; setdisplay: "summarized"to restore visible progress during thinking. See Controlling thinking display for details. -
Updated token counting: Claude Opus 4.7 introduced a new tokenizer, which later Opus models, including Claude Opus 5, also use. It contributes to improved performance on a wide range of tasks, and it may use roughly 1x to 1.35x as many tokens when processing text compared to models before Claude Opus 4.7 (up to ~35% more, varying by content).
/v1/messages/count_tokensreturns a different number of tokens for Claude Opus 5 than it did for Claude Opus 4.6. Token efficiency can vary by workload shape.Prompting interventions,
task_budget, andeffortcan help control costs and ensure appropriate token usage. These controls may trade off model intelligence. Update yourmax_tokensparameters to give additional headroom, including compaction triggers. Claude Opus 5 provides a 1M context window at standard API pricing with no long-context premium. -
Prefill removal (carried over from Opus 4.6): Prefilling assistant messages returns a 400 error on Claude Opus 4.7 and later models, including Claude Opus 5. Use structured outputs, system prompt instructions, or
output_config.formatinstead.
Choosing an effort level
The effort parameter allows you to tune Claude's intelligence versus token spend, trading off capability for faster speed and lower costs. Claude Opus 5 supports the full set of effort levels and defaults to high. Run a fresh effort sweep on your own evals rather than carrying over a setting tuned for an earlier model:
max: Can deliver gains on the most demanding tasks but may show diminishing returns from increased token usage and can be prone to overthinking on simpler ones. Test it where maximum capability matters more than token spend.xhigh: Extended capability for long-running agentic and coding work that needs more depth than the default.high: The default. Balances token usage and intelligence for most tasks.medium: Cost-saving step-down from the default, worth testing as a cost and latency control.low: Most efficient. Reserve for short, scoped tasks and latency-sensitive workloads.
If you run at xhigh or max effort, set a large max_tokens so the model has room to think and act; start at 64k tokens and tune from there. Effort is more important for this model than for any prior Opus. Experiment with it actively when you upgrade.
Behavior changes
Claude Opus 4.7 introduced several behavioral differences from Claude Opus 4.6 that are not API breaking changes but may require prompt updates or scaffolding removal. They carry forward to Claude Opus 5, with the adjustments noted in this list.
-
Response length varies by use case: Claude Opus 4.7 calibrates response length to how complex it judges the task to be, rather than defaulting to a fixed verbosity. This usually means shorter answers on simple lookups and much longer ones on open-ended analysis.
If your product depends on a certain style or verbosity of output, you may need to tune your prompts. For example, to decrease verbosity, add: "Provide concise, focused responses. Skip non-essential context, and keep examples minimal." If you see specific kinds of over-explaining, add targeted instructions in your prompt to prevent them.
Positive examples showing how Claude can communicate with the appropriate level of concision tend to be more effective than negative examples or instructions that tell the model what not to do. On Claude Opus 5, default visible responses and written deliverables run longer than on earlier Opus models, and lowering effort reduces thinking volume without reliably shortening the visible response; prompt explicitly for conciseness or a target length. See Response length and verbosity.
-
More literal instruction following: Claude Opus 4.7 interprets prompts more literally and explicitly than Claude Opus 4.6, particularly at lower effort levels. It does not silently generalize an instruction from one item to another, and it does not infer requests you didn't make. The upside of this literalism is precision and less thrash. It generally performs better for API use cases with carefully tuned prompts, structured extraction, and pipelines where you want predictable behavior. A prompt and harness review may be especially helpful for migration to Claude Opus 5.
-
More direct tone: As with any new model, prose style on long-form writing may shift. Claude Opus 4.7 is more direct and opinionated, with less validation-forward phrasing and fewer emoji than Claude Opus 4.6's warmer style. If your product relies on a specific voice, re-evaluate style prompts against the new baseline.
-
Built-in progress updates in agentic traces: Claude Opus 4.7 provides more regular, higher-quality updates to the user throughout long agentic traces. If you've added scaffolding to force interim status messages ("After every 3 tool calls, summarize progress"), try removing it. If you find that the length or contents of Claude Opus 4.7's user-facing updates are not well-calibrated to your use case, explicitly describe what these updates should look like in the prompt and provide examples.
-
Subagent spawning changed: Claude Opus 4.7 tends to spawn fewer subagents by default than Claude Opus 4.6, while Claude Opus 5 delegates to subagents more readily than earlier models. The behavior is steerable through prompting in either direction; give explicit guidance around when subagents are desirable, or cap the number of subagents. See Controlling subagent spawning.
-
Stricter effort calibration: Meaningfully changing from Claude Opus 4.6, Claude Opus 4.7 respects effort levels strictly, especially at the low end. At
lowandmedium, the model scopes its work to what was asked rather than doing more than requested.This is good for latency and cost, but on moderately complex tasks running at
loweffort there is some risk of under-thinking. If you observe shallow reasoning on complex problems, raise effort tohighorxhighrather than prompting around it.If you need to keep effort at
lowfor latency, add targeted guidance: "This task involves multistep reasoning. Think carefully through the problem before responding." See Recommended effort levels for Claude Opus 4.7. -
Fewer tool calls by default: Claude Opus 4.7 has a tendency to use tools less often than Claude Opus 4.6 and to use reasoning more. This produces better results in most cases.
To increase tool usage, raise the effort setting.
highorxhigheffort settings show substantially more tool usage in agentic search and coding. You can also adjust your prompt to explicitly instruct the model about when and how to properly use its tools. -
Real-time cybersecurity safeguards: Newly added in Claude Opus 4.7, requests that involve prohibited or high-risk topics may lead to refusals. For legitimate security work such as penetration testing, vulnerability research, or red-teaming, apply to the Cyber Verification Program to request reduced restrictions. The application route depends on how you access Claude.
-
High-resolution image support: Claude Opus 4.7 is the first Claude model with high-resolution image support. Maximum image resolution is 2,576 pixels on the long edge, up from 1,568 pixels on prior models. This unlocks gains on vision-heavy workloads and is particularly valuable for computer use, screenshot understanding, and document analysis.
High-resolution support is automatic and requires no beta header or client-side opt-in. Two things to plan for:
- Full-resolution images can use up to approximately 3x more image tokens than on prior models (up to 4,784 tokens per image, compared to the previous cap of roughly 1,600 tokens per image). Re-budget
max_tokensand cost expectations for image-heavy workloads, or downsample before sending if you do not need the additional fidelity. - Pointing and bounding-box coordinates returned by the model are 1:1 with actual image pixels on Claude Opus 4.7, so no scale-factor conversion is required.
See High-resolution image support on Claude Opus 4.7 for details.
- Full-resolution images can use up to approximately 3x more image tokens than on prior models (up to 4,784 tokens per image, compared to the previous cap of roughly 1,600 tokens per image). Re-budget
Recommended changes
These are not required but will improve your experience:
-
Re-evaluate
max_tokens: Because the same text produces a higher token count on Claude Opus 4.7 and later models, update yourmax_tokensparameters to give additional headroom, including compaction triggers. Prompting interventions,task_budget, andeffortcan help control costs and ensure appropriate token usage. -
Audit token-count expectations: Any code path that estimates tokens client-side or assumes a fixed token-to-character ratio should be re-tested against Claude Opus 5. Use the Token counting endpoint to verify.
-
Adopt task budgets (beta): Claude Opus 4.7 introduces task budgets. These budgets let you inform Claude how many tokens it has for a full agentic loop, including thinking, tool calls, tool results, and final output. The model sees a running countdown and uses it to prioritize work and finish the task gracefully as the budget is consumed. To use, set the beta header
task-budgets-2026-03-13and add the following to your output config:output_config = { "effort": "high", "task_budget": {"type": "tokens", "total": 128000}, }You may need to experiment with different task budgets for your use case. If the model is given a task budget that is too restrictive, it may complete the task less thoroughly, referencing its budget as the constraint.
For open-ended agentic tasks where quality matters more than speed, do not set a task budget. Reserve task budgets for workloads where you need the model to scope its work to a token allowance. The minimum value for a task budget is 20k tokens.
A task budget is not a hard cap; it's a suggestion that the model is aware of. It differs from
max_tokens:task_budget: an advisory cap across the full agentic loop. The model sees it and uses it to pace itself.max_tokens: a hard per-request ceiling on generated tokens. It is not passed to the model, so the model is not aware of it.
Use
task_budgetwhen you want the model to self-moderate, andmax_tokensas a hard ceiling to cap usage. -
Set a large
max_tokensatmaxorxhigheffort: If you are running Claude Opus 4.7 or a later model atmaxorxhigheffort, set a large max output token budget so the model has room to think and act across its subagents and tool calls. Start at 64k tokens and tune from there. -
Downsample images if high resolution is unnecessary: Claude Opus 4.7 and later models support images up to 2576px / 3.75MP. High-res images use more tokens. If the additional image fidelity is unnecessary, downsample images before sending to Claude to avoid token-usage increases. See Images and vision.
-
Consider automatic fallbacks: Claude Opus 5 ships with cybersecurity safety classifiers whose cyber-category refusals can fall back to Claude Opus 4.8. To re-run refused requests on another model automatically, consider the
fallbacksparameter with the"default"mode (fallbacks: "default"), which selects a recommended fallback model based on the refusal category instead of a hand-maintained model list. Server-side fallback is in beta; the"default"mode requires theserver-side-fallback-2026-07-01beta header. See Refusals and fallback. -
Cache shorter prompts: The minimum cacheable prompt length on Claude Opus 5 is 512 tokens, lower than on earlier Opus models. Prompts that were too short to cache can now create cache entries, with no code changes required. See Prompt caching for per-model minimums.
-
Change tools mid-conversation (beta): You can add or remove tools between turns of a conversation without invalidating prompt cache hits on earlier turns. Send the beta header
mid-conversation-tool-changes-2026-07-01. This is useful for agentic workloads that expose tools progressively or retire them as a task advances; without it, a changed tool list invalidates the cached prefix. -
Remove carried-over verification instructions and constrain scope: Claude Opus 5 verifies its own work without being told to, so remove explicit verification or self-check instructions carried over from prompts tuned for earlier models; leaving them in causes over-verification. For narrow tasks, constrain the task scope explicitly. See Task scope and over-verification.
Migration checklist
- Update model name from
claude-opus-4-6toclaude-opus-5(or update aliases). - Remove
temperature,top_p, andtop_kfrom request payloads. - Replace
thinking: {type: "enabled", budget_tokens: N}withthinking: {type: "adaptive"}plus the effort parameter, or remove thethinkingfield entirely; adaptive thinking is on by default on Claude Opus 5. - Review workloads that ran without a
thinkingfield: they run with thinking on Claude Opus 5. Revisitmax_tokens, which remains a hard limit on total output (thinking plus response text), or passthinking: {type: "disabled"}at efforthighor below to preserve the old behavior. - Update response parsing that reads content by position, such as
content[0].textor a stream handler that assumes the first content block is text: with thinking on,thinkingblocks arrive beforetextblocks. Select content blocks bytypeinstead. - If you run a tool-use loop, pass
thinkingblocks back complete and unmodified when you return tool results; modified blocks return a 400 error. See Preserving thinking blocks. - Audit requests that disable thinking:
thinking: {type: "disabled"}with effortxhighormaxreturns a 400 error, enforced on each request. Re-enable thinking or lower the effort tohighor below. - Remove any assistant-message prefills.
- If your UI displays thinking content, explicitly opt in to thinking summarization.
- Re-benchmark end-to-end cost and latency under the updated tokenization; thinking tokens are billed as output tokens, so workloads that ran without thinking can also produce more output tokens per request.
- Re-tune
max_tokensto account for the updated tokenization. - Re-test any client-side token-count estimations.
- If your application sends images, re-budget for high-resolution image support (up to approximately 3x more image tokens per full-resolution image). Downsample before sending if you do not need the additional fidelity.
- If you consume pointing or bounding-box coordinates from the model, remove any scale-factor conversion; coordinates are 1:1 with actual image pixels on Claude Opus 4.7 and later models.
- Review prompts for the behavior changes (response length, literalism, tone, progress updates, subagents, effort calibration, tool triggering, cyber safeguards, high-resolution image handling).
- Re-baseline response length with existing length-control prompts removed, then tune explicitly.
- If using
xhighormaxeffort, raisemax_tokensto at least 64k as a starting point. - Consider adopting task budgets (beta) and mid-conversation tool changes (beta) for agentic workflows.
- Handle
stop_reason: "refusal", and considerfallbacks: "default"(beta) to re-run refused requests on a recommended fallback model automatically. - Review prompts near the caching minimum: prompts of 512 tokens or more can now create cache entries on Claude Opus 5.
- If you use web fetch, plan an alternative: it is not available on Claude Opus 5.
- If your organization has a Priority Tier commitment, note that Priority Tier is not supported on Claude Opus 5.
- Remove verification and self-check instructions carried over from prompts tuned for earlier models; they cause over-verification on Claude Opus 5.
- If your product does legitimate security work, apply to the Cyber Verification Program for access to lower restrictions on cyber content.
Migrating from Claude Opus 4.5 or earlier
If you are migrating from Claude Opus 4.5, Opus 4.1, or an earlier model directly to Claude Opus 5, apply all of the changes earlier in this section plus the following cumulative changes, which took effect between Opus 4.5 and Opus 4.7. If you are migrating from Opus 4.6, the changes earlier in this section are all you need.
Update your model name
# Opus migration
model = "claude-opus-4-5" # Before
model = "claude-opus-5" # AfterBreaking changes
-
Prefill removal is covered in the breaking changes for migrating from Claude Opus 4.6.
-
Tool parameter quoting: Claude Opus 4.6 and later models may produce slightly different JSON string escaping in tool call arguments (for example, different handling of Unicode escapes or forward slash escaping). If you parse tool call
inputas a raw string rather than using a JSON parser, verify your parsing logic. Standard JSON parsers (such asjson.loads()orJSON.parse()) handle these differences automatically.
Recommended changes
These changes improve your experience on Claude Opus 4.7 and later models. Items marked (required on Opus 4.7) were optional recommendations when Opus 4.6 launched but are now mandatory; the rest remain recommended.
-
Migrate to adaptive thinking (required on Opus 4.7):
thinking: {type: "enabled", budget_tokens: N}returns a 400 error on Claude Opus 4.7 and later models. Switch tothinking: {type: "adaptive"}and use the effort parameter to control thinking depth; on Claude Opus 5,thinking: {type: "adaptive"}is equivalent to omitting thethinkingfield, which runs with adaptive thinking by default. See Thinking.response = client.beta.messages.create( model="claude-opus-4-5", max_tokens=16000, thinking={"type": "enabled", "budget_tokens": 32000}, betas=["interleaved-thinking-2025-05-14"], messages=[{"role": "user", "content": "Your prompt here"}], )Note that the migration also moves from
client.beta.messages.createtoclient.messages.create. Adaptive thinking and effort do not require the beta SDK namespace or any beta headers. -
Remove effort beta header: The effort parameter does not require a beta header. Remove
betas=["effort-2025-11-24"]from your requests. -
Remove fine-grained tool streaming beta header: Fine-grained tool streaming does not require a beta header. Remove
betas=["fine-grained-tool-streaming-2025-05-14"]from your requests. -
Remove interleaved thinking beta header: Adaptive thinking automatically enables interleaved thinking on Claude Opus 4.7, Opus 4.6, and Sonnet 4.6. Remove
betas=["interleaved-thinking-2025-05-14"]from your requests. The header is still functional on Sonnet 4.6 with manual extended thinking, but manual mode is deprecated. -
Migrate to output_config.format: If using structured outputs, update
output_format={...}tooutput_config={"format": {...}}. The API still accepts the deprecatedoutput_formatparameter, but it will be removed in a future model release. The Python SDK (v1.0 and later) does not acceptoutput_format={...}onclient.beta.messages.create()orcount_tokens(). Theoutput_format=Modelargument of theparse()andstream()helpers is unchanged.
Migrating from Claude 4.1 or earlier
If you're migrating from Opus 4.1 or earlier models directly to Claude Opus 5, apply all of the changes earlier in this section, plus the additional changes in this sub-section.
# From Opus 4.1
model = "claude-opus-4-1-20250805" # Before
model = "claude-opus-5" # After
# From Sonnet 3.7
model = "claude-3-7-sonnet-20250219" # Before
model = "claude-opus-5" # AfterAdditional breaking changes
-
Remove sampling parameters
Starting with Claude Opus 4.7, setting
temperature,top_p, ortop_kto any non-default value returns a 400 error. The Python SDK (v1.0 and later) does not define them, and passing them raises aTypeError. The safest migration path is to omit these parameters entirely from requests, and to use prompting to guide the model's behavior. If you were usingtemperature = 0for determinism, note that it never guaranteed identical outputs.# Before - This will error in Claude 4+ models response = client.messages.create( model="claude-3-7-sonnet-20250219", temperature=0.7, top_p=0.9, # Non-default sampling params return 400 on Opus 4.7 # ... ) # After response = client.messages.create( model="claude-opus-5", # ... ) -
Update tool versions
Update to the latest tool versions. Remove any code using the
undo_editcommand.# Before tools = [{"type": "text_editor_20250124", "name": "str_replace_editor"}] # After tools = [{"type": "text_editor_20250728", "name": "str_replace_based_edit_tool"}]- Text editor: Use
text_editor_20250728andstr_replace_based_edit_tool. See Text editor tool documentation for details. - Code execution: Upgrade to
code_execution_20260521. See Code execution tool documentation for migration instructions.
- Text editor: Use
-
Handle the
refusalstop reasonUpdate your application to handle
refusalstop reasons:response = client.messages.create(...) if response.stop_reason == "refusal": # Handle refusal appropriately pass -
Handle the
model_context_window_exceededstop reasonClaude 4.5+ models return a
model_context_window_exceededstop reason when generation stops because of hitting the context window limit, rather than the requestedmax_tokenslimit. Update your application to handle this new stop reason:response = client.messages.create(...) if response.stop_reason == "model_context_window_exceeded": # Handle context window limit appropriately pass -
Verify tool parameter handling (trailing newlines)
Claude 4.5+ models preserve trailing newlines in tool call string parameters that were previously stripped. If your tools rely on exact string matching against tool call parameters, verify your logic handles trailing newlines correctly.
-
Update your prompts for behavioral changes
Claude 4+ models have a more concise, direct communication style and require explicit direction. Review prompting best practices for optimization guidance.
Additional recommended changes
- Remove legacy beta headers: Remove
token-efficient-tools-2025-02-19andoutput-128k-2025-02-19. All Claude 4+ models have built-in token-efficient tool use and these headers have no effect.
Migration checklist (from Claude Opus 4.5 or earlier)
- Update model ID to
claude-opus-5 - Apply all of the breaking changes for migrating from Claude Opus 4.6 (extended thinking removed, thinking on by default, effort cap on disabling thinking, sampling parameters removed, thinking display omitted by default, updated tokenization)
- BREAKING: Remove assistant message prefills (returns 400 error); use structured outputs or
output_config.formatinstead - BREAKING on Opus 4.7: Replace
thinking: {type: "enabled", budget_tokens: N}withthinking: {type: "adaptive"}plus the effort parameter (returns 400 on Opus 4.7) - Verify tool call JSON parsing uses a standard JSON parser
- Remove
effort-2025-11-24beta header (the effort parameter does not require it) - Remove
fine-grained-tool-streaming-2025-05-14beta header - Remove
interleaved-thinking-2025-05-14beta header (adaptive thinking enables interleaved thinking automatically) - Migrate
output_formattooutput_config.format(if applicable) - If migrating from Claude 4.1 or earlier: remove
temperature,top_p, andtop_k(non-default values return 400 on Opus 4.7) - If migrating from Claude 4.1 or earlier: update tool versions (
text_editor_20250728,code_execution_20260521) - If migrating from Claude 4.1 or earlier: handle
refusalstop reason - If migrating from Claude 4.1 or earlier: handle
model_context_window_exceededstop reason - If migrating from Claude 4.1 or earlier: verify tool string parameter handling for trailing newlines
- If migrating from Claude 4.1 or earlier: remove legacy beta headers (
token-efficient-tools-2025-02-19,output-128k-2025-02-19) - Review and update prompts following prompting best practices
- Test in development environment before production deployment
Migrating to Claude Opus 5 from Claude Sonnet 5
Claude Opus 5 and Claude Sonnet 5 share the same API surface: both run with adaptive thinking on by default, both default the effort parameter to high on the Claude API and Claude Code, both serve a 1M token context window by default with 128k max output tokens, and neither supports Priority Tier. Manual extended thinking and non-default sampling parameters return a 400 error on both models, as does assistant prefill.
Update your model name
model = "claude-sonnet-5" # Before
model = "claude-opus-5" # AfterWhat changed
-
Pricing: Claude Opus 5 is priced at $5 USD per million input tokens and $25 USD per million output tokens. Claude Sonnet 5 is priced at $2/$10 USD per million input/output tokens. See Claude pricing for complete pricing.
-
Disabling thinking is capped at
higheffort: On Claude Sonnet 5,thinking: {type: "disabled"}is accepted at any effort level. On Claude Opus 5, it is accepted only at an effort level ofhighor below; a request that combinesthinking: {type: "disabled"}with effortxhighormaxreturns a 400 error, enforced on each request. Audit requests that disable thinking before you migrate. -
Mid-conversation system messages: Claude Opus 5 accepts
role: "system"messages immediately after a user turn in themessagesarray (subject to placement rules). This feature is not available on Claude Sonnet 5. If you maintain code paths that rebuild the full message history to update instructions, you can simplify them and preserve prompt cache hits on earlier turns. -
Web fetch is not available: The web fetch tool is available on Claude Sonnet 5 but not on Claude Opus 5.
Migration checklist
- Update the model name from
claude-sonnet-5toclaude-opus-5. - Audit requests that disable thinking:
thinking: {type: "disabled"}with effortxhighormaxreturns a 400 error on Claude Opus 5. Re-enable thinking or lower the effort tohighor below. - If you use web fetch, plan an alternative: it is not available on Claude Opus 5.
- Re-run token counting against Claude Opus 5 rather than reusing counts measured against Claude Sonnet 5, and re-baseline cost and latency on your own workloads; per-token pricing differs.
Was this page helpful?