What Is a Context Window? Token Limits by Model (2026)
A context window is the token budget for one request, input plus output. One identical document measured across 9 models: 614 to 957 tokens, a 1.56x spread.
A context window is the maximum number of tokens a model can handle in one request, counting the input and the output together.
Unit: tokens, not words or characters (~4 English chars per token, but it varies)
Scope: one request; not memory, does not persist between calls
Counts toward it: system prompt, full history, tool definitions, tool results, reasoning, the reply
Typical size: 200K on older or cheaper models, 1M on most current flagships
Largest in 2026: 1,131,072 (Qwen 3.8 Max); the even 1,000,000 is the low end of the 1M tier
If you exceed it: HTTP 400, no output; nothing is silently truncated
Does not tell you: how accurately the model uses the far end of that window
What Is a Context Window?
It is the token budget for a single API request. Everything the model reads and everything it writes has to fit inside one number.
The API is stateless. It does not remember the last call. On every turn your application resends the entire conversation, and the context window is the ceiling on how big that resend plus the coming reply is allowed to be.
That is why the window is not memory in any useful sense. A chat product that appears to remember your name across sessions is storing that text somewhere and pasting it back into the window on each request.
What Counts Toward the Context Window?
Everything in the request, plus everything in the response. The parts people forget are usually the expensive ones:
- System prompt. Counted on every single turn, not once per session.
- Full message history. Every prior user and assistant turn you resend.
- Tool definitions. Names, descriptions, and JSON schemas for every tool you declare. On Claude these also add a per-model tool-use system prompt, from 286 tokens on Opus 5 to 675 on Opus 4.7.
- Tool results. Often the biggest single item in an agent loop; a directory listing or an API response can be thousands of tokens.
- Reasoning tokens. On models with thinking enabled, the reasoning counts and is billed even when the text is not returned to you.
- The reply itself. Which is why
max_tokensand the context window interact: a request that leaves no room for output truncates.
That last point catches people. 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 Context Window?
1M tokens is the top of the mainstream tier, and 256K is the most common size overall. Across the 119 text models in the ofox catalog on 2026-08-12, 25 sit at 256K and 22 at 1M.
The flagship tier, with numbers as published by each vendor:
| 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 |
Two things worth noticing. Qwen 3.8 Max holds the largest published window of the group, and Kimi K3 is the only model here whose max output equals its full window, so it can in principle write a million tokens in one response. DeepSeek V4 Flash is second on output at 384,000, three times what most of this tier allows, which matters if you generate long documents rather than read them. And “1M” is nine different numbers, from an even 1,000,000 to 1,131,072, a 13% spread before you have measured anything.
One caution about where these come from. Gateway catalogs and vendor documentation do not always agree: on 2026-08-12 the ofox catalog listed Grok 4.20 at 2,000,000 while xAI’s own model docs state 1,000,000. The table above uses the vendor number. Check the vendor page when the figure matters.
Why Doesn’t “1M Tokens” Mean the Same Thing on Every Model?
Because a token is not a fixed amount of text, and the difference between tokenizers is larger than most people assume. We sent one identical 2,638-character English document (420 words, a service postmortem) to nine models through one endpoint and read prompt_tokens off each response.
| Model | Tokens for the same document | Characters per 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 |
Measured 2026-08-12. A 1.56x spread on identical input. Claude Opus 5 is the outlier because Anthropic documents that Claude 4.7 and later use a newer tokenizer producing “approximately 30% more tokens for the same text.”
Combine the two tables and the advertised window stops being the useful number. Here is how many copies of that same 420-word document actually fit:
| Model | Advertised window | Copies of the test document |
|---|---|---|
| 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 |
Every one of these advertises roughly 1M, and the real capacity for this document varies by 1.60x.
The ratio is not constant across content types, so do not carry these numbers to a different workload. On a TypeScript file the spread was 1.53x and GLM-5.2 was leanest rather than Grok. On Chinese prose the spread widened to 1.88x, and both Claude models landed close to one token per Chinese character, at 1.00 chars/token on that sample against 1.87 for Grok. Treat that as a sample, not a rule: on a second, punctuation-heavier Chinese passage the same two models came in at 0.98 and 0.96 chars/token, meaning some characters cost more than one token. If your input is code or non-English, measure it rather than assuming.
The practical rule: measure your own content on the models you are choosing between. One request with max_tokens: 1 returns prompt_tokens and costs almost nothing.
What Happens When You Exceed the Context Window?
You get an HTTP 400 and no output. Nothing is silently truncated. We sent an over-sized request to a 32,000-token model to see the exact behavior:
{"error":{"code":null,
"message":"<400> InternalError.Algo.InvalidParameter: Range of input length should be [1, 30720]",
"type":"invalid_request_error"}}
Read that limit carefully. The model advertises 32,000, and the enforced input ceiling is 30,720, with the remainder reserved for output. The advertised window is the total, not your input allowance, and the enforced number can be lower than the marketing one.
Error shapes differ by vendor, so do not pattern-match on the message string:
- OpenAI-compatible endpoints generally return a 400 with a
context_length_exceeded-style code. - Claude can instead finish the turn with
stop_reason: "model_context_window_exceeded", which is distinct frommax_tokensand needs its own branch in your code.
Handle both. A response that stops early because the window filled is not the same failure as one that stopped because your max_tokens was small, and the fixes differ.
Does a Bigger Context Window Cost More?
Sometimes, and it depends entirely on the vendor. Two pricing models are in play in 2026:
- Flat. Anthropic bills the full 1M window at standard rates with no long-context premium, so a 900K-token request costs the same per token as a 9K one.
- Tiered past 200K. Gemini 3.1 Pro goes from $2 to $4 per million input tokens and $12 to $18 output once a prompt crosses 200K. Grok 4.20 goes from $1.25 to $2.50 input and $2.50 to $5.00 output at the same threshold.
So the model with the cheaper headline rate can be the more expensive one for long-document work. If your workload routinely crosses 200K, check for a tier break before comparing sticker prices, and note that our prompt caching cost math applies on top of whichever tier you land in.
Is the Advertised Window the Same as Usable Context?
No, and this is the most important caveat on the page. A model accepting 1M tokens is not the same as a model reliably finding the fact you buried at token 800,000.
Retrieval accuracy degrades with distance for every public model, and the size of that gap is a benchmark question rather than a spec-sheet one. We covered it separately in LLM context windows: real accuracy past 200K tokens, which walks through what RULER, MRCR v2, and NoLiMa actually measure.
Treat the advertised window as an upper bound on what the API will accept, and the benchmark numbers as the guide to what the model will use well.
How Do You Fit More Into the Window You Have?
None of these makes the window bigger; they all reduce what you spend inside it. In rough order of payoff:
- Prompt caching. A stable prefix (system prompt, tool definitions, a document you keep asking about) is billed at roughly 10% of the input rate on a cache hit on Anthropic and several other vendors, though the exact discount varies and runs deeper at some. This is the single largest lever for repeated calls, and it changes cost, not capacity.
- Compaction. Server-side summarization of earlier turns once the conversation approaches the limit, so a long agent session keeps running instead of erroring.
- Context editing. Clearing stale tool results and old reasoning blocks out of the transcript. Agent loops fill up on tool output more than on conversation, and our Claude Code token optimization notes cover the coding-agent case specifically.
- Pick the right tokenizer for your content. As the tables above show, that decision alone is worth up to 1.6x of effective capacity before you optimize anything else.
How Do You Compare Token Counts Across Vendors Without Nine Accounts?
The honest comparison needs the same request sent to models from different vendors, and each vendor normally means its own key, its own SDK, and its own billing line. That is the friction: nobody sets up nine accounts to answer a sizing question, so the question usually gets answered with a rule of thumb instead of a measurement.
Because every model above speaks the same OpenAI-compatible HTTP shape, one client and one loop over model IDs is enough. Send max_tokens: 1 and read prompt_tokens; the model never writes an answer, so the measurement costs a fraction of a cent.
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")
That loop produced every measurement on this page. Run it on your own content before choosing a model on window size, because on the evidence above the advertised number is off by up to 1.6x in either direction.
References
Frequently Asked Questions
- Is a context window the same as memory?
- No. A context window is per request, not persistent. The API is stateless: every turn you resend the whole conversation, and the window is the ceiling on what one request may contain. Anything outside it is gone unless your application stores it and sends it again. Products that appear to remember you across sessions are re-injecting saved text into the window, not drawing on model memory.
- How many words is 1 million tokens?
- For English prose, roughly 440,000 to 685,000 words, which is a wider range than the usual rule of thumb admits. Working from our own measurement on one identical document, eight of the nine models we tested land between 587,000 and 684,000 words per million tokens; Claude Opus 5 is the low outlier at about 439,000 because of its newer tokenizer. Our measured range was 2.76 to 4.30 characters per token on the same English document. Code runs denser (about 2.4 to 3.6 chars/token) and Chinese denser still (0.9 to 1.9), so the same 1M window holds far less of those.
- What is the largest context window available in 2026?
- 1M tokens is the top of the mainstream tier, and several vendors sit slightly above the round number: Qwen 3.8 Max at 1,131,072, GPT-5.6 at 1,050,000, and Gemini, GLM, and Kimi K3 at 1,048,576. Claude, Grok 4.20, and DeepSeek V4 Flash publish an even 1,000,000. Across the 119 text models in the ofox catalog on 2026-08-12, the most common window is 256K (25 models), with 22 models at 1M.
- Why does the same file use more tokens on Claude than on GPT?
- Different tokenizers. Anthropic notes that Claude 4.7 and later use a newer tokenizer that produces roughly 30% more tokens for the same text than earlier Claude models. On our English test document Claude Opus 5 used 957 tokens where GPT-5.6 Sol used 626, a 1.53x difference on identical input. Nothing is wrong; the models just count differently, and per-token prices are not comparable across vendors without adjusting for it.
- Does filling the context window make the model slower?
- Yes, and usually more expensive per turn as well. Every token in the window is processed on every request, so a conversation that has grown to 400K tokens pays for 400K tokens on each new turn unless prompt caching is in play. Two vendors also charge a higher rate past 200K: Gemini 3.1 Pro goes from $2 to $4 per million input, and Grok 4.20 from $1.25 to $2.50.
- Can I increase a model's context window?
- No. It is fixed by the model and there is no parameter to raise it. What you can change is how much of it you spend: prompt caching cuts the cost of resending a stable prefix, context editing clears stale tool results, and compaction summarizes older turns. Those manage the budget rather than expanding it.


