Tokens
Context window
The context window is the total token budget for a single request, covering the system prompt, conversation history, tool definitions, documents and the response the model generates.
It is one budget, not two. A model advertising a 200,000 token window means the sum of everything you send plus everything it generates must fit inside that number.
Exceeding it with input alone produces an outright rejection. On newer models, if the input fits but input plus your requested maximum output does not, the request is accepted and generation simply stops when the limit arrives — a truncated answer rather than an error, which is considerably harder to notice in production.
In practice
A 200,000-token window does not mean you can send a 200,000-token prompt: the window is shared with the answer. Ask for 4,000 tokens of output and your real input ceiling is 196,000. Requests that fit in testing and fail in production are usually requests where conversation history grew into the space the answer needed.
Common questions
Does the context window include the output?
On most APIs, yes — input and output share the window. Request 4,000 tokens of output from a 200,000-token window and your real input ceiling is 196,000. This is the usual cause of requests that pass testing and fail in production.
Is a bigger context window always better?
No. Retrieval accuracy degrades as a window fills, and you pay for every token you send. A tightly retrieved 20,000-token prompt usually beats a padded 500,000-token one on accuracy and always beats it on cost.
Measure it
- Context Window CalculatorPaste your context. See which models swallow it whole and which will reject the request.
- Context Window Budget PlannerWindow allocation with a safety margin and the fixed overhead shown.
- Context Rot VisualizerFill level and position against recall. Why the middle is the weak spot.