Every API call has a single token ceiling, and it covers both what you send and what the model writes back. The OpenAI documentation states plainly that the context window limits the tokens a model can work with in a request, and that models also have a separate output limit the OpenAI token guide. Practitioners often describe this as input plus output must fit inside the context length, and setting the output cap too high relative to a long input produces an error a Stack Overflow thread on managing token limits.
This matters because teams usually do the arithmetic backwards. They build the prompt to fill the window, then hand whatever is left to the model as output. When the prompt consumes the whole budget, the model has nowhere to put its answer. The fix is to reverse the order: decide how much output you need first, subtract it, and treat what remains as the prompt's spending money.
The OpenAI help page also notes that reasoning models spend internal reasoning tokens that count toward output usage and are billed as output tokens, so a short visible answer can consume more of the window than its text suggests the OpenAI token guide. Your reservation needs headroom for this, which is why we add a margin rather than using the full context length.
The other reason not to max out the window: performance degrades before you hit the hard limit. Model recall and reasoning degrade as the context fills, even well inside the advertised window, a phenomenon often called context rot the foojay analysis of context as a budget. Attention concentrates on the beginning and end of the input, so information in the middle gets less reliable processing the Redis guide to context window overflow. A budget that leaves slack is both correct and kinder to the model.



