A context window is the maximum amount of text, measured in tokens, that a large language model can read and use at one time while it generates an answer. It works like the model's working memory. Your instructions, the conversation so far, any documents you paste in, and the reply itself must all fit inside it. The model cannot see anything outside the window.
This guide goes past the one-line definition. You will see why the window matters for quality, cost, and speed, how tokens turn text into window space, and how sizes compare across popular models. You will also learn how to stay inside the limit without losing information, and how to pick the right size for your own workload. The worked examples use arithmetic you can adapt to your own traffic.
We write this from the inference side. Geodd serves models through one OpenAI-compatible API, and context limits shape most production decisions. They affect how long a prompt can be, what a long request costs, and when trimming beats paying for more room.
Why the context window matters for real applications
The window sets the ceiling on prompt length, document size, and conversation length. Everything else about a long-input application follows from that ceiling, and from what happens near it.
What the context window determines in an AI tool
In practice, the window determines three things. It decides how long a conversation can run before early details drop out. It decides how large a document or codebase you can process in a single request. It also decides how much room is left for the answer.
Many teams forget the third point. The window holds everything the model handles in a request, including a hidden system prompt, tool definitions, and retrieved passages. A 128,000-token window does not mean 128,000 tokens of your own content.
What happens when you exceed it
Behavior at the limit depends on the layer you use. Raw APIs usually reject the request with an error when the prompt plus the allowed output exceeds the window. Chat apps and agent frameworks often truncate or summarize older content instead, and they do so silently.

Silent truncation is the dangerous case. The model keeps answering fluently, but without the instruction or fact that fell out of view. Teams often diagnose that as a hallucination, when the real cause is a missing input.
Why bigger is not automatically better
A larger window raises the ceiling, but it brings tradeoffs. You pay per token processed, so a long prompt costs more on every call. Attention compute grows faster than linearly with length, and in the standard formulation doubling the input roughly quadruples the processing needed, so long prompts also tend to respond more slowly.
Quality does not scale cleanly either. A 2023 study titled "Lost in the Middle" found that models use information at the start and end of a long input better than information buried in the middle. Anthropic's research on many-shot jailbreaking also showed that longer contexts give adversarial prompts more room to work.
A bigger window raises the ceiling, not the quality of what sits inside it.
How a token context window works
The window is counted in tokens, not words, and the count covers far more than your own message. Once you see what consumes tokens, most surprises about limits stop being surprises.
Tokens, not words, fill the window
A token is a chunk of text. It can be a single character, a word fragment such as a prefix, a whole word, or a short phrase. For English prose, a workable rule is about four characters, or three-quarters of a word, per token. Some references use a more conservative 1.5 tokens per word, which is a safe upper bound for planning.
The table uses the three-quarters rule and 300 words per printed page.
| Window size (tokens) | Approx. words | Approx. pages |
|---|---|---|
| 8,000 | 6,000 | 20 |
| 32,000 | 24,000 | 80 |
| 128,000 | 96,000 | 320 |
| 200,000 | 150,000 | 500 |
| 400,000 | 300,000 | 1,000 |
| 1,000,000 | 750,000 | 2,500 |
Treat these as estimates. Each model family uses its own tokenizer, and the same passage can produce different counts on different models.
What else takes up space
Your visible prompt is only one occupant. System prompts, tool and function definitions, retrieved documents, and tool outputs all count. So do formatting characters and line breaks.

Conversation history is the biggest hidden cost. The API is stateless, so your application resends the earlier turns with every new request, and each one consumes window space again. Language and content type matter as well. Code and non-English text often need more tokens per word. One study cited by IBM found the same sentence took over seven times as many tokens in Telugu as in English.
Input and output share the budget
The prompt and the generated answer draw from the same window. If a model has a 128,000-token window and you send 120,000 tokens, only about 8,000 remain for the reply. Many models also cap output separately. GPT-4o, for example, combined a 128,000-token window with a 16,384-token output limit.
Reasoning models add one more drain, because the tokens they spend thinking count toward the budget too. Set your maximum output deliberately, and include it in every size calculation.
Window space is shared: every token you send is a token the model cannot spend on its answer.
Context window size across popular models
Mainstream LLM windows now sit between 128,000 tokens and 1 million. ChatGPT launched on a model with 4,096. The jump took only a few years, but the headline number is only part of the story.
Published window sizes
The figures below come from published documentation and vendor announcements. Vendors change them often, so confirm the current number before you design around one.
| Model | Context window | Notes |
|---|---|---|
| GPT-3.5 (ChatGPT launch) | 4,096 tokens | Later extended to 8,192 |
| GPT-4 (launch) | 8,192 tokens | Later versions reached 128,000 |
| GPT-4o | 128,000 tokens | Output capped at 16,384 |
| Llama 3.1 and 3.2 | 128,000 tokens | Open-weight family |
| Mistral Large 2 | 128,000 tokens | Flagship Mistral model |
| Claude (standard plans) | About 200,000 tokens | Higher on some enterprise plans |
| GPT-5 (API) | 400,000 tokens | Per OpenAI model documentation |
| Gemini 3.1 Pro | 1,000,000 input tokens | Output up to 64,000 |
| Gemini 1.5 Pro | 2,000,000 tokens | Earlier generation |
How to read the numbers
Three cautions apply. First, the window can depend on the plan and not only the model. Anthropic announced a 500,000-token window for Claude through its enterprise plan, against about 200,000 on standard plans. Second, the advertised window is not the effective window. Models can lose accuracy long before the limit, so test at your real lengths.
Third, your provider may expose a different limit than the model's maximum. Check the exact model version you will call. Geodd's model pages, such as those for GLM 5.3 Flash, DeepSeek V4.1 Flash, and GPT-OSS-120B, are where to confirm pricing and capabilities. Verify the context limit there before you commit to a design.
Compare windows on the exact model version and plan you will actually call, not the headline number.
How to work within the context window limit
Treat the window as a budget. Measure what each request spends, then cut or compress whatever the answer does not need.
Build a token budget
List every source that fills a request: system prompt, tool definitions, conversation history, retrieved documents, user input, and the output allowance. Then compute the worst case, not the average.
History is where budgets break. Say a support assistant has a 1,000-token system prompt, and each turn adds 600 tokens (the user message plus the reply). Input on turn n is 1,000 + 600 × (n − 1) tokens, so turn 20 sends 12,400. Across all 20 turns, the model reads 20 × 1,000 + 600 × (0 + 1 + … + 19) = 134,000 input tokens, though the finished conversation is only about 13,000 tokens long.
The conversation fits easily in any modern window, but the bill grows with the square of the turn count. Long chats cost far more than their final length suggests.
Techniques that keep requests small
Most of the savings come from a short list of habits:
- Trim old turns. Keep the original task and the last few exchanges in full.
- Summarize at breakpoints. Replace 30 steps of history with a short summary of decisions and facts.
- Compress tool outputs. If a query returns 100 rows, pass the count and the top five.
- Retrieve instead of paste. Send the passages that matter for this question.
- Place critical instructions at the start and end, where models attend best.
- Cap the output length so a runaway answer cannot crowd out the input.
When to use long context and when to retrieve
Long context and retrieval solve different problems, and mixing them up is expensive.
| Situation | Better approach |
|---|---|
| Question about one 80,000-token contract | Long context |
| Search across 10,000 documents | Retrieval, then a small context |
| Long-running agent with many tool calls | Rolling summary plus recent steps in full |
| Knowledge that changes daily | Retrieval from a live index |
| Comparing several documents side by side | Long context |
Send the model what it needs for this step, not everything it has ever seen.
How to choose a context window size for your workload
Pick the smallest window that fits your largest realistic request plus the output, with 20 to 30 percent headroom. Running near 100 percent of the window leaves no room for the one unusually long request that production will eventually send.
Size the worst case, not the average
Follow five steps:

- Collect real inputs and count their tokens with the model's tokenizer or the usage figures that API responses report.
- Take a high percentile, such as the 99th, not the mean.
- Add the system prompt, tool definitions, and any retrieved content.
- Add the maximum output you will allow.
- Add 20 to 30 percent headroom.
Here is a worked example for a contract review tool. A 120-page contract at 500 words per page is 60,000 words, or about 80,000 tokens at three-quarters of a word per token. Add a 1,500-token system prompt, 2,000 tokens of tool definitions, and a 4,000-token output allowance, and the request totals 87,500 tokens. With 25 percent headroom you need about 110,000, so a 128,000-token window fits and a 32,000-token one cannot.
Test before you commit
Fit is not the same as accuracy. Build an evaluation set at your real lengths. Plant a known fact near the middle of the input, and check the answers when the window is about a quarter, half, and nearly full. If accuracy falls at 90 percent fill, reduce your inputs or switch to retrieval.
OpenAI SDK compatibility makes this comparison cheap. You can point the same evaluation at different models on one API by changing the model name. Cost is per token, so measure token usage during the test and project it against your request volume.
Long prompts also hold more GPU memory per concurrent request. That matters when you weigh serverless against dedicated inference, because sustained long-context traffic changes how much capacity you need to plan.
Size for your 99th-percentile request, then test accuracy at that length before you commit.
Using your context window well
The context window is a model's token-based working memory, and its size controls how much it can consider at once. It also shapes your costs and decides what the model forgets. A larger window helps, but only when you budget it, keep irrelevant material out, and test at realistic lengths.
If you are choosing a model for an application where window size matters, start with the limits and pricing of the exact version you plan to run. You can compare Geodd's model APIs and their context limits, then run your own long-input test through the OpenAI-compatible API before you commit.



