Overview
The context window is the maximum number of tokens a model can use in one request. It covers the system prompt, every message, tool definitions and results, images, and the output the model generates, including thinking. Claude Fable 5.1, Opus 5.5, Sonnet 5.5, and Haiku 5.5 have 1M-token windows with up to 128K output tokens. Haiku 5.5 is the one that bills long prompts higher: a prompt over 100K tokens pays 5x on the whole request.
A bigger window does not mean better recall. Accuracy and recall degrade as context grows (“context rot”), so curate what goes in rather than filling the window. Cost also scales with input tokens: 200K input tokens at Sonnet 5.5’s 0.40 per call before output, while retrieving 4K relevant tokens costs $0.008. Cache stable prefixes with prompt-cache.
On the Claude API, input that alone exceeds the window returns a 400 error. On Claude 4.5 and later models, a request whose input plus max_tokens exceeds the window is accepted and generation stops with stop_reason: "model_context_window_exceeded". For long conversations use server-side compaction or context editing; for large corpora retrieve with retrieval-augmented-generation unless the whole corpus fits the window at acceptable cost.
Related
- context-engineering: deciding what belongs in context.
- retrieval-augmented-generation: fetch only the relevant chunks.
- prompt-cache: pay less for repeated prefixes.
- token: how the window is measured.
- cost-control: budgeting input and output tokens.