◉CLAUDE LABJP
●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through
Articles/Claude.ai
◉ Claude.ai/2026-04-03Intermediate

Migrating from the Claude 1M Context Window Beta: Everything You Need to Do Before April 30, 2026

Anthropic is retiring the 1M token context window beta for Claude Sonnet 4.5 and Sonnet 4 on April 30, 2026. Learn how to migrate to Claude Sonnet 4.6 before the context-1m-2025-08-07 header stops working.

1M tokenscontext windowmigration guideClaude Sonnet 4.6deprecation4context-1m-2025-08-07Claude API150

On March 30, 2026, Anthropic announced that the 1M token context window beta for Claude Sonnet 4.5 and Claude Sonnet 4 will be retired on April 30, 2026. If your application currently uses the context-1m-2025-08-07 beta header to handle long-context requests, you need to act before that date to avoid unexpected errors in production.

What's Being Retired

When Anthropic introduced long-context support for Claude Sonnet 4 and Sonnet 4.5, it was released as a beta feature that required a special header in every API request:

anthropic-beta: context-1m-2025-08-07

This header signaled to the API that your request might exceed the standard 200K token context window, allowing inputs up to 1 million tokens.

After April 30, 2026, this changes. The beta header will be silently ignored, and any request exceeding 200K tokens sent to Claude Sonnet 4.5 or Sonnet 4 will return a context window exceeded error — even if the header is present.

Which Models Are Affected

Models affected (action required):

  • claude-sonnet-4-5-20250929 (Claude Sonnet 4.5)
  • claude-sonnet-4-20250522 (Claude Sonnet 4)

Models not affected (1M tokens supported natively):

  • claude-sonnet-4-6-20260217 (Claude Sonnet 4.6) — no beta header needed
  • claude-opus-4-6-20260205 (Claude Opus 4.6) — no beta header needed

Claude Sonnet 4.6 and Claude Opus 4.6 both support 1M token context windows as a standard feature. There's no beta header to include, no special opt-in — it just works. Requests exceeding 200K tokens are automatically handled with long-context pricing applied.

Before and After: Code Migration Examples

Python SDK

import anthropic
 
client = anthropic.Anthropic()
 
# ❌ Old approach — will stop working after April 30, 2026
response = client.messages.create(
    model="claude-sonnet-4-5-20250929",   # Sonnet 4.5
    max_tokens=8192,
    extra_headers={
        "anthropic-beta": "context-1m-2025-08-07"  # This header will be ignored
    },
    messages=[
        {"role": "user", "content": very_long_document}  # 200K+ tokens
    ]
)
 
# ✅ New approach — Claude Sonnet 4.6 with native 1M context
response = client.messages.create(
    model="claude-sonnet-4-6-20260217",   # Upgrade to Sonnet 4.6
    max_tokens=8192,
    # No extra_headers needed — 1M context is built-in
    messages=[
        {"role": "user", "content": very_long_document}  # Still supports up to 1M tokens
    ]
)
 
# Example response output:
# response.model → "claude-sonnet-4-6-20260217"
# response.usage.input_tokens → actual token count of your input

TypeScript / Node.js SDK

import Anthropic from "@anthropic-ai/sdk";
 
const client = new Anthropic();
 
// ✅ Migrated TypeScript code
const response = await client.messages.create({
  model: "claude-sonnet-4-6-20260217",  // Changed from Sonnet 4.5
  max_tokens: 8192,
  // Removed: headers: { "anthropic-beta": "context-1m-2025-08-07" }
  messages: [
    {
      role: "user",
      content: veryLongDocument,  // Up to 1M tokens supported natively
    },
  ],
});
 
const text = response.content[0].type === "text" ? response.content[0].text : "";
console.log(text);

Three Steps to Complete Your Migration

Step 1: Find all affected usages in your codebase

Start by searching your project for the beta header and older model names:

# Search for the deprecated beta header
grep -r "context-1m-2025-08-07" ./
 
# Search for the affected model IDs
grep -r "claude-sonnet-4-5\|claude-sonnet-4-20250522" ./src/

This gives you a complete list of files that need updating.

Step 2: Update the model name and remove the beta header

For each location you found, make two changes:

  • Replace claude-sonnet-4-5-20250929 with claude-sonnet-4-6-20260217
  • Remove any anthropic-beta: context-1m-2025-08-07 header configuration

If you store model names as environment variables or in a config file (which is a good practice), you only need to update it in one place:

# Example: updating an environment variable
# Before
ANTHROPIC_MODEL=claude-sonnet-4-5-20250929
ANTHROPIC_BETA_HEADER=context-1m-2025-08-07
 
# After
ANTHROPIC_MODEL=claude-sonnet-4-6-20260217
# ANTHROPIC_BETA_HEADER is no longer needed — remove it

Step 3: Verify in a staging environment

Before pushing to production, run your most important use cases — particularly any that involve long documents or conversations exceeding 200K tokens — and confirm:

  • Responses are returned successfully
  • The response quality meets your expectations
  • Token counts and costs align with your estimates

Benefits of Moving to Claude Sonnet 4.6

This isn't just a maintenance migration. Claude Sonnet 4.6 brings real improvements over Sonnet 4.5:

Performance gains:

  • Improved performance on agentic search tasks compared to Sonnet 4.5
  • Better token efficiency — many tasks complete with fewer tokens consumed
  • Native support for Extended Thinking, useful for complex multi-step reasoning

Operational simplicity:

  • No beta header management across different environments
  • Reduced risk of configuration drift between dev and production
  • Supported as a current-generation model with a longer active lifecycle

For a deep dive into maximizing Claude Sonnet 4.6's capabilities — including 1M context strategies and Extended Thinking patterns — check out Claude Sonnet 4.6 Complete Mastery Guide.

Pricing Considerations

The long-context pricing model remains the same: standard per-token rates apply up to 200K input tokens, and a higher per-token rate kicks in for input tokens beyond that threshold. Sonnet 4.6's long-context pricing is comparable to Sonnet 4.5, so your costs shouldn't change significantly.

One area where you might see savings: Sonnet 4.6's improved token efficiency can mean shorter, equally capable responses — which directly reduces both token usage and cost.

Migration Checklist

Use this checklist to make sure your migration is complete before April 30:

  • Search codebase for context-1m-2025-08-07 and note every location
  • Search codebase for claude-sonnet-4-5-20250929 and claude-sonnet-4-20250522
  • Update model names to claude-sonnet-4-6-20260217 (or claude-opus-4-6-20260205 where appropriate)
  • Remove all instances of the context-1m-2025-08-07 beta header
  • Update environment variables and config files if model names are stored there
  • Test long-context requests (200K+ tokens) in a staging environment
  • Deploy changes to production before April 30, 2026

Looking back

The 1M token context window beta for Claude Sonnet 4.5 and Sonnet 4 ends on April 30, 2026. Migrating is straightforward: update your model name to claude-sonnet-4-6-20260217 and remove the context-1m-2025-08-07 beta header. Claude Sonnet 4.6 supports 1M tokens natively with no configuration needed, and brings meaningful improvements in efficiency and agentic task performance.

For practical context window management patterns — including strategies for working efficiently within token limits and handling very long documents — see Claude 200K Context Window Production Mastery.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◉ Claude.ai2026-10-30
The Limit Rose to 128MB, but 176 Images at 17.5MB Still Stop: Count the Wall That Hits Before Bytes
The day the Messages API request limit became 128MB, I checked 176 images on my own disk. Bytes had plenty of room; the image-count cap hit first. Here is a pre-send gate and a chunking function.
◉ Claude.ai2026-10-27
Haiku 4.5's October 15 Floor Has Passed, but No Stop Date Has Been Set
An Active model's date in the deprecations table is a floor, not a schedule. Using the 60-day notice rule and past retirement gaps, here is how I audit pinned model IDs.
◉ Claude.ai2026-10-27
A Retirement Notice Landed This Morning: Three Screens to Open Before You Change Anything
An English deprecation email from Anthropic arrives and you don't write code. Here are three things to check first: whether it concerns you, what the date really means, and who to tell what.