Codex Guide
Codex is an AI Agent tool designed for code generation, modification, and review.
Installation
Choose an installation method based on your workflow.
Codex App is suitable for users who prefer a graphical interface.
Choose the installer for your system:
After downloading, follow the system prompts to install and launch it.
Connect to TokenFlux
After installation, choose one of the following methods to connect Codex to TokenFlux.
Using CC-Switch is recommended for centralized configuration.
Steps:
- Follow Create API Key to generate an API key.
- Follow CC-Switch to configure a unified provider.
- Restart
CodexorCodex Appafter configuration is complete.
About Remote Compaction
The configuration above already sets name in [model_providers.tokenflux] to OpenAI, which is what enables Codex remote compaction.
Codex triggers compaction when a long conversation approaches the context limit. Codex only prefers the remote compaction endpoint (/v1/responses/compact) when the upstream provider name is exactly OpenAI. Remote compaction has higher quality and keeps very long conversations stable, with less quality degradation.
If you change name to any other value (such as tokenflux), Codex falls back to local compaction, which works much worse.
Notes:
nameis the display name used to trigger remote compaction; keep it asOpenAI.- The provider id
tokenflux(used bymodel_providerand[model_providers.tokenflux]) is not affected and stays unchanged. - This setting does not lose your existing chat history.
1M Context Window
The ChatGPT groups now fully support a one-million-token context, and enabling it is recommended.
Install the Skill
Clone it into the Codex user skill directory:
git clone https://github.com/smartcmd/codex-context-window.git ~/.codex/skills/codex-context-windowYou can also send the following to Codex and let it handle installation and configuration:
Install this skill: https://github.com/smartcmd/codex-context-window
Then set the context window of gpt-5.6-luna, gpt-5.6-terra, and gpt-5.6-sol to 1M, with the auto-compaction threshold at 900k.Configure the Models
Start a new task so Codex discovers the skill, then send:
Set the context window of gpt-5.6-luna, gpt-5.6-terra, and gpt-5.6-sol to 1M, with the auto-compaction threshold at 900k.The skill confirms the target models, raw window size, effective-window percentage, and auto-compaction policy before writing anything. Restart Codex once it is done.
Keep the default effective percentage
Leave the effective percentage at its default of 95%. A 1M raw window then gives 950000 usable tokens, which is also the number the status bar reports.
Verify It Took Effect
Codex App: enable Show context window usage under Settings → General → Editor, then start a new message to see the window size.Codex CLI: run/statusand check the Context window field.
About codex-auto-review
To remove any ambiguity, codex-auto-review now redirects to gpt-5.6-sol by default.
Model routing is live, so you can redirect it yourself to gpt-5.6-terra or gpt-5.6-luna on the API keys page to lower your costs.