let user customize context_window
Resolved 💬 2 comments Opened Sep 12, 2025 by jiangying000 Closed Dec 14, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What feature would you like to see?
I believe most users will never use up the 128k max output token (e.g. I almost never use>30k for output), but usually run out of the context window after long chat. Can we make the context window parameters customizable and calculate max_output_tokens based on the context_window ?
Are you interested in implementing this feature?
Not now
Additional information
Maybe it's better to let users specify the max output token and calculate the context window internally.
I get this error almost every day because of context not enough, which is annoying :
stream error: stream disconnected before completion: Your input exceeds the context window of this model. Please adjust your input and try again.
2 Comments
It would be great to have control over /autocompact — for example, by specifying either a number of tokens or a percentage — and to be able to adjust it even during an active session.
There are many cases where you practically never need to exceed 120k context, which already covers the vast majority of use cases.
But imagine this scenario: you start with an initial analysis that takes around 40k tokens, and then you continue by reviewing files and applying fixes, gradually pushing the context up to 120k.
If autocompact is hard-set to always trigger at 120k, this becomes frustrating — you risk losing the exact content of those files right when you might need to have a precise copy in order to make several detailed edits.
On the other hand, if you hard-set the limit to the full 270k, you’ll unnecessarily stretch the context to its maximum, which is wasteful and inefficient.
The challenge is finding a golden middle ground.
If Codex is to be a precise, professional tool, it shouldn’t make rigid assumptions on behalf of the user. The more flexibility, the better.
It’s far preferable to provide guidelines and best practices, rather than forcing a fixed behavior.
In this case, the context is directly governed by autocompact.
I’m writing this because there’s a PR moving in this direction right now — but I strongly feel that allowing user control and flexibility is key here.
Or, alternatively, equip the model itself with the ability to decide when to compact, optionally, so that it doesn’t disrupt the context in certain cases.
However, a rigid limit of 120k means that if you start iterating around 90k, in the next turn you might get unexpected results. And, as I mentioned, sometimes when the information in the context requires high precision, this can disrupt the workflow and degrade performance.
If you set compact too early and misalign it, you might get feedback from the community — similar to what Anthropic experienced — accusing you of deliberately dumbing down Codex just to save resources.
This feature request hasn't received any upvotes or additional posts in a long time, so I'm going to close it.