CONCEPT One budget for everything the model reads and writes
The context window is all the text a model can reference when generating a response —
including the response itself. Anthropic calls it the model's "working memory": it is
not the training corpus, it's the finite space that holds this request. Everything counts toward it — the
system prompt, every message in messages (tool results, images, documents included),
your tool definitions, and the output Claude generates for the turn, extended thinking
included.
CONCEPT Current sizes — 1M is the default, not a beta
The 1M-token tier is now the default for the top models: no beta header, and long-context requests bill at standard pricing. The exam-relevant sizes:
| Model | Context window | How to enable |
|---|---|---|
| Opus 4.8 / 4.7 / 4.6 | 1M tokens | Default — no beta header |
| Sonnet 5 / Sonnet 4.6 | 1M tokens | Default — no beta header |
| Fable 5 / Mythos 5 | 1M tokens (up to 128K output) | Default — no beta header |
| Sonnet 4.5 & other older models | 200K tokens | — |
| Haiku 4.5 | 200K tokens | — |
DIAGRAM History + output share one window
(grows every turn)"] IN --> TOOLS["Tool definitions"] OUT --> RESP["Reply + extended thinking
(reserved by max_tokens)"] HIST -.->|"grows toward"| RESP classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef gate fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; classDef bad fill:#f8d7da,stroke:#dc3545,color:#721c24; class W ok; class RESP gate; class HIST gate;
CODE The usage field reports what the request consumed
Every response tells you exactly how much of the window this turn used. With prompt caching the input count is split across three fields — all three count toward the window.
# Anthropic Python SDK resp = client.messages.create( model="claude-opus-4-8", # 1M context, default — no beta header max_tokens=4096, # reserves OUTPUT room inside the window (see 1.3) messages=history, ) u = resp.usage print(u.input_tokens) # uncached input tokens print(u.cache_read_input_tokens) # served from cache — still counts to window print(u.cache_creation_input_tokens) # written to cache — still counts to window print(u.output_tokens) # the reply (+ thinking) — also in the window # Total window used = input + cache_read + cache_creation + output
TRADE-OFFS A big window is capacity, not a free lunch
✅ Large (1M) window
- Fits long documents, big histories, many tools
- Fewer premature "too long" errors
- Default & standard-priced on top models
⚠️ Filling it up
- Context rot — recall/accuracy fall as tokens climb
- Every re-sent token is re-billed each turn (1.4)
- Latency and cost scale with what's in context
EXAM TRAPS
PRACTICE
Q1 · Which models have a 1M-token context window today, and what enables it?
Opus 4.8 / 4.7 / 4.6, Sonnet 5, Sonnet 4.6, and Fable 5 / Mythos 5. It's the default — no beta header, billed at standard pricing. Sonnet 4.5 and Haiku 4.5 are 200K.
Q2 · Name four things that consume the context window.
Any four of: the system prompt, every message in messages (including tool results,
images, documents), the tool definitions, and the generated output (reply + extended thinking). All count.
Q3 · Why isn't a 1M window a reason to stop curating context?
Context rot: as token count grows, accuracy and recall degrade. And every token in the window is re-sent and re-billed each turn. Curating what's in context matters as much as the raw capacity.