Input is only half the bill
The context window is not just what you send. It also has to contain what the model writes back. Some models also spend reasoning tokens that count against the request budget even when they are not displayed directly. If you ask for a 30-page rewrite after stuffing the entire window with source material, you have designed a failure.
Reasoning models change the math
OpenAI o-series and Claude extended-thinking models can emit thousands of hidden reasoning tokens before answering. Some providers bill them; some do not. All of them count against the per-request token cap. A request that 'should' fit can fail mid-generation because reasoning consumed the headroom.
Reserve output explicitly
For long tasks, decide the output budget first. Then decide how much source material can fit. This feels backwards until you watch a model truncate the final answer right before the important part — and then it feels obvious.