Definition
A context window is the maximum sequence of tokens a model can consider during one inference request. It commonly includes system instructions, conversation history, tool descriptions and results, retrieved evidence, the current user input, and tokens generated for the answer.
The exact accounting rules and any separate input or output limits depend on the model and API.
Simple example
An application uses a model with a 128,000-token window. Its instructions, chat history, and retrieved passages occupy 110,000 tokens. If the application reserves 8,000 tokens for the answer, only about 10,000 tokens remain for additional input within that budget.
Why it matters
Input and generated output share the available context. An application has to choose which history, retrieved passages, and tool results to include while leaving room for the answer.
One important nuance
Fitting text into the window does not mean the model will use every part equally well. Longer inputs generally require more processing and may increase latency or token-based API costs. They can also make relevant evidence harder to use reliably. An application may set a smaller working budget than the model permits and select what goes into it.