claude-news6 min read

Claude 1M Context Window: Migrate Off the Beta Before You Hit Errors

Anthropic retired the context-1m-2025-08-07 beta header for Sonnet 4.5 and Sonnet 4 on April 30, 2026. Here's the exact migration path to Sonnet 4.6 or Opus 4.6.

Claude 1M Context Window Migration: What Breaks Today and How to Fix It

If your application sends the anthropic-beta: context-1m-2025-08-07 header to claude-sonnet-4-5 or claude-sonnet-4, your requests started failing or silently truncating as of April 30, 2026. Anthropic retired the 1M context beta for those two models today, and the fix is a one-line model ID change — but there are a few gotchas worth knowing before you deploy.

This guide covers exactly what changed, what errors you'll see, and the fastest path to a stable migration.

What Anthropic Changed and Why

Back in 2025, the 1 million token context window was an experimental feature gated behind a beta header. Developers opted in by adding anthropic-beta: context-1m-2025-08-07 to their API requests alongside older models like claude-sonnet-4 (released May 2025) and claude-sonnet-4-5 (released September 2025).

On March 13, 2026, Anthropic graduated the 1M context window to general availability on claude-sonnet-4-6 and claude-opus-4-6 at standard pricing — no beta header, no long-context premium. That was the signal that the beta era was ending.

Effective April 30, 2026, the context-1m-2025-08-07 header is retired for Sonnet 4 and Sonnet 4.5. Here is the exact behavior:
ScenarioWhat happens now
Request with beta header, prompt under 200K tokensHeader silently ignored, request succeeds
Request with beta header, prompt over 200K tokens400 invalid_request_error — prompt too long
Request without beta header, prompt over 200K tokensSame 400 error (no change here)
Request on Sonnet 4.6 or Opus 4.6, any context size up to 1MWorks natively, no header needed

The underlying reason for retirement is straightforward: Anthropic wants developers off models that are heading toward deprecation. Sonnet 4 and Opus 4 are scheduled to retire June 15, 2026, so retiring the beta header on them first is part of the staged wind-down.

The Migration: Two Model Swaps

The migration is simple at the API level. You are changing one string.

python# Before
response = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=8096,
    extra_headers={"anthropic-beta": "context-1m-2025-08-07"},
    messages=[{"role": "user", "content": very_long_document}]
)

# After — remove the beta header, update model ID
response = client.messages.create(
    model="claude-sonnet-4-6-20260101",
    max_tokens=8096,
    messages=[{"role": "user", "content": very_long_document}]
)

The context-1m-2025-08-07 header is simply gone. Sonnet 4.6 accepts up to 1,000,000 tokens with no special configuration.

Option 2: Migrate to Claude Opus 4.6 (For highest-quality long-context work)

pythonresponse = client.messages.create(
    model="claude-opus-4-6-20260101",
    max_tokens=8096,
    messages=[{"role": "user", "content": very_long_document}]
)

Opus 4.6 runs slower and costs more than Sonnet 4.6, but delivers meaningfully better reasoning on tasks like legal document review, codebase-wide refactoring, or multi-document synthesis. If your use case justifies the cost, this is the upgrade path.

TypeScript / Node.js version

typescriptimport Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.messages.create({
  model: "claude-sonnet-4-6-20260101", // was claude-sonnet-4-5-20250929
  max_tokens: 8096,
  // no anthropic-beta header needed
  messages: [
    {
      role: "user",
      content: veryLongDocument,
    },
  ],
});

Four Things to Test After Migrating

Swapping the model ID is not a purely mechanical change. Sonnet 4.6 and Opus 4.6 are different models than 4.5, and they can behave differently on the same prompt. Before you ship:

1. Run your longest prompts end-to-end. Confirm they stay within 1M tokens and return expected output. The token budget is the same, but tokenization can vary slightly across model generations. 2. Check instruction following on structured outputs. If you are using JSON mode or tool use with a large context, validate that the 4.6 models format their responses the way your parser expects. In general 4.6 models are more reliable here, but edge cases in system prompt formatting can surface. 3. Benchmark latency on your p95. Sonnet 4.6 is faster than Sonnet 4.5 at equivalent context sizes, but if you are filling the full 1M window, time-to-first-token will still be non-trivial. Set appropriate timeouts if your application has strict SLAs. 4. Validate citation and retrieval quality. If your use case feeds a large document corpus into context (RAG alternative, codebase ingestion, long-form document Q&A), run a representative eval set. The 4.6 generation handles long-context retrieval better, but confirm this holds for your domain.

Why You Should Not Just Remove the Header and Stay on Sonnet 4.5

Some developers may be tempted to simply drop the beta header and stay on claude-sonnet-4-5-20250929. That works only if your prompts are consistently under 200K tokens. If you are already using the 1M window in production, that means staying on an old model that:

  • Retires June 15, 2026 alongside Sonnet 4 and Opus 4
  • Has no path to 1M tokens after today
  • Will be replaced by an alias that routes to a newer model after retirement, potentially breaking your expected behavior

Migrating now to Sonnet 4.6 or Opus 4.6 gives you a GA feature at standard pricing on models that are the current generation.

The Bigger Picture: Long Context is Now a Standard Feature

The retirement of the beta header reflects a broader shift. When Anthropic first shipped the 1M context window, it was genuinely experimental — a technical proof of concept that not all use cases warranted. By promoting it to GA in March 2026 on the 4.6 generation, Anthropic is signaling that long context is now table stakes, not a premium add-on.

The practical implication: if you are building on the Claude API today, you should be on Sonnet 4.6 or Opus 4.6 as your baseline. The 4.6 generation also introduced improved instruction following, better tool use, and (in the case of Opus 4.6) the foundation for the extended thinking capabilities that Opus 4.7 builds on.

For context on what else changed in this generation, Anthropic's migration guide has a full model comparison table.

Key Takeaways

  • The anthropic-beta: context-1m-2025-08-07 header stopped working for Sonnet 4.5 and Sonnet 4 on April 30, 2026
  • Requests over 200K tokens on those models now return a 400 invalid_request_error
  • The fix is changing your model ID to claude-sonnet-4-6-20260101 or claude-opus-4-6-20260101 and removing the beta header
  • 1M context is now GA on the 4.6 generation at standard pricing — no header, no premium
  • Both Sonnet 4 and Sonnet 4.5 retire June 15, 2026, so migrating now avoids a second forced migration in six weeks

Next Steps for Your Claude Integration

If you are actively building on the Claude API and want to stay current on deprecations, model releases, and platform changes, the AI for Anything certification prep tracks Claude Certified Architect (CCA-F) exam topics — including the API lifecycle and model selection criteria that come up in the exam.

For a deeper look at how the 1M context window works and when to use it versus chunked RAG, see our guide on Claude Sonnet 4.6 and the 1M context window.


Sources: Anthropic Platform Release Notes · Anthropic Context Windows Docs · Anthropic Migration Guide · Riptide Consulting — The April 30 Cliff · DEV Community — Sonnet 4 Retirement

Ready to Start Practicing?

300+ scenario-based practice questions covering all 5 CCA domains. Detailed explanations for every answer.

Free CCA Study Kit

Get domain cheat sheets, anti-pattern flashcards, and weekly exam tips. No spam, unsubscribe anytime.