Codex Context Window: Turn On 1M Tokens, or Skip It
The Codex context window starts smaller than the models allow, and you can raise it to 1,000,000 tokens by adding two settings to your config file. It works across the GPT-5.6 models in Codex. I turned it on, ran it for a few days, and put it back, because long requests move to a higher rate and the extra room never paid for itself.
Key Takeaways
- Codex starts a session with a smaller context window than the models document. You can raise it to 1 million tokens.
- The change is two settings in one file, then a model switch and a restart. It takes about a minute.
- It works on all three of the current Codex models, not just one of them.
- In my own use the bigger window drew my weekly allowance down noticeably faster, because requests over 272K input tokens move to a higher rate.
- Codex compacts well enough that the bigger window did not pay for itself, and a fresh session handles what compaction eventually loses.
Short on time? Jump to turning on the 1M window, which is the part you can do today.
What Is the Codex Context Window?
The Codex context window is the amount of text Codex can hold in one session at once: your files, your instructions, its own replies, and everything else it has read so far. When a session fills that window, Codex compacts the conversation, summarising what came before so the session can keep going.
Codex shows you the size in its status line, at the bottom of the terminal, next to the model name and your remaining weekly limit.

How big is the Codex context window by default?
At the time of writing, my Codex sessions read 258K window in the status line before I changed anything. Yours may read something else, so check your own rather than assuming mine.
The models hold a good deal more. OpenAI gives each of the current GPT-5.6 models a 1,050,000 token context window. That headroom is what makes the change below possible.
What does the 1M setting change?
Raising the Codex context window to 1,000,000 tokens means Codex compacts far less often. A long session holds more of its own history, so you spend less time watching it summarise and catch up again. The 1,000,000 figure sits just under the model's documented ceiling, which is why it is the number to use rather than something larger.
Which models support the larger window?
All three of the current Codex models take the setting: Sol, Terra and Luna, which are the GPT-5.6 model names inside Codex at the time of writing. I ran the change on each of them. If you are weighing which to use day to day, I compared them on price. Your reasoning effort setting is untouched either way, so whatever you had on low, medium, high or xhigh stays exactly where it was.

How to Turn On the 1M Codex Context Window
Four steps, one file, about a minute.
Step 1: Open your Codex config file
The file lives at ~/.codex/config.toml. If you have never opened it, it may hold only a model name and a reasoning effort setting, or nothing at all.
Step 2: Add the two settings at the top of the file
Put these at the top level of the file, above any [section] heading. This part matters more than it looks: TOML reads everything after a section heading as belonging to that section, so a setting placed further down quietly applies to the wrong thing.
model_context_window = 1000000
model_auto_compact_token_limit = 900000
The first line sets the window. The second tells Codex when to start compacting, and the gap between the two numbers is the point of it: compaction needs room to run, and a single turn can add a lot at once, so with no headroom you meet a hard stop where you wanted a summary. Both are top level keys.
Step 3: Switch models, then restart Codex
Saving the file was not enough on my machine. Type /model, pick a different one, then type /model again and pick the one you want back. Restart Codex after that. Until I did all three, the status line kept reporting the old number.
Step 4: Check the status line
Open a session and look at the bottom of the terminal. The window figure should now read 1M window.

Have Codex make the change for you
Editing TOML by hand is the kind of small job worth handing over. This prompt has Codex read its own config, show you what is there, ask before it edits, and check the file is still valid afterwards. Paste it into Codex with your project open.
Inspect my Codex configuration at ~/.codex/config.toml and upgrade my default configuration to use a 1,000,000 token context window. Preserve every existing setting and section.
At the top level, before the first [section] header, ensure these settings exist exactly once:
model_context_window = 1000000
model_auto_compact_token_limit = 900000
Do not change my existing reasoning effort setting or any unrelated configuration. If duplicate or conflicting versions of these settings exist, consolidate them safely.
Before editing, show me the relevant current settings and ask for confirmation. After confirmation, make the change, validate that the TOML remains valid, show me the final relevant settings, and tell me whether I need to restart Codex or begin a new session.
Swap in your own model name if you want the change pinned to a specific one.
What the Bigger Codex Context Window Costs
OpenAI prices requests carrying more than 272K input tokens at 2x input and 1.5x output, for the whole request, and says so on all three model pages. That threshold sits above the default window I was running, so the cost only starts to bite once you have raised it.
On a subscription plan that cost never arrives as a bill, so the place you notice it is your weekly allowance. Running the bigger window drew mine down faster than the same work on the default, and a week that normally leaves me comfortable had me watching the meter by Thursday. If that allowance is the thing you keep running into, there is more on stretching usage limits in Codex.
Does it change how much you get done?
Not on its own. What you are buying is fewer compactions. How hard the model thinks is set by reasoning effort, a separate key that this change does not touch.
Does it slow anything down?
Longer sessions carry more history, and more history is more for the model to read on every turn. That cost is real but modest next to the usage limit one, which is the reason I stopped.
Why I Left the Codex Context Window on the Default
A bigger context window is not the upgrade it looks like. Compaction is what actually carries a long session, and Codex does it well enough that buying your way around it rarely pays.
I ran the 1M window for a few days across all three models. The sessions were longer and the compaction pauses were rarer, and I could not point at a piece of work that came out better for it. I use AI tools more than eight hours a day, and on the default window I changed sessions twice in a week. Paying a premium on every long request to avoid a summary step that was holding up fine is a trade I would not make again.
So I put it back, and the honest recommendation is to leave it alone until a job actually calls for it.
When the larger window is worth it
Turn it on for a job, not as a standing default. Set it, do the work, and put it back.
| Situation | Codex context window to run |
|---|---|
| One large task where everything has to stay live at once | 1M |
| A long file or repository review in a single pass | 1M |
| A migration that would lose the thread across a compaction | 1M |
| Ordinary day to day work, however long the sessions run | Default |
| Anywhere your weekly allowance is already tight | Default |
One more reason to treat it as temporary. You are setting this number by hand, and it does not follow the model. The three models above all carry the same ceiling, so the setting travels safely between them, but move to any model with a smaller one and compaction is still calibrated to the bigger figure you typed. That is the headroom problem from step 2, pointed at the model instead of at the session. I did not run into it myself, and it is still an argument for turning the setting on for a job rather than for good.
Start a fresh session instead
The habit that replaced it for me is simpler and free. After roughly ten to fifteen compactions, I start a new session. That is a rule of thumb from my own use rather than a documented number, but the pattern behind it is consistent: compaction holds up for a long stretch and then starts to thin out, and a fresh session with a short brief beats a heavily compacted one. That thinning out is the moment a bigger window looks tempting, and a cleaner start is the cheaper answer to it.
If you want more of this kind of judgment on where AI actually earns its cost, that is what the workshop covers in more depth.
