Claude Code✓ Confirmed in official docsAdded Oct 22
How to move Claude API code to a new API version with /claude-api api-version in Claude Code
Claude Code 2.1.307 (October 21) added /claude-api api-version. It updates your project's Claude API code for a newer API version, then switches your requests to that version. Anthropic released API version 2026-10-21 the same day, so use it to move code that still sends 2023-06-01.
- Check that Claude Code is 2.1.307 or later.
claude --version
- Open Claude Code in your project folder and type the command.
/claude-api api-version
- Check the changes against the migration guide's breaking changes. With
2026-10-21, each of these requests returns a 400 error.
- Requests that send
temperature,top_p, ortop_k, even at the default value. Remove all three. Claude 4.7 and later models already accept only the defaults and sample as before, but on models that accepted other values, such as Claude Sonnet 4.6, a request that loweredtemperatureloses that effect. - Requests that put a
documentblock directly in anassistantmessage. Send documents inusermessages. - Requests with a non-empty
citationsarray on atextblock in ausermessage.
- SDKs send
2026-10-21by default from their new major versions: Pythonanthropic2.0.0, TypeScript@anthropic-ai/sdk1.0.0, Go 2.0.0, Java 3.0.0, Ruby 2.0.0, C# 13.0.0, PHP 1.0.0, and theantCLI 2.0.0. Without an SDK, change the header.
-H "anthropic-version: 2026-10-21"
The new SDKs also have changes that don't depend on the API version. They send API keys as Authorization: Bearer instead of X-Api-Key, so check any proxy or gateway that reads X-Api-Key. On Amazon Bedrock, 2026-10-21 works only with Claude 4.7 and later models, so keep code that calls older models on your current SDK version.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.