All Articles

Codex Context Window: Size, the 1M Setting, and How to Check Usage (2026)

GPT-6 Astra and the GPT-5.6 models list 1,050,000 tokens, but a default Codex session gives you about 258,000. Here is why, how to opt into 1M, and how to check usage.

Codex Context Window: Size, the 1M Setting, and How to Check Usage (2026)

Key Takeaways

The advertised 1,050,000-token figure is the API ceiling for GPT-6 Astra and the GPT-5.6 models, not your Codex budget; a default session caps input at 272,000 and reports roughly 258,000 usable.

Size is not the lever. Accuracy degrades as the window fills, a pattern researchers call context rot.

The system prompt, tool definitions, AGENTS.md files (32 KiB cap), and file reads spend the budget before real work starts.

GPT-5.6 Sol can run a 1,000,000-token window in Codex once you set model_context_window and a compaction limit; check /status to confirm what your client actually honors.

Manage it with /status, /compact, /clear, /new, and auto-compaction, then curate what you load instead of stuffing the window.

The durable fix is upstream: a context engine like Unblocked hands Codex the reconciled slice it needs from code, PRs, Slack, Jira, and docs, which is how Cloudbeds gets the same answers at a third of the tokens.

OpenAI lists a 1,050,000-token context window for every current Codex model, from GPT-6 Astra down to GPT-5.6 Luna, with a maximum output of 128,000 (OpenAI GPT-6 Astra model page, 2026). A default Codex session gives you about 258,000 of that. You can opt into the full million on GPT-5.6 Sol with two config keys, and even then the tokens do not all work equally well. The number on the box is not the capacity you get, and the capacity is not the real constraint anyway. Three numbers run through this guide: 1,050,000 advertised, 272,000 as the default input cap and the pricing threshold, and roughly 258,000 you can actually fill. Below, we cover how the Codex context window works, why the usable budget is so much smaller than the headline, how to raise it when a task needs it, and how to manage it day to day. Feed the agent only the context that matters, because a clean window usually beats a full one.

Updated September 10, 2026 for GPT-6 Astra and the GPT-5.6 model family. The July version of this guide described the GPT-5.5 cap; the defaults it explained still apply.

How big is the Codex context window, really?#

Every current Codex model advertises the same 1,050,000-token API context window with 128,000 tokens of output: GPT-6 Astra, launched September 3, 2026, and the GPT-5.6 family of Sol, Terra, and Luna (OpenAI GPT-6 Astra model page; GPT-5.6 Sol model page, 2026). Inside Codex, a default session on any of them reports about 258,400 usable tokens, roughly a quarter of the advertised million. That gap is what trips people up.

The arithmetic has not changed across model generations. Codex sets a 272,000-token input cap and keeps about 5% headroom, so 272,000 times 0.95 lands near 258,400; the same figures were reported for GPT-5.5 in the spring and for GPT-5.6 Sol in July (openai/codex #19319; openai/codex #32806, 2026). One dated note, because models move fast: as of September 2026 Codex recommends Astra, lists the three GPT-5.6 models plus the text-only 5.3 Codex Spark preview, treats GPT-5.5 as previous generation, and retired GPT-5.4 and 5.4 Mini on August 31 (Codex models, 2026). The window number keeps changing. The management discipline doesn't.

NumberWhat it isTokens
AdvertisedAPI context window, GPT-6 Astra and all GPT-5.6 models1,050,000
Default input capWhat a Codex session allows before compaction, unless you raise it272,000
Usable by defaultEffective input budget (272K x ~0.95)~258,400
Opt-inGPT-5.6 Sol with model_context_window set1,000,000

Sources: OpenAI GPT-6 Astra model page, 2026; openai/codex #32806, 2026; Thibault Sottiaux, OpenAI Codex, 2026.

Why is the usable window smaller than the advertised one?#

The gap is by design, not a defect, though it has generated its share of confused bug reports. Codex holds input to 272,000 tokens by default and trims about 5% as headroom, leaving roughly 258,000 for you to fill, and the CLI reserves room beyond that for the model's own output (openai/codex #32806, 2026). OpenAI's stated reason is that the default was tuned as a balance between performance and cost, with the larger setting available when a task calls for it (Thibault Sottiaux, OpenAI Codex, 2026).

There is also a price edge at the top of the window, and 272,000 is exactly where it sits. On the API, prompts above 272,000 input tokens are billed at 2x input and 1.5x output for the full request, on every current model. Standard rates run $10 per million input and $50 output on GPT-6 Astra, $4 and $20 on GPT-5.6 Sol, $2 and $12 on Terra, and $0.20 and $1.20 on Luna (OpenAI model pages, 2026). On a ChatGPT plan, Codex draws from a rolling five-hour usage allowance instead, and a fuller window drains it faster (Codex pricing, 2026). So there are two reasons to treat the openai codex context budget as something you defend rather than fill: you run out of room, and you pay a premium for the last stretch.

Does a bigger context window make Codex smarter?#

No. The NoLiMa benchmark tested 13 models that advertise contexts of 128K tokens or more and found that performance fell steeply as input grew once the answer could not be found by literal keyword matching; by 32K tokens, most of the models had dropped below half of their short-context scores (NoLiMa, arXiv 2502.05167, 2025). A bigger window buys more room, not more accuracy.

The pattern holds across studies. "Hidden in the Haystack" found that smaller gold contexts degrade performance and amplify positional sensitivity across eleven leading language models (arXiv 2505.18148, 2025). Even inside your ~258,000-token default budget, then, stuffing the window quietly lowers the quality of the answer, and opting into a million tokens on Sol widens the room for that degradation rather than removing it. The lever that does move accuracy is what goes in: Unblocked scores, compresses, and assembles context server-side before Codex sees it, so the window holds the pull request and the Slack thread that matter instead of forty files that might.

Adoption is outrunning trust. Codex passed 5 million weekly active users by June 2026, up from around 600,000 at the start of the year (Constellation Research, 2026), yet only about 33% of developers trust the accuracy of AI tools, down from 43% the year before (Stack Overflow Developer Survey, 2025). What closes that gap is context discipline, not window size. We dig into why a full window lowers accuracy in a companion piece.

Where does the Codex context window actually go?#

Before you type a task, the window is already paying rent. The system prompt, the tool definitions, and your AGENTS.md files all load first; AGENTS.md is read root to leaf, with nearer files overriding, and is skipped once the combined size hits project_doc_max_bytes, 32 KiB by default (OpenAI AGENTS.md guide, 2026). By the time work starts, a real chunk of the ~258,000 is gone.

In our own sessions, two line items do most of the damage: every connected MCP tool pays for its schema each turn, and file reads pile up fast as the agent explores. The fix is unglamorous. Keep AGENTS.md scoped and under the cap, and prune tool definitions you never call. That hygiene buys back usable window before you spend a token on the actual task, which is exactly the tool-definition tax we autopsied server by server. The bigger saving is structural. One Unblocked MCP connection covers GitHub, Jira, Confluence, Slack, Notion, and more, so Codex loads one schema instead of five and gets back an answer that has already been reconciled across those sources. Cloudbeds measured the difference on a real incident investigation:

Unblocked used about a third of the tokens. Five thousand versus fifteen thousand. And the thing I thought was amazing is that Unblocked had the answer already. The rest was just my AI dressing it up. After that I opened up about twenty PRs, and now the first thing all of our skills do is ask Unblocked.

Charles ThompsonEngineering Manager, Reservation and Guest, Cloudbeds

Line itemLoaded whenEffect on budget
System promptEvery sessionFixed overhead
Tool definitionsEach turn, per connected toolGrows with tool count
AGENTS.md filesSession start, root to leafSkipped past 32 KiB
File readsAs the agent exploresDominates ongoing usage

Source: OpenAI AGENTS.md guide, 2026.

Does Codex have a 1M context window, and how do you turn it on?#

Yes, as an opt-in. On August 17, 2026, OpenAI's Codex lead documented how to run GPT-5.6 Sol with a 1,000,000-token budget and extended the option from API keys to ChatGPT accounts (Thibault Sottiaux, OpenAI Codex, 2026). Two config keys do the work, both in the Codex config reference: model_context_window, "context window tokens available to the active model," and model_auto_compact_token_limit, the "token threshold that triggers automatic history compaction."

Open ~/.codex/config.toml and add these at the top level, above any [section] header, then restart Codex and start a new session:

tomlmodel = "gpt-5.6-sol"
model_context_window = 1000000
model_auto_compact_token_limit = 900000

To try it for a single session without touching your defaults:

textcodex -m gpt-5.6-sol -c model_context_window=1000000 -c model_auto_compact_token_limit=900000

Sol is the model OpenAI has documented for this. GPT-6 Astra carries the same 1,050,000-token API window and a 922,000-token input ceiling (OpenAI GPT-6 Astra model page, 2026), but a default Codex session still reports about 258,000, and OpenAI has not published an Astra-specific override, so set the same keys with model = "gpt-6-astra" and confirm with /status before trusting the number. GPT-5.5 stays at the default cap; the request to raise it is an open issue (openai/codex #19464, 2026). The 900,000 compaction threshold leaves headroom so a long session summarizes before it hits the wall rather than after, and note that anything past 272,000 input tokens bills at the long-context premium on API keys. Before you reach for the million, ask what you would fill it with. If the answer is whole repositories and wiki exports so the agent can find the one relevant decision, Unblocked does that retrieval for you and hands back the decision, with source links, inside the default budget.

How do you check how much context Codex has used?#

Run /status inside a session. It prints the active model, the token usage so far, and the writable roots, which is the fastest way to see how close you are to the compaction threshold. For a number that stays on screen, run /statusline once and Codex keeps a live context and token counter in the footer. Both commands ship with the CLI, so there is nothing to install.

Read the number against the usable budget, not the advertised one. On a default session, whichever model you run, that budget is roughly 258,000 tokens after the headroom described above. On GPT-5.6 Sol with the 1M setting it is whatever you put in model_auto_compact_token_limit. When usage passes about two thirds of either figure, /compact before the next long detour, since the long-context benchmarks show accuracy sliding long before the window is full (NoLiMa, arXiv 2502.05167, 2025). If /status keeps climbing on the same kinds of tasks, the fix is usually not a bigger number but a better first step: teams like Cloudbeds start every Codex skill by asking Unblocked, so the window opens with the answer instead of the search.

How do you manage the Codex context window day to day?#

Per OpenAI's documentation, Codex ships built-in controls for managing the window, and most users touch only two of them (OpenAI Codex docs, 2026). The levers below map to a single command each, so the codex cli context budget stays visible and recoverable instead of silently filling until quality drops.

text/status        see the active model, token usage, and writable roots
/compact       summarize the conversation to reclaim tokens, keeping key details
/clear         wipe the conversation to start clean
/new           start a fresh session in the same repo
/statusline    surface a live context and token counter in the footer

Two more levers sit outside the command line. Auto-compaction fires automatically near the limit and is tunable through the compaction threshold in config. AGENTS.md hygiene, keeping the file under its 32 KiB cap and pruning unused tools, protects the budget at the source (OpenAI AGENTS.md guide, 2026). The practical rule: start fresh per task, compact before a long detour, and curate what you load. When the built-ins aren't enough, we compare six options, from output sandboxing to memory layers, in our roundup of the best tools to manage the Codex context window.

What actually fixes the context problem, and where can't Codex help?#

The window controls slow the bleed; they don't supply the right context. Codex still can't tell which doc is current, why the code is shaped the way it is, or what your team already tried and rejected. None of that lives in the files it reads, which is why curation beats raw token count every time, the same lesson Anthropic's own guidance draws: find the smallest set of high-signal tokens for each step (Anthropic Engineering, 2025).

The durable fix is retrieval: pull only the slice that matters instead of loading the whole window. That is what context engineering is for, and one engineer described his setup plainly:

My setup tells the agent: before you implement anything, go check Unblocked. It has everything — our repos, Notion, Slack, coding standards — and it surfaces things I wouldn't have thought to look for. GitHub Copilot doesn't have any of that organizational context.

Justin McCrawSoftware Engineer, The Information

Unblocked, the context engine for agentic software development, does exactly this: it reads your code, pull requests, Slack, Jira, Confluence, and Notion into one graph, resolves the contradictions between them by recency, authority, and proximity, enforces each user's permissions, and feeds Codex the reconciled slice with source links instead of asking the window to hold everything. Your agent already knows the code; this is the rest of the context. That habit, feeding the agent the right context on demand, is the lever the window size never was. It is also why "bigger window" lands as myth number three and why context engineering is the discipline underneath it.

Frequently asked questions about the Codex context window#

How big is the Codex context window?#

GPT-6 Astra and the GPT-5.6 models advertise a 1,050,000-token API window with 128,000 tokens of output, but a default Codex session caps input at 272,000 and reports about 258,000 usable (OpenAI GPT-6 Astra model page; openai/codex #32806, 2026). Input is the part you actually fill, and even that fills with overhead before your first prompt.

Why does Codex show ~258K when OpenAI advertises 1M?#

Codex applies a 272,000-token default input cap and keeps about 5% headroom, so 272,000 times 0.95 leaves roughly 258,000 input tokens to fill (openai/codex #32806, 2026). The 1,050,000 figure is the API ceiling for the model, not your Codex budget, unless you raise model_context_window on GPT-5.6 Sol.

How do I free up context in Codex?#

Use /compact to summarize the conversation and keep going, or /clear and /new to reset for a fresh task; auto-compaction also kicks in near the limit (OpenAI Codex docs, 2026). Run /status first to see where your tokens went before deciding which control to reach for.

Does a bigger context window cost more?#

Yes. On the API, prompts above 272,000 input tokens bill at 2x input and 1.5x output for the whole request, on top of standard rates of $10 and $50 per million on GPT-6 Astra or $4 and $20 on GPT-5.6 Sol (OpenAI GPT-6 Astra model page; GPT-5.6 Sol model page, 2026). On a ChatGPT plan, a fuller window drains the five-hour usage allowance faster. So the top of the window is both scarce and pricier.

Which Codex model should you use for long sessions?#

As of September 2026, Codex recommends GPT-6 Astra for complex work and positions GPT-5.6 Sol as the most capable GPT-5.6 model, with Terra for everyday tasks and Luna for speed and cost (Codex models, 2026). Sol is the one with a documented 1M opt-in, and Astra costs two and a half times more per token. Either way, curating context beats filling the window, since accuracy degrades with input length regardless of model.

How do I enable the 1M context window in Codex?#

Set model = "gpt-5.6-sol", model_context_window = 1000000, and model_auto_compact_token_limit = 900000 at the top level of ~/.codex/config.toml, then restart Codex and open a new session. OpenAI documented the setting for GPT-5.6 Sol in August 2026 and opened it to ChatGPT accounts. For GPT-6 Astra, set the same keys and confirm with /status; GPT-5.5 stays at the default cap.

Is a context engine a fix for Codex context limits?#

Yes, and it is the only one that does not trade room for accuracy. Unblocked delivers the relevant, reconciled context from code, PRs, Slack, Jira, and docs over a single MCP connection, so Codex loads less and starts with the answer; Cloudbeds reports the same result at about a third of the tokens (Cloudbeds customer story, 2026).

How do I see how much context Codex has used?#

Type /status in the session for the current model and token usage, or /statusline to keep a live counter in the footer. Compare the figure with the usable budget for your session, about 258,000 tokens by default, and compact before you get close.

Spending the Window Wisely#

The Codex context window is smaller and more expensive at the top than the headline suggests, and accuracy drops before you ever fill it. That changes the job. Stop chasing a bigger budget and start defending the one you have: check /status, compact before long detours, clear between tasks, keep AGENTS.md lean, and prune tools you don't use. Those habits held from GPT-5.5 through GPT-5.6 to GPT-6 Astra, and they will hold through whatever ships next quarter.

The deeper win is upstream of any command. Unblocked decides what's worth a token, surfacing the current doc and the reason the code looks the way it does, so the agent starts with signal instead of noise and you stop babysitting it through a full window. If you also work in Anthropic's tooling, the same logic governs the Claude Code context window. Open /status on your next Codex session and watch how fast the window fills; that is where the real savings start.