GuideOpen

Claude model migration guide

The Model Migration Guide is a shared file in Anthropic's claude-api skill for developers moving existing code to newer Claude models. It covers breaking changes, deprecated parameters and drop-in replacements for retired models, and when reached through /claude-api migrate Claude executes its steps in order.

What it does

Step 0 confirms the scope before any edit and Step 1 classifies each file as swap, add alongside or skip. Further sections cover per-SDK syntax, destination models, retired model replacements and breaking changes by source model.

How to use it

Read Step 0 and Step 1, then only the section for your target model; the file is large, so search for heading text.

Requirements and limits

For the latest picture after a model launch, the guide points to the live Migration Guide URL.

More in Guides and the Claude Code library.

Full text

Model Migration Guide

If you arrived via /claude-api migrate: this is the right file. Execute the steps below in order - do not summarize them back to the user. Start with Step 0 (confirm scope) before touching any file.

How to move existing code to newer Claude models. Covers breaking changes, deprecated parameters, and drop-in replacements for retired models.

For the latest, authoritative version (with code samples in every supported language), WebFetch the Migration Guide URL from shared/live-sources.md. Use this file for the consolidated, skill-resident reference; fall back to the live docs whenever a model launch or breaking change may have shifted the picture.

This file is large. Use the section names below to jump (or Grep this file for the heading text). Read Step 0 and Step 1 first - they apply to every migration. Then read only the per-target section for the model you are migrating to.

SectionWhen you need it
Step 0: Confirm the migration scopeAlways - before any edits
Step 1: Classify each fileAlways - decides whether to swap, add-alongside, or skip
Per-SDK Syntax ReferenceTranslate the Python examples in this guide to TypeScript / Go / Ruby / Java / C# / PHP
Destination Models / Retired Model ReplacementsPicking a target model
Breaking Changes by Source ModelMigrating to Opus 4.6 / Sonnet 4.6
Migrating to Opus 4.7Migrating to Opus 4.7 (breaking changes, silent defaults, behavioral shifts)
Opus 4.7 Migration ChecklistThe required vs optional items for 4.7, tagged [BLOCKS] / [TUNE]
Migrating to Opus 4.8Migrating to Opus 4.8 (no new breaking changes; mid-session system prompts; behavioral re-tuning)
Opus 4.8 Migration ChecklistThe required vs optional items for 4.8, tagged [BLOCKS] / [TUNE]
Migrating to Claude Opus 5Migrating Opus 4.8 -> Claude Opus 5 (thinking-disabled effort-gated; mid-conversation tool changes; per-turn effort and task budget; verbosity, over-verification, and scope re-tuning)
Claude Opus 5 Migration ChecklistThe required vs optional items for Claude Opus 5, tagged [BLOCKS] / [TUNE]
Migrating to Claude Sonnet 5Migrating Sonnet 4.6 -> Claude Sonnet 5 (adaptive thinking on by default; non-default sampling params 400; new tokenizer; xhigh effort for coding/agentic; high-res vision; behavioral re-tuning)
Claude Sonnet 5 Migration ChecklistThe required vs optional items, tagged [BLOCKS] / [TUNE]
Migrating to Claude Fable 5.1Migrating to Claude Fable 5.1 or Claude Mythos 5.1 (always-on thinking, raw chain of thought never returned, refusal handling, data retention, behavioral shifts + prompting guidance)
Claude Fable 5.1 Migration ChecklistThe required vs optional items for Claude Fable 5.1, tagged [BLOCKS] / [TUNE]
Migrating to Claude Fable 5.1 from Claude Fable 5Migrating Claude Fable 5 / Claude Opus 5 / Claude Mythos 5 -> Claude Fable 5.1 or Claude Mythos 5.1 (forced tool_choice 400s; "preserved thinking" - model-bound blocks and, on Claude Fable 5.1, the history-editing check; per-message effort; append-only per-turn reminders; display: "updates" progress updates; cheaper cache reads; behavioral re-tuning)
Claude Fable 5.1 from Claude Fable 5 Migration ChecklistThe required vs optional items for the Claude Fable 5 -> Claude Fable 5.1 move, tagged [BLOCKS] / [TUNE]
Migrating to Claude Opus 5.5Migrating Claude Opus 5 -> Claude Opus 5.5 (thinking can't be disabled; forced tool_choice 400s; preserved thinking; computer use via the toolset on the Claude API and Google Cloud; progress updates as thinking blocks; default effort medium; broader classifiers; effort tuning + prompting guidance)
Claude Opus 5.5 Migration ChecklistThe required vs optional items for Claude Opus 5.5, tagged [BLOCKS] / [TUNE]
Migrating to Claude Sonnet 5.5Migrating Claude Sonnet 5 -> Claude Sonnet 5.5 (disabled thinking 400s - between_tools instead; forced tool_choice 400s; preserved thinking; computer use via the toolset on the Claude API and Google Cloud; fewer advisor pairings; progress updates as thinking blocks; recalibrated effort; five refusal categories; prompting guidance)
Claude Sonnet 5.5 Migration ChecklistThe required vs optional items for Claude Sonnet 5.5, tagged [BLOCKS] / [TUNE]
Migrating to Claude Haiku 5.5Migrating Claude Haiku 4.5 -> Claude Haiku 5.5 (budget_tokens 400s - adaptive thinking only, on by default; non-default sampling params 400; prefill 400; computer use via the toolset on the Claude API and Google Cloud; preserved thinking's history-editing check; newer tokenizer; account-bound thinking blocks; effort, default medium; safeguard refusals with no server-side fallback; 1M context / 128K output; prompting guidance)
Claude Haiku 5.5 Migration ChecklistThe required vs optional items for Claude Haiku 5.5, tagged [BLOCKS] / [TUNE]
Verify the MigrationAfter edits - runtime spot-check
Ground the migration with an evalUser reports a behavioral regression on the new model

TL;DR: Change the model ID string. If you were using budget_tokens, switch to thinking: {type: "adaptive"}. If you were using assistant prefills, they 400 on both Opus 4.6 and Sonnet 4.6 - switch to one of the prefill replacements (most often output_config.format; see the table in Breaking Changes by Source Model). If you're moving from Sonnet 4.5 to Sonnet 4.6, set effort explicitly - 4.6 defaults to high. Remove the effort-2025-11-24 and fine-grained-tool-streaming-2025-05-14 beta headers (GA on 4.6); remove interleaved-thinking-2025-05-14 once you're on adaptive thinking (keep it only while using the transitional budget_tokens escape hatch). Then drop back from client.beta.messages.create to client.messages.create. Dial back any aggressive "CRITICAL: YOU MUST" tool instructions; 4.6 follows the system prompt much more closely.


Step 0: Confirm the migration scope

Before any Write, Edit, or MultiEdit call, confirm the scope. If the user's request does not explicitly name a single file, a specific directory, or an explicit file list, ask first - do not start editing. This is non-negotiable: even imperative-sounding requests like "migrate my codebase", "move my project to X", "upgrade to Sonnet 4.6", or bare "migrate to Opus 4.7" leave the scope ambiguous and require a clarifying question. Phrases like "my project", "my code", "my codebase", "the whole thing", "everywhere", or "across the repo" are ambiguous, not directive - they tell you what to do but not where. Ask before doing.

Offer the common scopes explicitly and wait for the answer before touching any file:

  1. The entire working directory
  2. A specific subdirectory (e.g. src/, app/, services/billing/)
  3. A specific file or a list of files

Surface this as a single clarifying question so the user can answer in one turn. Proceed without asking only when the scope is already unambiguous - the user named an exact file ("migrate extract.py to Sonnet 4.6"), pointed at a specific directory ("migrate everything under services/billing/ to Opus 4.6"), listed specific files ("update a.py and b.py"), or already answered the scope question in an earlier turn. If you can answer the question "which files is this change going to touch?" with a precise list from the prompt alone, proceed. If not, ask.

Worked example. If the user says "Move my project to Opus 4.6. I want adaptive thinking everywhere it makes sense." you do not know whether "my project" means the whole working directory, just src/, just the production code, or something else - the everywhere makes the intent clear (update every call site within scope) but the scope itself is still not defined. Do not start editing. Respond with:

Before I start editing, can you confirm the scope? I can migrate: 1. Every .py file in the working directory 2. Just the files under src/ (production code) 3. A specific subdirectory or list of files you name Which one?

Then wait for the answer. The same applies to "Migrate to Opus 4.7" and bare "Help me upgrade to Sonnet 4.6" - ask before editing.

Sizing the scope question (large repos). Before asking, get a per-directory count so the user can pick concretely:

rg -l "<old-model-id>" --type-not md | cut -d/ -f1 | sort | uniq -c | sort -rn

Present the breakdown in your scope question (e.g. "Found 217 references across 3 directories: api/ (130), api-go/ (62), routing/ (25). Which to migrate?"). Also confirm git status is clean before surveying - unexpected modifications mean a concurrent process; stop and investigate before proceeding.


Step 1: Classify each file

Not every file that contains the old model ID is a caller of the API. Before editing, classify each file into one of these buckets - the right action differs:

#BucketWhat it looks likeAction
1Calls the API/SDKclient.messages.create(model=...), anthropic.Anthropic(), request payloadsSwap the model ID and apply the breaking-change checklist for the target version (below).
2Defines or serves the modelModel registries, OpenAPI specs, routing/queue configs, model-policy enums, generated catalogsThe old entry stays (the model is still served). Ask whether to (a) add the new model alongside, (b) leave alone, or (c) retire the old model - never blind-replace. If you can't ask, default to (a): add the new model alongside and flag it - replacing would de-register a model that's still in production.
3References the ID as an opaque stringUI fallback constants, capability-gate substring checks, generic test fixtures, label parsers, env defaultsUsually swap the string and verify any parser/regex/substring match handles the new ID - but check the sub-cases below first.
4Suffixed variant IDclaude-<model>-<suffix> like -fast, -1024k, -200k, [1m], dated snapshotsThese are deployment/routing identifiers, not the public model ID. Do not assume a new-model equivalent exists. Verify in the registry first; if absent, leave the string alone and flag it. Exception: -fast strings (e.g. claude-opus-4-6-fast) are handled by the Fast Mode section below, which rewrites them to Claude Opus 5.5 plus speed="fast" and the fast-mode-2026-02-01 beta rather than leaving them in place.

Bucket 3 sub-cases - before swapping a string reference, check:

  • Capability gate (e.g. if 'opus-4-6' in model_id: enables a feature) -> add the new ID alongside, don't replace. The old model is still served and still has the capability, so replacing would silently disable the feature for any old-model traffic that still flows through. If you know no old-model traffic will hit this gate (single-caller codebase fully migrating), replacing is fine; if unsure, add alongside.
  • Registry-assert test (e.g. assert "claude-X" in supported_models, test_X_has_N_clusters) -> add an assertion for the new model alongside; keep the old one. The old model is still served, so its assertion stays valid - but the registry should also include the new model, so assert that too. Heuristic: if the test references multiple model versions in a list, it's a registry test; if one model in a struct compared only to itself, it's a generic fixture.
  • Frozen / generated snapshot -> regenerate, don't hand-edit.
  • Coupled to a definer (e.g. an integration test that passes model authorization via a shared conftest seed list, or asserts on a billing-tier / rate-limit-group enum or a generated SKU/pricing catalog) -> verify the definer has a new-model entry first. If not, add a seed entry (reusing the nearest existing tier as a placeholder); if you can't confidently do that, ask the user how to populate the definer. Do not skip the test. Swapping without populating the definer will make the test fail at runtime.

When migrating tests specifically: breaking parameters (temperature, top_p, budget_tokens) are usually absent - test fixtures rarely set sampling params on placeholder models. The breaking-change scan is still required, but expect mostly clean results.

Find intentionally-flagged sync points first. Many codebases tag spots that must change at every model launch with comment markers like MODEL LAUNCH, KEEP IN SYNC, @model-update, or similar. Grep for whatever convention the repo uses before the broad model-ID grep - those markers point at the load-bearing changes.


Per-SDK Syntax Reference

Code examples in this guide are Python. The same fields exist in every official Anthropic SDK - Stainless generates all 7 from the same OpenAPI spec, so JSON field names map 1:1 with only case-convention differences. Use the rows below to translate the Python examples to the SDK you are migrating.

Verify type and method names against the SDK source before writing them into customer code. WebFetch the relevant repository from the SDK source-code table in shared/live-sources.md (one row per SDK) and confirm the exact symbol - particularly for typed SDKs (Go, Java, C#) where union/builder names can differ from the JSON shape. Do not guess type names that aren't in the table below or in <lang>/claude-api/README.md.

thinking - budget_tokens -> adaptive

SDKBeforeAfter
Pythonthinking={"type": "enabled", "budget_tokens": N}thinking={"type": "adaptive"}
TypeScriptthinking: { type: 'enabled', budget_tokens: N }thinking: { type: 'adaptive' }
GoThinking: anthropic.ThinkingConfigParamOfEnabled(N)Thinking: anthropic.ThinkingConfigParamUnion{OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{}}
Rubythinking: { type: "enabled", budget_tokens: N }thinking: { type: "adaptive" }
Java.thinking(ThinkingConfigEnabled.builder().budgetTokens(N).build()).thinking(ThinkingConfigAdaptive.builder().build())
C#Thinking = new ThinkingConfigEnabled { BudgetTokens = N }Thinking = new ThinkingConfigAdaptive()
PHPthinking: ['type' => 'enabled', 'budget_tokens' => N]thinking: ['type' => 'adaptive']

Sampling parameters - temperature / top_p / top_k

(Remove the field entirely on Opus 4.7; on Claude 4.x keep at most one of temperature or top_p.)

SDKField(s) to remove
Pythontemperature=..., top_p=..., top_k=...
TypeScripttemperature: ..., top_p: ..., top_k: ...
GoTemperature: anthropic.Float(...), TopP: anthropic.Float(...), TopK: anthropic.Int(...)
Rubytemperature: ..., top_p: ..., top_k: ...
Java.temperature(...), .topP(...), .topK(...)
C#Temperature = ..., TopP = ..., TopK = ...
PHPtemperature: ..., topP: ..., topK: ...

Prefill replacement - structured outputs via output_config.format

SDKRemove (last assistant turn)Add
Python{"role": "assistant", "content": "..."}output_config={"format": {"type": "json_schema", "schema": SCHEMA}}
TypeScript{ role: 'assistant', content: '...' }output_config: { format: { type: 'json_schema', schema: SCHEMA } }
Gotrailing anthropic.MessageParam{Role: "assistant", ...}OutputConfig: anthropic.OutputConfigParam{Format: anthropic.JSONOutputFormatParam{...}}
Ruby{ role: "assistant", content: "..." }output_config: { format: { type: "json_schema", schema: SCHEMA } }
Javatrailing Message.builder().role(ASSISTANT)....outputConfig(OutputConfig.builder().format(JsonOutputFormat.builder()...build()).build())
C#trailing new Message { Role = "assistant", ... }OutputConfig = new OutputConfig { Format = new JsonOutputFormat { ... } }
PHPtrailing ['role' => 'assistant', 'content' => '...']outputConfig: ['format' => ['type' => 'json_schema', 'schema' => $SCHEMA]]

thinking.display - opt back into summarized reasoning (Opus 4.7)

SDKAdd
Pythonthinking={"type": "adaptive", "display": "summarized"}
TypeScriptthinking: { type: 'adaptive', display: 'summarized' }
GoThinking: anthropic.ThinkingConfigParamUnion{OfAdaptive: &anthropic.ThinkingConfigAdaptiveParam{Display: anthropic.ThinkingConfigAdaptiveDisplaySummarized}}
Rubythinking: { type: "adaptive", display: "summarized" } (or display_: when constructing the model class directly)
Java.thinking(ThinkingConfigAdaptive.builder().display(ThinkingConfigAdaptive.Display.SUMMARIZED).build())
C#Thinking = new ThinkingConfigAdaptive { Display = Display.Summarized }
PHPthinking: ['type' => 'adaptive', 'display' => 'summarized']

For any field not in these tables, the JSON key in the Python example translates directly: snake_case for Python/TypeScript/Ruby, camelCase named args for PHP, PascalCase struct fields for Go/C#, camelCase builder methods for Java.


Explain every change you make

Migration edits often look arbitrary to a user who hasn't read the release notes - a removed temperature, a deleted prefill, a rewritten system-prompt sentence. For each edit, tell the user what you changed and why, tied to the specific API or behavioral change that motivates it. Do this in your summary as you work, not just at the end.

Be especially explicit about system-prompt edits. Users are rightly protective of their prompts, and prompt-tuning changes are judgment calls (not hard API requirements). For any prompt edit:

  • Quote the before and after text.
  • State the behavioral shift that motivates it (e.g. "Opus 4.7 calibrates response length to task complexity, so I added an explicit length instruction", or "4.6 follows instructions more literally, so 'CRITICAL: YOU MUST use the search tool' will now overtrigger - softened to 'Use the search tool when...'").
  • Make clear which prompt edits are optional tuning (tone, length, subagent guidance) versus which code edits are required to avoid a 400 (sampling params, budget_tokens, prefills). Never present an optional prompt change as mandatory.

If you're applying several prompt-tuning edits at once, offer them as a short list the user can accept or decline item-by-item rather than silently rewriting their system prompt.


Before You Migrate

  1. Confirm the target model ID. Use only the exact strings from shared/models.md - do not append date suffixes to aliases (claude-opus-4-6, not claude-opus-4-6-20251101). Guessing an ID will 404.
  2. Check which features your code uses with this checklist:
  • thinking: {type: "enabled", budget_tokens: N} -> migrate to adaptive thinking on Opus 4.6 / Sonnet 4.6 (still functional but deprecated)
  • Assistant-turn prefills (messages ending with role: "assistant") -> must change on Opus 4.6 / Sonnet 4.6 (returns 400)
  • output_format parameter on messages.create() -> must change on all models (deprecated API-wide)
  • max_tokens > ~16000 -> must stream on any model (above ~16K risks SDK HTTP timeouts). When streaming, every current model reaches 128K except Haiku 4.5, which caps at 64K
  • Beta headers effort-2025-11-24, fine-grained-tool-streaming-2025-05-14, interleaved-thinking-2025-05-14 -> GA on 4.6, remove them and switch from client.beta.messages.create to client.messages.create
  • Moving Sonnet 4.5 -> Sonnet 4.6 with no effort set -> 4.6 defaults to high, which may change your latency/cost profile
  • System prompts with CRITICAL, MUST, If in doubt, use X language -> likely to overtrigger on 4.6 (see Prompt-Behavior Changes)
  • Coming from 3.x / 4.0 / 4.1: also check sampling params (temperature + top_p), tool versions (text_editor_20250728), refusal + model_context_window_exceeded stop reasons, trailing-newline tool-param handling
  1. Test on a single request first. Run one call against the new model, inspect the response, then roll out.

Destination Models (recommended targets)

If you're on...Migrate toWhy
Claude Mythos Preview (claude-mythos-preview)claude-mythos-5-1 (Project Glasswing successor) or claude-fable-5-1 (GA)Same tokenizer family - mostly a model-ID swap; remove thinking config and prefill; see Migrating to Claude Fable 5.1
Claude Fable 5 (claude-fable-5)claude-fable-5-1Same tier, same per-token price, same tokenizer; three breaking changes (forced tool_choice 400s, "preserved thinking") - see Migrating to Claude Fable 5.1 from Claude Fable 5
Claude Mythos 5 (claude-mythos-5)claude-mythos-5-1Same path as claude-fable-5 -> claude-fable-5-1; see ยง Claude Mythos 5.1 under Migrating to Claude Fable 5.1 from Claude Fable 5
Claude Opus 5 (claude-opus-5)claude-opus-5-5The current Opus. Lower price ($4 / $20 vs $5 / $25), same context window and tokenizer; four breaking changes (thinking can't be disabled, forced tool_choice 400s, preserved thinking, computer use via the toolset on the Claude API and Google Cloud) - see Migrating to Claude Opus 5.5
Opus 4.8claude-opus-5-5Apply the Claude Opus 5 section (thinking on by default, prompt re-tuning), then the Claude Opus 5.5 section, which replaces Claude Opus 5's thinking-disabled route and computer_20251124
Opus 4.7claude-opus-5-5Apply the Opus 4.8 section (prompt re-tuning, no new breaking changes), then the Claude Opus 5 and Claude Opus 5.5 sections
Opus 4.6claude-opus-5-5Apply the Opus 4.7 breaking changes, then 4.8 re-tuning, then the Claude Opus 5 and Claude Opus 5.5 sections
Opus 4.0 / 4.1 / 4.5 / Opus 3claude-opus-5-5Apply 4.6 -> 4.7 -> 4.8 -> Claude Opus 5 -> Claude Opus 5.5 in order (adaptive thinking, drop sampling params, then re-tune)
Claude Sonnet 5 (claude-sonnet-5)claude-sonnet-5-5The current Sonnet. Same prices and tokenizer; five breaking changes (disabled thinking 400s - use between_tools, forced tool_choice 400s, preserved thinking, computer use via the toolset on the Claude API and Google Cloud, fewer advisor pairings) - see Migrating to Claude Sonnet 5.5
Sonnet 4.6claude-sonnet-5-5Apply the Claude Sonnet 5 section (adaptive thinking on by default, new tokenizer), then the Claude Sonnet 5.5 section, which replaces its thinking-disabled route, forced tool_choice on Bedrock, computer_20251124, and effort advice
Sonnet 4.0 / 4.5 / 3.7 / 3.5claude-sonnet-5-5Apply the Sonnet 4.6 changes first, then the Claude Sonnet 5 and Claude Sonnet 5.5 sections
Claude Haiku 4.5 (claude-haiku-4-5)claude-haiku-5-5The current Haiku. 1M context and 128K output, adaptive thinking with effort; five breaking changes (budget_tokens 400s, non-default sampling parameters 400, prefill 400, computer use via the toolset on the Claude API and Google Cloud, preserved thinking's history-editing check) and a newer tokenizer - see Migrating to Claude Haiku 5.5
Haiku 3 / 3.5claude-haiku-5-5Apply the 3.x changes (Additional Changes When Coming from 3.x / 4.0 / 4.1 -> 4.6), then the Claude Haiku 5.5 section

Default to the latest Opus (Claude Opus 5.5) for the caller's tier unless they explicitly chose otherwise. The Sonnet target is Claude Sonnet 5.5 (claude-sonnet-5-5), and the Haiku target is Claude Haiku 5.5 (claude-haiku-5-5). The Opus migrations layer: if you're on an older Opus, apply each version's section in order up to your target (e.g. 4.5 -> 4.8 means the 4.6, 4.7, and 4.8 sections in sequence). A 4.7 -> 4.8 move has no new breaking changes - see Migrating to Opus 4.8 below.


Retired Model Replacements

These models return 404 - update immediately:

Retired modelRetiredDrop-in replacement
claude-3-7-sonnet-20250219Feb 19, 2026claude-sonnet-5-5
claude-3-5-haiku-20241022Feb 19, 2026claude-haiku-5-5
claude-3-opus-20240229Jan 5, 2026claude-opus-4-8
claude-3-5-sonnet-20241022Oct 28, 2025claude-sonnet-5-5
claude-3-5-sonnet-20240620Oct 28, 2025claude-sonnet-5-5
claude-3-sonnet-20240229Jul 21, 2025claude-sonnet-5-5
claude-2.1, claude-2.0Jul 21, 2025claude-sonnet-5-5

Deprecated Models (retiring soon)

ModelRetiresReplacement
claude-3-haiku-20240307Apr 19, 2026claude-haiku-5-5
claude-opus-4-20250514June 15, 2026claude-opus-4-8
claude-sonnet-4-20250514June 15, 2026claude-sonnet-5-5

Breaking Changes by Source Model

Migrating from Sonnet 4.5 to Sonnet 4.6 (effort default change)

Sonnet 4.5 had no effort parameter; Sonnet 4.6 defaults to high. If you just switch the model string and do nothing else, you may see noticeably higher latency and token usage. Set effort explicitly.

Recommended starting points:

WorkloadStart atNotes
Chat, classification, content generationlowWith thinking: {"type": "disabled"} you'll see similar or better performance vs. Sonnet 4.5 no-thinking
Most applications (balanced)mediumThe default sweet spot for quality vs. cost
Agentic coding, tool-heavy workflowsmediumPair with adaptive thinking and a generous max_tokens (up to 128K with streaming - Sonnet 4.6's ceiling)
Autonomous multi-step agents, long-horizon loopshighScale down to medium if latency/tokens become a concern
Computer-use agentshigh + adaptiveSonnet 4.6's best computer-use accuracy is on adaptive + high

For non-thinking chat workloads specifically:

client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=8192,
    thinking={"type": "disabled"},
    output_config={"effort": "low"},
    messages=[{"role": "user", "content": "..."}],
)

When to use Opus 4.6 instead: hardest and longest-horizon problems - large code migrations, deep research, extended autonomous work. Sonnet 4.6 wins on fast turnaround and cost efficiency.

Migrating to Opus 4.6 / Sonnet 4.6 (from any older model)

1. Manual extended thinking is deprecated - use adaptive thinking.

thinking: {type: "enabled", budget_tokens: N} (manual extended thinking with a fixed token budget) is deprecated on Opus 4.6 and Sonnet 4.6. Replace it with thinking: {type: "adaptive"}, which lets Claude decide when and how much to think. Adaptive thinking also enables interleaved thinking automatically (no beta header needed).

# Old (still works on older models, deprecated on 4.6)
response = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=16000,
    thinking={"type": "enabled", "budget_tokens": 8000},
    messages=[...]
)

# New (Opus 4.6 / Sonnet 4.6)
response = client.messages.create(
    model="claude-opus-4-6",  # or "claude-sonnet-4-6"
    max_tokens=16000,
    thinking={"type": "adaptive"},
    output_config={"effort": "high"},  # optional: low | medium | high | max
    messages=[...]
)

Adaptive thinking is the long-term target, and on internal evaluations it outperforms manual extended thinking. Move when you can.

Transitional escape hatch: manual extended thinking is still functional on Opus 4.6 and Sonnet 4.6 (deprecated, will be removed in a future release). If you need a hard ceiling while migrating - for example, to bound token spend on a runaway workload before you've tuned effort - you can keep budget_tokens around alongside an explicit effort value, then remove it in a follow-up. budget_tokens must be strictly less than max_tokens:

# Transitional only - deprecated, plan to remove
client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=16384,
    thinking={"type": "enabled", "budget_tokens": 8192},  # must be < max_tokens
    output_config={"effort": "medium"},
    messages=[...],
)

If the user asks for a "thinking budget" on 4.6, the preferred answer is effort - use low, medium, high, or max rather than a token count.

2. Effort parameter (Opus 4.5, Opus 4.6, Sonnet 4.6 only).

Controls thinking depth and overall token spend. Goes inside output_config, not top-level. Default is high. max is supported on Fable 5, Opus 4.6 and later, Sonnet 5.5, Sonnet 5, Sonnet 4.6, and Haiku 5.5 - it errors on Sonnet 4.5 and Haiku 4.5.

output_config={"effort": "medium"}  # often the best cost / quality balance

Migrating to the 4.6 family (Opus 4.6 and Sonnet 4.6)

3. Assistant-turn prefills return 400 (Opus 4.6 and Sonnet 4.6).

The text continues at the source. Read the rest.

Source and license

Source: https://github.com/anthropics/skills/blob/main/skills/claude-api/shared/model-migration.md

Author: anthropics, Anthropic skills. License: Apache-2.0.

Shown here with formatting for the web. Keep the author and license notice when you reuse it.

Related entries

There are more like this in the members library

The Claude Code library holds 13,843 entries. Members can search all of them by meaning and read every one in full.