docs/src/content/docs/en/configuration/agents/codex.md
Codex is OpenAI's coding agent. CCR supports both surfaces:
config.toml and opens the CLI through a middleware launcher.Use this page to route Codex to a non-OpenAI provider, pin a model, or run isolated Codex/ChatGPT instances.
New to CCR? Add a provider and model first. See Add a provider and the Agent Config overview.
codex on PATH), or the ChatGPT desktop app is installed.When you save a Codex profile, CCR writes managed blocks into the Codex config file (config.toml):
model_provider, model, and a model_catalog_json pointer at the top level.[model_providers.<providerId>] table with the CCR gateway /v1 base URL, a bearer token, and wire_api = "responses".<providerId>.config.toml profile file (Codex's separate-profile-files format).ccr-model-catalog.json) the native app-server reads for model/list.CODEX_HOME, the provider/model, and the entry mode, then runs Codex.With Only opened from CCR, these files live in an isolated CCR-managed directory keyed by the profile id. With System default, CCR writes ~/.codex/config.toml.
For the ChatGPT app, CCR starts the Electron executable inside the app bundle directly, gives it an isolated user-data directory, and points CODEX_CLI_PATH at the CCR middleware. The middleware forwards app-server traffic to ChatGPT's bundled Codex CLI and only adapts the account display; it does not synthesize model or plugin listings.
Codex - Work).| Field | How to set it | Effect |
|---|---|---|
| Agent | Choose Codex | Tells CCR to apply the Codex config.toml mechanism. |
| Config name | Free text, e.g. Codex - Work | Identifies the profile and is used in ccr-app "<name>". |
| Enabled | Toggle on/off | Disabled profiles are not applied and not offered as launch entries. |
| Effect scope | Only opened from CCR / System default | Isolated CCR-managed files vs. the real ~/.codex/config.toml. Only one enabled system-default Codex profile is allowed. |
| Entry mode | CLI & APP / CLI only / App only | Which launch entries (terminal command and/or ChatGPT app) are exposed. |
| Provider ID | Alphanumerics, ., _, -; default claude-code-router | Writes Codex model_provider and the provider table key. Keep it stable. |
| Provider name | Free text; default Claude Code Router | Display name shown in Codex. |
| Codex model | Provider model or Fusion model | Default Codex model. If left empty, CCR uses the first available default model. |
| Show all sessions | Toggle | Writes show_all_sessions so Codex lists all sessions. |
| Config file | Path, default ~/.codex/config.toml | Used in System default scope; Only opened from CCR writes into CCR-managed directories. |
| Codex CLI path | Optional absolute path to the codex binary | Used by the middleware launcher. Fill only when Codex is not on PATH. |
| Codex home | Optional directory | Sets CODEX_HOME. Fill only when you need a specific home directory. |
| Remote frontend mode | app / cli / claude-code | How the middleware presents the Codex frontend. Leave default unless you have a specific reason. |
| CCR managed compact | Toggle | Lets CCR manage context compaction for this profile. |
| Environment variables | Key/value rows | Injected into Codex CLI / ChatGPT. See below. |
| Bot | Select a saved Bot (App entry only) | Binds an AgentClaw IM bot to the ChatGPT app entry. |
CCR_CODEX_CHATGPT_AUTH_FILE (legacy CODEXL_CODEX_CHATGPT_AUTH_FILE) — path to a valid auth.json. Set it only when a profile should share a ChatGPT login token in memory (without copying it). By default each profile reads login state only from its own Codex home.Each profile without shared credentials reports a local non-OpenAI compatibility identity so current ChatGPT builds do not enter a repeated authentication/attestation loop. CCR creates a short-lived
ccr-local-profilebootstrap only during process startup and removes it after the first native response; it is never retained as login state.
ccr-app "Codex - Work"
Each profile has its own id. With Only opened from CCR, Codex gets isolated config files and a middleware launcher, and ChatGPT gets an isolated user-data directory, so several Codex profiles can run at once with different models or providers.
With a Bot bound and ChatGPT opened from CCR, the companion worker uses native Codex rollout Sessions for Project/Session browsing and continuation, queueing, cancellation, model settings, usage, attachments, and diagnostics. It exists only alongside the managed app. See AgentClaw.
CCR_CODEX_CHATGPT_AUTH_FILE.