Codex Enable GPT-5.6 Sol 1M Context: 3-Line `config.toml` Configuration Tutorial

GPT-5.6 Sol officially supports a 1.05 million token context. Simply add 3 lines of configuration at the top of Codex's config.toml to run with a 1 million window, and it will automatically compact history at roughly 900,000 tokens. Includes permanent configuration, single command, verification, and cost reminders.

PandaNpcFirst published on
Codex Enable GPT-5.6 Sol 1M Context: 3-Line `config.toml` Configuration Tutorial

The official context window for GPT-5.6 Sol is 1,050,000 tokens, but Codex by default does not use the entire window. To minimize compression in long sessions, just add these 3 lines at the top of Codex's config.toml:

toml
model = "gpt-5.6-sol"
model_context_window = 1000000
model_auto_compact_token_limit = 900000

After saving, restart Codex and start a new session. Below we clearly explain the configuration location, what each line does, how to launch it for a single session, and important caveats.

First, the conclusion: what each of these 3 lines does

Configuration Purpose
model = "gpt-5.6-sol" Explicitly selects Sol, the flagship model of the GPT-5.6 series
model_context_window = 1000000 Tells Codex to allocate a 1 million token context budget for the current model
model_auto_compact_token_limit = 900000 Automatically compacts old history when active context approaches 900K tokens, avoiding hitting the window limit

OpenAI's Codex config reference has officially listed model_context_window and model_auto_compact_token_limit; GPT-5.6 Sol model page notes its context window is 1,050,000 tokens, with maximum output of 128,000 tokens.

Here we don't set it directly to 1,050,000; instead we use 1,000,000, leaving a little headroom for system prompts, tool results, and implementation differences. We set the auto-compact threshold at 900,000 so Codex has room to compress before the window is nearly full.

Step 1: Locate Codex's `config.toml`

Codex's user-level configuration file is located at:

  • macOS / Linux:~/.codex/config.toml
  • Windows:%USERPROFILE%\.codex\config.toml

On macOS or Linux, you can run directly:

bash
mkdir -p ~/.codex
nano ~/.codex/config.toml

On Windows PowerShell, run:

powershell
notepad $env:USERPROFILE\.codex\config.toml

Create the file if it doesn't exist; if it already exists, edit it in place. Don't overwrite existing MCP, permission, or project configuration.

Step 2: Place the configuration at the very top of the file

Put the following 3 lines at the very beginning of config.toml:

toml
model = "gpt-5.6-sol"
model_context_window = 1000000
model_auto_compact_token_limit = 900000

Make sure they come before the first [section] heading. For example, if your file already contains:

toml
[projects."/path/to/project"]
trust_level = "trusted"

Those 3 lines of model configuration must be placed above it. In TOML, ordinary keys written after [projects."..."] are treated as part of that section, not as global configuration.

If the file already has a line model = "...", simply change it to gpt-5.6-sol; don't write two model lines. Also use English half-width double quotes ", not curly quotes copied from rich text.

Step 3: Restart and start a new session

After saving the file:

  1. Exit the current Codex client or CLI;
  2. Restart Codex;
  3. Create a new session.

Old sessions that are already open usually won't switch context budget while running, so reloading the window and continuing an old thread is not reliable. The simplest approach is to create a new session.

You can use Codex's built-in diagnostic command to verify whether the configuration loaded successfully:

bash
codex doctor --json

Focus on these fields:

  • overallStatus is ok;
  • config.load is ok;
  • model shows gpt-5.6-sol.

This command verifies whether the config file can be parsed and loaded correctly; it won't actually consume hundreds of thousands of tokens just to "test 1M".

Without changing default config: enable 1M for the current CLI session only

If you only occasionally handle huge repositories or very long tasks and don't want all sessions to default to 1M, you can temporarily override at launch:

bash
codex -m gpt-5.6-sol \
  -c model_context_window=1000000 \
  -c model_auto_compact_token_limit=900000

These parameters only affect this launch. After closing the current Codex, the next time you start it will again use the default values from config.toml.

What scenarios suit a 1M context

It's best suited for these tasks:

  • Making consecutive changes across multiple modules in a large monorepo;
  • Agents that need to preserve architectural decisions, debugging process, and test results over long periods;
  • Inputting large amounts of design documents, API documentation, or logs at once;
  • When you don't want the task to frequently auto-compact midway and lose early details.

If you're just changing one or two files, fixing a normal bug, or writing a short script, Codex's default window is usually sufficient. A larger window means "can hold more", not that every turn must be filled, nor does longer context necessarily mean higher attention utilization from the model.

Cost and quality trade-offs you must know before enabling

Long context is useful, but it's not a free lunch.

1. Above 272K, API long context enters a higher price tier

OpenAI's GPT-5.6 Sol model page explicitly states: When input exceeds 272K tokens, the entire request's input is priced at 2x and output at 1.5x.

If you're billed via API, this will directly show on your bill; if you're logged in through a ChatGPT / Codex subscription, it may appear as faster credit consumption. Always follow the limit policy shown in the client.

2. Every turn carries longer history

The longer the session, the more attention you should pay to latency, token consumption, and caching behavior. If most of hundreds of thousands of tokens of old logs are no longer useful, carrying them as-is isn't necessarily better than a high-quality compressed summary.

3. Supporting 1M doesn't mean quality stays exactly the same at 1M

Extremely long context reduces the chance of information being truncated, but the model can still be distracted by large amounts of noise. We recommend clearing out build logs, repetitive tool output, and stale debugging paths promptly; when there's a clear phase shift in the task, you can also proactively use /compact.

Frequently Asked Questions

I've configured it, why hasn't the current session changed?

config.toml is mainly loaded at startup and when creating a session. Restart the client and create a new session; don't keep using an old long session to verify.

The config file loads, but the model isn't Sol?

Check whether you're using codex -m ..., --profile, and whether there is also a .codex/config.toml in the project directory. Codex command-line arguments, project config, and profiles can all override user-level config.

What if Codex says "unknown configuration option"?

First check the version:

bash
codex --version

Then update to the current version:

bash
codex update

Older versions of Codex may not yet have these two configuration keys.

What if I want to restore default settings?

Delete the following two lines to restore the model's own default context and auto-compact policy:

toml
model_context_window = 1000000
model_auto_compact_token_limit = 900000

You can keep model = "gpt-5.6-sol", or change it back to the model you used before.

Summary

To permanently enable GPT-5.6 Sol's 1M context, simply put these 3 lines at the very top of ~/.codex/config.toml:

toml
model = "gpt-5.6-sol"
model_context_window = 1000000
model_auto_compact_token_limit = 900000

1 million is the context budget, 900K is the auto-compact threshold. It's great for large repositories and long-running Agent tasks, but for ordinary tasks, sticking with Codex's default settings is often more credit-efficient, faster, and more stable.

If you need Codex to run long tasks on a development machine and don't want to stay in front of the computer, you can also use PandaNpc to view sessions and handle interactions remotely from a browser, desktop, or mobile phone.