The context window is the most tokens a model can hold at once, where a token is a short chunk of text. It covers the system prompt and message history, plus tool definitions and results. Generated tokens count too, so input and output share one budget. Sizes run from roughly 128K tokens to about a million.
If the input alone exceeds it, the request fails before generation with a 400 error, not a shortened answer.
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "prompt is too long: 205000 tokens > 200000 maximum"
}
}
Two traps. On many models max_tokens counts against the window, so a big value can reject a prompt that fits. Claude 4.5 and newer accept it and stop with model_context_window_exceeded if output fills the window. And quality often drops well before the hard limit, because models recall the middle of a long input less reliably.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓