What Is a Context Window? Token Limits by Model (2026)
A context window is the maximum number of tokens a model can handle in one request, counting the input and the output together. We sent one identical document to nine models: it metered anywhere from 614 to 957 tokens. That is a 1.56x spread on the same text.
Unit: tokens (~4 English chars each, with wide variation)
Scope: one request; nothing persists between calls
Includes: system prompt, history, tool defs, tool results, reasoning, reply
Typical sizes: 200K on cheaper models, 1M on current flagships
2026 maximum: 1,131,072 (Qwen 3.8 Max)
At the limit: HTTP 400. Nothing is silently truncated
What Counts Toward the Window?
Everything the model reads and writes:
- System prompt, counted every turn
- Full message history, all prior exchanges
- Tool definitions — names, descriptions, JSON schemas
- Tool results, often the largest single item
- Reasoning tokens, billed even when not returned to you
- The reply itself
One consequence people hit on upgrade: on Claude Opus 5 thinking is on by default, so a request sized tightly around its answer on an older model can now run out of room mid-response.
How Big Is Each Model's Window?
| Model | Context window | Max output |
|---|---|---|
| Qwen 3.8 Max | 1,131,072 | 131,072 |
| GPT-5.6 Sol | 1,050,000 | 128,000 |
| Gemini 3.1 Pro | 1,048,576 | 65,536 |
| GLM-5.2 | 1,048,576 | 128,000 |
| Kimi K3 | 1,048,576 | 1,048,576 |
| Claude Opus 5 | 1,000,000 | 128,000 |
| DeepSeek V4 Flash | 1,000,000 | 384,000 |
| Grok 4.20 | 1,000,000 | not published |
| Claude Haiku 4.5 | 200,000 | 64,000 |
"1M" is nine different numbers, from exactly 1,000,000 to 1,131,072 — a 13% spread before you measure a single token of your own content.
Why "1M Tokens" Doesn't Mean the Same Thing Everywhere
We sent one 2,638-character English document to nine models:
| Model | Tokens | Chars/token |
|---|---|---|
| Grok 4.20 | 614 | 4.30 |
| GPT-5.6 Sol | 626 | 4.21 |
| GLM-5.2 | 632 | 4.17 |
| DeepSeek V4 Flash | 634 | 4.16 |
| Gemini 3.1 Pro | 684 | 3.86 |
| Claude Opus 4.6 | 698 | 3.78 |
| Qwen 3.8 Max | 706 | 3.74 |
| Kimi K3 | 716 | 3.68 |
| Claude Opus 5 | 957 | 2.76 |
Claude Opus 5 is the outlier for a documented reason: Anthropic states that Claude 4.7 and later use a newer tokenizer producing "approximately 30% more tokens for the same text."
Translate that into how many copies of the document actually fit:
| Model | Advertised window | Document copies |
|---|---|---|
| GPT-5.6 Sol | 1,050,000 | 1,677 |
| GLM-5.2 | 1,048,576 | 1,659 |
| Grok 4.20 | 1,000,000 | 1,629 |
| Qwen 3.8 Max | 1,131,072 | 1,602 |
| DeepSeek V4 Flash | 1,000,000 | 1,577 |
| Gemini 3.1 Pro | 1,048,576 | 1,533 |
| Kimi K3 | 1,048,576 | 1,464 |
| Claude Opus 4.6 | 1,000,000 | 1,432 |
| Claude Opus 5 | 1,000,000 | 1,045 |
Similar advertised sizes, 1.60x difference in real capacity for this document. Content type shifts it again — code, English prose and non-English text tokenize differently. Measure your own content on the models you are choosing between.
What Happens When You Exceed It?
HTTP 400 and no output. Nothing is silently truncated.
{"error":{"code":null,
"message":"<400> InternalError.Algo.InvalidParameter: Range of input length should be [1, 30720]",
"type":"invalid_request_error"}}
Note the enforced input ceiling can be lower than the advertised total — 30,720 against 32,000 here, with the difference reserved for output.
Vendors differ in how they signal it. OpenAI-compatible endpoints return 400 with a context_length_exceeded code; Claude can finish with stop_reason: "model_context_window_exceeded". Both need distinct handling.
Does a Bigger Window Cost More?
Depends on the vendor, and this is where the cheaper headline rate can lose:
- Flat rate: Anthropic bills the full 1M at standard rates, no long-context premium
- Tiered: Gemini 3.1 Pro goes $2 → $4 per million input and $12 → $18 output once prompts exceed 200K; Grok 4.20 goes $1.25 → $2.50 input and $2.50 → $5.00 at the same threshold
Is the Advertised Window the Same as Usable Context?
No, and this is the most important caveat on the page. A model that accepts 1M tokens does not reliably retrieve information at the far end of it. Retrieval accuracy degrades with distance for every public model. Benchmarks like RULER, MRCR v2 and NoLiMa measure what actually works rather than what is accepted.
Treat the advertised window as an upper acceptance bound, not a capability claim.
How Do You Fit More In?
These reduce spend rather than expanding capacity:
- Prompt caching — stable prefixes bill at roughly 10% of input rates on a hit. Largest lever for repeated calls.
- Compaction — server-side summarisation of earlier turns keeps long agent sessions alive.
- Context editing — drop stale tool results and old reasoning blocks. Agent loops accumulate tool output faster than conversation.
- Tokenizer choice — picking the right model for your content is worth up to 1.6x effective capacity on its own.
How Do You Compare Token Counts Yourself?
Same request, different vendors, one loop:
from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.ai/v1", api_key="YOUR_OFOX_KEY")
text = open("your_document.txt").read()
for model in [
"anthropic/claude-opus-5",
"openai/gpt-5.6-sol",
"google/gemini-3.1-pro-preview",
"moonshotai/kimi-k3",
"z-ai/glm-5.2",
]:
r = client.chat.completions.create(
model=model, max_tokens=1,
messages=[{"role": "user", "content": text}],
)
n = r.usage.prompt_tokens
print(f"{model:32} {n:>7,} tokens {len(text)/n:.2f} chars/token")
max_tokens: 1 returns prompt_tokens at minimal cost.
Frequently Asked Questions
Is a context window the same as memory?
No. It is per-request only. Every turn you resend the whole conversation. Products that appear to remember you across sessions re-inject stored text; there is no persistent model memory.
How many words is 1 million tokens?
For English prose, roughly 440,000 to 685,000 words. Eight of nine models tested landed between 587,000 and 684,000; Claude Opus 5 reached about 439,000 because of its tokenizer. Code runs denser (2.4 to 3.6 chars/token), Chinese denser still.
Why does the same file use more tokens on Claude than GPT?
Different tokenizers. Anthropic's newer tokenizer in Claude 4.7+ produces roughly 30% more tokens for identical text. On our test document: 957 tokens on Opus 5 against 626 on GPT-5.6 Sol.
Does filling the window make the model slower?
Yes, and more expensive per turn. Every token is processed on each request, so a 400K-token conversation costs 400K tokens on every new turn unless prompt caching is active.
Can I increase a model's context window?
No. It is fixed by the model with no adjustment parameter. You can only spend it better.
References
- Anthropic: context windows
- Anthropic: pricing, including the tokenizer note
- Gemini API pricing
- ofox model catalog
Originally published on ofox.ai/blog.
Top comments (0)