The context window is the maximum amount of text — measured in tokens — that a language model can process in a single request. Everything the model can "see" when generating a response must fit within this limit: your system prompt, conversation history, retrieved documents, and the user's message.
Context window size is one of the most misunderstood specs in LLMs. Bigger isn't always better — and long contexts have real cost implications that compound at scale.
When you send a request to an LLM, the model processes every token in the input simultaneously through its attention mechanism. Each token attends to every other token — which is what gives LLMs their ability to reason across long documents. But this comes at a cost: attention complexity scales quadratically with context length. Double the context, quadruple the compute.
The context window includes everything in a single API call:
| Model | Context window | Practical usable length |
|---|---|---|
| GPT-4o | 128K tokens | ~100K (quality degrades near limit) |
| Claude Sonnet 4.6 | 200K tokens | ~180K |
| Claude Opus 4.6 | 200K tokens | ~180K |
| Gemini 2.5 Pro | 1M tokens | ~800K |
| Gemini 2.5 Flash | 1M tokens | ~800K |
| Llama 3.3-70B | 128K tokens | ~100K |
| Mistral Large | 128K tokens | ~100K |
| DeepSeek-V3 | 128K tokens | ~100K |
Gemini's 1M token context window is the current frontier — enough to process entire codebases, books, or hours of transcripts in a single call.
Research has consistently shown that LLMs perform worse on information buried in the middle of long contexts. Models tend to attend more strongly to content at the beginning and end of the context window. This means:
Longer context = higher cost per call. The relationship is approximately linear for input token pricing, but the compute cost internally is quadratic. This is why providers charge more per token for very long context models:
| Gemini 2.5 Pro context | Input price per 1M tokens |
|---|---|
| Under 200K tokens | $1.25 |
| Over 200K tokens | $2.50 |
At scale, stuffing context windows is expensive. A RAG pipeline that injects 10 chunks of 500 tokens each adds 5,000 tokens to every call. At 100K calls/day that's 500M extra tokens — roughly $625/day at Gemini Flash pricing.
The most common context waste in chat applications is sending the full conversation history with every turn. Implement a rolling window or summarize older turns:
// Keep last 6 turns instead of full history
const trimmed = conversationHistory.slice(-6)
// Or summarize when history exceeds a threshold
if (history.length > 20) {
const summary = await summarize(history.slice(0, -10))
history = [{ role: 'system', content: `Summary: ${summary}` }, ...history.slice(-10)]
}
System prompts are sent with every call. A 1,500-token system prompt adds 1,500 tokens to every single request. Token waste analysis consistently finds system prompts are 40-70% redundant. Rewrite them to minimum effective form.
Retrieve fewer, more relevant chunks rather than more chunks. Smaller chunks (200 tokens vs 500 tokens) and a reranker to filter before injection significantly reduce context overhead without quality loss.
Anthropic and Google both offer prompt caching — if your system prompt or document context is repeated across calls, the cached portion is processed once and reused at a lower per-token rate.
The context window isn't a bin to fill — it's a budget to spend wisely. Every token you add to context is a token you pay for on every single call.
Tokoscope tracks input/output token breakdown per call so you can see exactly how your context window budget is being spent. Free to start.
Get started free →