Quick answer: Codex auto-compacts a GPT-6 Sol session at 244,800 tokens: 90% of the 272,000-token window it assigns the model. Raising model_auto_compact_token_limit above that number does nothing unless you also...

Codex auto-compact on GPT-6 Sol: the defaults in the source code, and what raising them costs

Updated September 27, 2026 · first published September 27, 2026

Codex auto-compacts a GPT-6 Sol session at 244,800 tokens: 90% of the 272,000-token window it assigns the model. Raising model_auto_compact_token_limit above that number does nothing unless you also raise model_context_window. If you raise the window past 272K, every turn that crosses the line is billed at long-context rates. We read the numbers from the Codex 0.157.1 source code and from the model catalog Codex downloads.

What context window does Codex give GPT-6 Sol?

272,000 tokens, even though the API accepts up to 922,000. Codex downloads a model catalog and caches it in ~/.codex/models_cache.json. The entry for gpt-6-sol lists a context_window of 272,000 and a max_context_window of 872,000. It also sets effective_context_window_percent to 95 and leaves auto_compact_token_limit empty. GPT-6 Astra and GPT-6 Luna have the same values.

272K is not an arbitrary number. It is exactly where GPT-6 long-context pricing starts.

ValueTokensWhere it comes from
Context window272,000context_window in the model catalog
Usable window258,40095% of the window (effective_context_window_percent)
Auto-compact threshold244,80090% of the window, computed in code
Largest window allowed872,000max_context_window in the model catalog
API input limit922,000OpenAI model spec (1.05M total with output)

How does Codex decide when to compact?

It takes the smaller of your configured limit and 90% of the context window. In codex-rs/protocol/src/openai_models.rs, auto_compact_token_limit() computes context_window * 9 / 10. It returns that value or your configured limit, whichever is lower. The catalog ships no limit for GPT-6 Sol, so by default the result is 272,000 × 0.9 = 244,800.

So the setting can only move compaction earlier. Put model_auto_compact_token_limit = 300000 in config.toml with the default window, and Codex still compacts at 244,800 without any warning. To compact later you also have to raise model_context_window, and that moves the ceiling too: at the 872,000 maximum, the default threshold becomes 784,800.

A second setting, model_auto_compact_token_limit_scope, defaults to total, which counts the whole active context. The alternative, body_after_prefix, counts only what the conversation adds after the context it carried in from before.

What does raising the Codex window past 272K cost?

Per turn, a lot more than the extra tokens. Once a GPT-6 Sol request has more than 272K input tokens, the whole request is billed at long-context rates. Input and cached input cost twice as much, and output costs 1.5 times as much. In a long agent session almost every turn sends the whole history again, so most of that input is cached prefix.

Context per turnCached input rateCached context cost per turnUncached cost per turn
240K (compacts at the default)$0.20 / 1M$0.048$0.48
270K$0.20 / 1M$0.054$0.54
300K (window raised)$0.40 / 1M$0.12$1.20
400K (window raised)$0.40 / 1M$0.16$1.60

Going from 270K to 300K adds 11% more tokens and multiplies the cost of each turn by 2.2. On a ChatGPT plan you don’t see a bill, but the same tokens count against your 5-hour and weekly Codex limits, so a bigger window uses them up faster. The context-window-paid-twice write-up explains why this repeat charge dominates long sessions.

Is GPT-6 Sol still accurate near 244K tokens?

Nobody has measured that yet. The only independent long-context score for GPT-6 Sol is Artificial Analysis AA-LCR: 84%, the same as GPT-5.6 Sol. The documents in that test average about 100K tokens. The MRCR figures you see quoted for “Sol” at 256K–512K belong to GPT-5.6 Sol. Our GPT-6 Sol long-context benchmark roundup lists what has and hasn’t been published as of 27 September 2026.

What should you set?

For most teams, nothing. The default is already the cost-safe choice. Compacting at 244,800 keeps every request under the 272K price line, with room for output. Three situations call for a change:

# ~/.codex/config.toml
model = "gpt-6-sol"
model_context_window = 272000          # pin the default window, below the 272K price line
model_auto_compact_token_limit = 240000 # anything above 244,800 is ignored at this window

Sources

Related


Want this applied to your own LLM spend? FinOps LLM runs a free audit of your AI costs and shows where the savings are. Book free audit →

Back to research