← Back to Blog

Claude 1M Context Window: How to Use It, What It Costs, and When Not To

(Unofficial)

This guide is independently community-maintained. It is not affiliated with, endorsed by, or sponsored by the vendor of the third-party tool it covers. All third-party trademarks are the property of their respective owners.

November 10, 2026
A developer at a laptop as a fan of glowing documents converges into one context window in purple tones.

Claude 1M Context Window: How to Use It, What It Costs, and When Not To

Author: CodeGateway Team Published: 2026-11-10 | Last updated: 2026-11-12 Estimated read time: 9 minutes

TL;DR: The 1M context window is now GA on Opus 4.6 and Sonnet 4.6 (and later models). Standard pricing covers the full window — no beta header needed past 200K tokens. But "fits" doesn't mean "should use." This guide covers which models support 1M, how billing works, three concrete examples where 1M is the wrong choice, and copy-paste code to get started.

What 1M Actually Solves: Compression Loss, Not Longer Answers

TL;DR: When 200K isn't enough, agents silently compress history — losing exactly the details you need later. 1M delays that compression.

A context window is how much the model can "see" in a single request. When the window is small, long tasks fail not because the model can't answer, but because intermediate context gets compressed away: code you read, approaches you rejected, error stacks — all summarized into a few lines. The model loses its memory and starts retrying the same failed paths.

The 1M window changes when compression happens — it doesn't make answers longer. It lets you lay out an entire large repository, a long log file, or a multi-round code review session at once. For "search → modify → verify" workflows, this is transformative: the model never has to discard earlier context to make room.

But window size and answer quality are not correlated. If your requirements are vague or the code isn't fully read, giving the model 1M tokens just means it searches through more noise.

Which Models Actually Have 1M: Verified Sources

TL;DR: GA on Opus 4.6 and Sonnet 4.6. Later models (Opus 5.5, Sonnet 5.5, Haiku 5.5) also support 1M. Every row below cites its source with an as-of date.

Model

Context Window

Official Price (input / output, per 1M tokens)

Source (as-of 2026-11-05)

Claude Opus 4.6

1M

$5 / $25

Claude blog: 1M context GA

Claude Sonnet 4.6

1M

$3 / $15

Same as above

Claude Opus 5.5

1M (default)

$4 / $20

Anthropic API release notes

Claude Sonnet 5.5

1M

$2 / $10

Claude Platform pricing

Claude Haiku 5.5

1M

$0.10 / $0.50 (≤100K prompt)

Anthropic: Claude Haiku 5.5

Two easy-to-miss limits: media cap raised to 600 images or PDF pages (was 100, per the 1M GA announcement); Opus 5.5 and Sonnet 5.5 support up to 128K output tokens (see model overview). Always check the official model page and pricing page — don't trust second-hand tables.

On CodeGateway, all these models are available with the full 1M window. As of 2026-11-05, models marked with 1,000,000 context include claude-sonnet-4-6, claude-opus-4-6, claude-opus-5-5, claude-haiku-5-5, and others. Check the models page for the live list.

Do You Need to Change Your Code? Usually Nothing.

TL;DR: 1M is GA. Requests over 200K tokens are automatically handled at 1M. Don't add a beta header.

The biggest gotcha: there's no "enable 1M" switch. Per the official guidance, requests exceeding 200K tokens are automatically processed with the 1M window. The old context-1m beta header is ignored — you can remove it (cleaner), but it won't break anything.

What actually matters for configuration:

  1. Confirm your model supports 1M (see the table above, or the official model page).

  2. Check your rate limits — the 1M window doesn't change rate limits, but larger requests consume more tokens per call.

  3. Remove any stale beta headers if you want clean code.

Here's a minimal working request against the Anthropic-compatible endpoint:

bash
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 4096,
"messages": [{"role": "user", "content": "Analyze this repository..."}]
}'

No context-1m header. No special flags. If the prompt exceeds 200K tokens, it's handled at 1M automatically.

How 1M Is Billed: Standard Price, Two Boundaries

TL;DR: The per-token price doesn't change at 200K. But watch the input-token multiplier and the 128K output cap.

The billing model is straightforward: standard pricing covers the entire window. There's no "1M surcharge." Input tokens at 200K cost the same per-token as input tokens at 50K.

But two boundaries matter:

  1. Input token cost dominates. A single 300K-token request costs 10× a 30K-token request at the same model. The price per token is identical — the volume is what kills you.

  2. Output cap is 128K on the latest models. If you're generating long-form output, you may hit the output limit before the input limit.

The practical cost model:

total_cost = input_tokens × input_price + output_tokens × output_price

For a 1M-window request with 400K input and 4K output on Sonnet 4.6:

  • Input: 400K × $3/1M = $1.20

  • Output: 4K × $15/1M = $0.06

  • Total: ~$1.26

Compare to the same request on Opus 4.6 ($5/$25): ~$2.10. The cheaper model for "reading code to find clues" and the premium model for "making decisions" is almost always the better split.

When NOT to Use 1M: Three Counter-Examples

TL;DR: Bigger isn't always better. These three patterns waste money.

1. Single-file edits: If you're changing 50 lines in one file, don't feed the entire repository. Read the file, make the edit, verify. 200K is more than enough.

2. Repeated full-context re-sends: The most common anti-pattern in agent workflows is sending the same 300K of materials on every turn. If parts of the context are cacheable or reusable, use prompt caching instead of resending everything.

3. "Maybe it helps" padding: Dumping stack traces, unrelated logs, and speculative context "just in case" fills the window with noise. More tokens ≠ better answers. Be precise about what goes in.

The correct order of operations: measure usage first → trim what's redundant → then pick the right model. Skipping to "just use a bigger window" means paying 10× for context the model never needed.

Copy-Paste Examples

Basic 1M request (Python)

python
import anthropic

client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
messages=[{
"role": "user",
"content": open("large-repo-analysis.md").read() # can exceed 200K tokens
}]
)
print(response.content[0].text)

Tracking token usage

python
usage = response.usage
print(f"Input: {usage.input_tokens:,} tokens")
print(f"Output: {usage.output_tokens:,} tokens")
cost = usage.input_tokens * 3e-6 + usage.output_tokens * 15e-6 # Sonnet 4.6
print(f"Est cost: ${cost:.4f}")

CodeGateway: one key, multiple models

bash
# Same key works for any model in the catalog
curl https://api.codegateway.dev/v1/messages \
-H "x-api-key: $CODEGATEWAY_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-opus-5-5","max_tokens":4096,"messages":[{"role":"user","content":"..."}]}'

Swap claude-opus-5-5 for claude-sonnet-4-6 or claude-haiku-5-5 — same endpoint, same key. See the full model catalog.

Making Long-Context Costs Visible

TL;DR: The billing spike comes from input tokens. Measure before you optimize.

Long-context cost isn't inherently expensive — it's expensive without a ruler. Control costs in this order:

  1. Measure: Use request logs to see which models and workspaces consume the most input tokens. Find the "context hogs."

  2. Trim: The most common problem isn't "window too small" — it's "resending the same materials every turn." Cache what you can.

  3. Right-size models: Use cheap long-context models for exploration; use premium models for decisions.

On CodeGateway, every request's input/output tokens, cache hits, and latency are tracked at the workspace level. No separate monitoring setup needed.


Ready to Start?

Get a CodeGateway API key — one key for Claude, GPT, Gemini, and more. Pay-as-you-go, no monthly minimum. Perfect for 1M-context workloads where you only pay for what you use.

See the pricing page for per-model rates, or check the billing guide for top-up details.

Related reading:

Author:CodeGateway TeamReviewed on:2026-11-05

Solve API Key & Billing limits with CodeGateway

Lacking an official API key or facing overseas card payment issues? Create an sk-cg- key instantly. One key for Claude, GPT, Gemini, and DeepSeek: Claude and Gemini text models use the Anthropic Messages protocol (/v1/messages) — the OpenAI-compatible text endpoints do not accept them. Built-in smart routing and free trial credits included.

Sign up free