CLAUDE LABJP
PRICING — September 1 was the scheduled date for the Sonnet 5 price increase, and it did not happen. The introductory $2/$10 per MTok now stands as the regular pricePARTNER — Salesforce and Anthropic announced Claudeforce, an expanded partnership. The Salesforce in Claude plugin ships with 37 prebuilt sales skills, from meeting prep to pipeline managementTRUST — Claudeforce serves Claude through Amazon Bedrock inside the Salesforce Trust Boundary, so data and inference never leave the security perimeter — an answer aimed squarely at regulated industriesBETA — Salesforce in Claude is with select pilot customers for now, with an open beta expected during SeptemberLIMITS — The 50% weekly-limit boost runs through September 13. From September 14 the permanent level is 25% above the pre-promotion baseline, roughly a 17% cut from todayRELEASE — Claude Code has shipped nothing since v2.1.251 on August 28. Against a pace of one release every 0.8 days, a four-day gap is among the longest yetPRICING — September 1 was the scheduled date for the Sonnet 5 price increase, and it did not happen. The introductory $2/$10 per MTok now stands as the regular pricePARTNER — Salesforce and Anthropic announced Claudeforce, an expanded partnership. The Salesforce in Claude plugin ships with 37 prebuilt sales skills, from meeting prep to pipeline managementTRUST — Claudeforce serves Claude through Amazon Bedrock inside the Salesforce Trust Boundary, so data and inference never leave the security perimeter — an answer aimed squarely at regulated industriesBETA — Salesforce in Claude is with select pilot customers for now, with an open beta expected during SeptemberLIMITS — The 50% weekly-limit boost runs through September 13. From September 14 the permanent level is 25% above the pre-promotion baseline, roughly a 17% cut from todayRELEASE — Claude Code has shipped nothing since v2.1.251 on August 28. Against a pace of one release every 0.8 days, a four-day gap is among the longest yet
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.

api39migration7sonnet3context-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 $15 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-08-30
Read the Catalog Your CLI Already Ships Before Bulk-Replacing Model IDs
A newer generation makes older model IDs look stale. Here is how to pull the catalog embedded in your installed binary, sort every reference into matched, date-mismatched, and malformed, and stop the replacement that would break working IDs.
API & SDK2026-07-19
When Prompt Caching Was On but the Bill Didn't Move — Field Notes on Instrumenting cache_read to Close the Hit-Rate Gap
You added cache_control but your Claude API bill barely changed. Before guessing at fixes, record cache_read and cache_creation on every request and split the hit-rate gap into three causes: non-deterministic prefixes, TTL expiry, and sub-threshold blocks.
📚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 →