CLAUDE LABJP
FORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as OctoberFORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as October
Articles/API & SDK
API & SDK/2026-04-07Beginner

Claude Sonnet 4.5 1M Context Deprecation Guide — What to Do Before April 30

Claude Sonnet 4.5's 1M token context beta ends April 30, 2026. Migrate to Sonnet 4.6 with step-by-step code examples — no beta header required on the new model.

api38migration6sonnet3context-window6deprecation3

Claude Sonnet 4.5 1M Context Is Being Deprecated on April 30

On April 30, 2026, the 1M token context window beta feature for Claude Sonnet 4.5 and the older Claude Sonnet 4 will be retired. This feature was made available through the context-1m-2025-08-07 beta header that Anthropic introduced in August 2025.

The good news: Claude Sonnet 4.6 and Claude Opus 4.6 now support 1M token context windows as a generally available (GA) standard feature — no beta header required. This guide walks you through exactly what changes, why it matters, and how to migrate your code before the deadline.

What Is Being Deprecated

The beta feature being removed applies to two models:

  • claude-sonnet-4-5 (Claude Sonnet 4.5)
  • claude-sonnet-4-20250514 (Claude Sonnet 4)

With these models, developers could include the anthropic-beta: context-1m-2025-08-07 header in API requests to use up to 1 million tokens of context.

After April 30, 2026, this beta header will have no effect. Any request using these models that exceeds the standard 200k token context window will return an error.

# ❌ This header will no longer work after April 30
import anthropic
 
client = anthropic.Anthropic()
 
response = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=4096,
    messages=[{"role": "user", "content": very_long_content}],
    extra_headers={
        # This header becomes a no-op on April 30, 2026
        "anthropic-beta": "context-1m-2025-08-07"
    }
)

Where to Migrate

Anthropic recommends migrating to either Claude Sonnet 4.6 or Claude Opus 4.6. Both models support 1M token context windows as a standard feature — no beta header needed.

  • Claude Sonnet 4.6 (claude-sonnet-4-6): The best balance of cost and capability. Ideal for most use cases involving large documents, long conversation histories, or extensive codebases.
  • Claude Opus 4.6 (claude-opus-4-6): Maximum capability for complex reasoning, multi-step tasks, and high-precision analysis. Higher cost than Sonnet.

Neither model requires the beta header, and there is no additional cost for using the 1M context window — standard pricing applies.

Step-by-Step Migration

The migration is straightforward. In most cases, you only need to update the model ID and remove the beta header.

Step 1: Update Your Model ID

import anthropic
 
client = anthropic.Anthropic()
 
# ✅ After migration: use claude-sonnet-4-6
response = client.messages.create(
    model="claude-sonnet-4-6",  # ← Change this
    max_tokens=8096,
    messages=[
        {
            "role": "user",
            "content": very_long_content  # Up to 1M tokens, no header needed
        }
    ]
    # ← No beta header required
)
 
print(response.content[0].text)

Step 2: Remove the Beta Header

If you were explicitly passing the context-1m-2025-08-07 header via extra_headers or extra_body, simply delete it:

# Before (needs to be removed)
extra_headers={
    "anthropic-beta": "context-1m-2025-08-07"
}
 
# After (no extra headers needed)
# claude-sonnet-4-6 handles 1M context by default

Step 3: TypeScript / Node.js Migration

The process is identical in TypeScript:

import Anthropic from '@anthropic-ai/sdk';
 
const client = new Anthropic();
 
// ✅ After migration
const response = await client.messages.create({
  model: 'claude-sonnet-4-6',  // ← Update model ID
  max_tokens: 8096,
  messages: [
    {
      role: 'user',
      content: veryLongContent,  // Up to 1M tokens supported
    },
  ],
  // ← No beta header needed
});
 
console.log(response.content[0].text);

Step 4: Verify Your Migration

After updating, run a quick test with a long-context request to confirm everything works:

import anthropic
 
client = anthropic.Anthropic()
 
# Confirm token usage in the response
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": "Please summarize the following document..."
        }
    ]
)
 
# Check usage details
print(f"Input tokens: {response.usage.input_tokens}")
print(f"Output tokens: {response.usage.output_tokens}")
# Expected output:
# Input tokens: 15
# Output tokens: 42

What Changes Between Sonnet 4.5 and Sonnet 4.6

Claude Sonnet 4.6 is an upgrade in several meaningful ways:

  • Improved performance: Better accuracy on coding, math, and instruction-following benchmarks
  • 1M context window is now GA: No more beta limitations — it's a first-class feature
  • Extended Thinking support: Available when you need deeper reasoning for complex tasks
  • API compatibility: Nearly identical interface to Sonnet 4.5, making migration low-effort

You typically won't need to rewrite your prompts, but it's worth testing your outputs after migration and fine-tuning your system prompt if needed.

Real-World Use Cases That Require Action

To help you quickly assess your exposure, here are the most common scenarios where the 1M context beta is in use.

Large Document Processing

If your application uploads entire PDFs, legal contracts, research papers, or code repositories in a single API call, you're almost certainly using extended context. Any prompt over 200k tokens will break after April 30 unless you migrate.

# Example: processing a large PDF as text
with open("annual_report.txt", "r") as f:
    document_text = f.read()
 
# If this document is > ~150,000 words, you need the 1M context window
response = client.messages.create(
    model="claude-sonnet-4-6",  # ← Supports 1M natively
    max_tokens=4096,
    messages=[
        {
            "role": "user",
            "content": f"Summarize the key financial highlights from this report:\n\n{document_text}"
        }
    ]
)

Long Conversation Histories

Chatbots or assistants that maintain extensive conversation history may accumulate hundreds of thousands of tokens over time. If you're passing the full history on each turn, verify the cumulative token count.

# Monitor total context size before sending
def count_message_tokens(messages: list[dict]) -> int:
    """Rough estimate: 1 token ≈ 4 characters"""
    total_chars = sum(len(m.get("content", "")) for m in messages)
    return total_chars // 4
 
conversation_history = [...]  # Your accumulated messages
 
estimated_tokens = count_message_tokens(conversation_history)
print(f"Estimated input tokens: {estimated_tokens:,}")
 
# If > 200,000, ensure you're on claude-sonnet-4-6
if estimated_tokens > 200_000:
    model = "claude-sonnet-4-6"
else:
    model = "claude-sonnet-4-5"  # Fine for smaller contexts

Codebase Analysis

Developers who send entire repositories for analysis, refactoring suggestions, or documentation generation often exceed 200k tokens with larger codebases. This is one of the most common 1M context use cases.

import os
 
def load_codebase(root_dir: str) -> str:
    """Concatenate all Python files in a directory."""
    code_parts = []
    for dirpath, _, filenames in os.walk(root_dir):
        for fname in filenames:
            if fname.endswith(".py"):
                fpath = os.path.join(dirpath, fname)
                with open(fpath, "r", encoding="utf-8", errors="ignore") as f:
                    code_parts.append(f"# File: {fpath}\n{f.read()}")
    return "\n\n".join(code_parts)
 
codebase_content = load_codebase("./my_project")
 
response = client.messages.create(
    model="claude-sonnet-4-6",  # Required for large codebases
    max_tokens=8096,
    messages=[
        {
            "role": "user",
            "content": f"Review this codebase for security vulnerabilities:\n\n{codebase_content}"
        }
    ]
)

Common Errors and Fixes

Here are the errors you're most likely to encounter during or after migration, along with how to fix them.

ContextWindowExceededError

anthropic.BadRequestError: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long"}}

Cause: You sent a request to claude-sonnet-4-5 with a context larger than 200k tokens after the deprecation date.

Fix: Update the model ID to claude-sonnet-4-6.

Beta Header Has No Effect

After April 30, including context-1m-2025-08-07 in the headers for Sonnet 4.5 or Sonnet 4 will not enable 1M context. The only fix is migrating to a model that supports it natively.

max_tokens Limit Has Changed

Claude Sonnet 4.6 supports up to 64k output tokens per request (Sonnet 4.5 was capped at 8,192). If your code hardcodes this limit, you may want to update it to take advantage of longer outputs.

For teams running high-volume batch workloads on top of 1M context, Claude API Messages Batches Implementation Guide covers how to reduce costs by up to 50% through asynchronous batch processing.

Looking back

The April 30 deadline is fast approaching. If you're using Claude Sonnet 4.5 or Sonnet 4 with the 1M context beta, here's your action checklist:

  1. Find any code that passes the context-1m-2025-08-07 beta header
  2. Update the model ID to claude-sonnet-4-6
  3. Remove the beta header (it's no longer needed)
  4. Test your application with real-world long-context inputs

Sonnet 4.6 delivers better performance at the same price point, making this an upgrade worth doing proactively rather than waiting for the deadline. If you're building RAG pipelines or document processing systems that depend on large context windows, Building a RAG System with Claude API covers the full implementation pattern with vector search and prompt caching.

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

API & SDK2026-03-14
Claude Haiku 3 Deprecation (April 19, 2026): Complete Migration Guide to Claude Haiku 4.5
Claude Haiku 3 (claude-3-haiku-20240307) is being retired on April 19, 2026. This guide covers the deprecation timeline, what changes, and how to migrate to Claude Haiku 4.5 with ready-to-use code examples.
API & SDK2026-06-27
When Claude API Streaming Stops Without an Error: Detecting Silent Stalls and Resuming Mid-Stream
How to catch the 'silent stall' where Claude API streaming stops with no exception at all, using a content-level watchdog that times the gap between tokens, plus a resume path that carries received text forward as an assistant prefill, and a four-layer timeout budget for long-running automation.
API & SDK2026-06-23
When Thinking Is Always On, Prefill Quietly Stops Working — Fixing Streaming and Token Budgets for Fable 5
Fable 5 thinks by default. Prefill no longer applies, the first streamed block isn't text, and max_tokens has to leave room for reasoning. Here is how I fixed those three broken assumptions in my own automated publishing pipeline.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →