AI News Daily한국어
← AI tool tips
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.

  1. Check that Claude Code is 2.1.307 or later.
claude --version
  1. Open Claude Code in your project folder and type the command.
/claude-api api-version
  1. 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, or top_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 lowered temperature loses that effect.
  • Requests that put a document block directly in an assistant message. Send documents in user messages.
  • Requests with a non-empty citations array on a text block in a user message.
  1. SDKs send 2026-10-21 by default from their new major versions: Python anthropic 2.0.0, TypeScript @anthropic-ai/sdk 1.0.0, Go 2.0.0, Java 3.0.0, Ruby 2.0.0, C# 13.0.0, PHP 1.0.0, and the ant CLI 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.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →