Your input exceeds the context window of this model. Please adjust your input and try again.
The message
Your input exceeds the context window of this model. Please adjust your input and try again.What it means
The request is bigger than the model can take in one go: prompt, history, tool definitions and schemas all count toward the model's context window.
What to do
Send less: trim or summarize old turns, split large documents, drop unused tools. Retrying the same request gets the same refusal.
This is the OpenAI API refusing a request that's too large for the model. Today it usually reads:
Your input exceeds the context window of this model. Please adjust your input and try again.
Here it is inside a failed Responses API event, as OpenAI keeps it in a test fixture in the Codex repo:
{"type":"response.failed","sequence_number":3,"response":{"id":"resp_5c66275b97b9baef1ed95550adb3b7ec13b17aafd1d2f11b","object":"response","created_at":1759510079,"status":"failed","background":false,"error":{"code":"context_length_exceeded","message":"Your input exceeds the context window of this model. Please adjust your input and try again."},"usage":null,"user":null,"metadata":{}}}
The code, context_length_exceeded, is on 2,831 GitHub issues as of September 25, 2026, and more than half were opened since June.
The older wording, with numbers
Before this sentence, the message told you the sizes. Chat Completions still sent it in July 2026, as in this report:
BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 128000 tokens. However, your messages resulted in 163242 tokens (including 1873 in the response_format schemas.). Please reduce the length of the messages or schemas.", 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}
That one is more useful because it gives both numbers. Here the request was about 35,000 tokens over, and the note in brackets shows that a structured-output schema counted too. The new sentence leaves you to work out the size yourself. It's also where most new reports are: 211 issues quote it since June, against 37 for the old sentence.
What counts toward the window
Everything you send in the request. That's the conversation so far, system instructions, tool definitions and any schema, as the pyba example shows. In a long agent loop the history grows every turn, so a request that worked an hour ago can fail now without anything in your code changing.
The fix is always to send less. Summarize or drop the oldest turns, split a big document into pieces, and take out tools the model doesn't need for that call. Moving to a model with a bigger window also works (if there's one you can use for the job).
Why retrying is wasted
openai-python 3.19.2 turns this 400 into BadRequestError and doesn't retry it, which is right: the same input will fail the same way. The pyba report shows its own retry loop firing four times at the identical 163,242 tokens (each attempt waiting longer), which only delayed the failure.
Catch it by its code
This surprised us most. Tools that recognize this error by its wording can miss the new sentence. A LiteLLM bug filed on September 24, 2026 found that its check only knew "This model's maximum context length is", so the new message came through as a plain BadRequestError and its context-window fallbacks never ran. If your own code catches this error, test error.code == "context_length_exceeded".
Codex does exactly that and shows its own line instead: "Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying."
Other lines the same feature prints
Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.
context_length_exceededThis model's maximum context length is 128000 tokens. However, your messages resulted in 163242 tokens (including 1873 in the response_format schemas.). Please reduce the length of the messages or schemas.This model's maximum context length isopenai.BadRequestError: Error code: 400Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.