Codex config.toml Setup, Settings & Fixes
Need a working Codex configuration? Put the file at ~/.codex/config.toml, paste the provider
setup below, save your API key with codex login --with-api-key, and verify the result with
/status. The same file is shared by Codex CLI and the Codex IDE extension.
Official OpenAI documentation reviewed 2026-08-17; strict configuration behavior tested with codex-cli 0.145.0. Codex changes quickly, so repeat the validation steps after an upgrade. For installation, start with Codex Setup. For the editor extension, continue with VS Code setup.
Keep API keys and bearer tokens out of
config.toml, source control, documentation, and shell history.
Copy-paste Codex setup
- Create an account and copy a key from API Keys.
- Create
~/.codex/config.toml. On Windows,~is your user profile directory. - Paste this configuration:
model_provider = "icodeeasy"
model = "gpt-5.6-sol"
model_reasoning_effort = "xhigh"
plan_mode_reasoning_effort = "xhigh"
cli_auth_credentials_store = "file"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
[model_providers.icodeeasy]
name = "I Code Easy"
base_url = "https://api.icodeeasy.cc"
wire_api = "responses"
requires_openai_auth = true
Do not append /v1 to this Codex Provider Base URL. If the primary domain is slow or unreachable
from your network, change only base_url to https://jp.icodeeasy.cc or
https://sg.icodeeasy.cc. You can compare the currently available domains on
Endpoints.
- Save the API key without writing it into
config.toml.
Linux and macOS:
read -s OPENAI_API_KEY
printf '\n'
printf '%s' "$OPENAI_API_KEY" | codex login --with-api-key
unset OPENAI_API_KEY
codex login status
PowerShell:
$secureKey = Read-Host "API Key" -AsSecureString
$plainKey = [System.Net.NetworkCredential]::new("", $secureKey).Password
$plainKey | codex login --with-api-key
$plainKey = $null
codex login status
Codex writes the credential to ~/.codex/auth.json. Do not create or edit that file manually.
Verify the configuration
Start Codex inside a project:
codex
Then run:
/status
/debug-config
The important /status lines should identify the selected model and destination:
Model: gpt-5.6-sol (reasoning xhigh)
Model provider: I Code Easy - https://api.icodeeasy.cc
Account: API key configured
Verification checklist:
codex login statusconfirms that a login is stored./statusshowsgpt-5.6-sol, reasoningxhigh, and the intended Provider URL./debug-configshows which file or CLI override supplied each effective value.- A real prompt returns text and completes its stream; an HTTP response alone is not a complete configuration check.
If the Provider URL or model is wrong, fix the highest-precedence configuration layer instead of editing every file you can find.
Quick answers for common config.toml questions
| Question | Short answer | Verify with |
|---|---|---|
| Where is config.toml? | ~/.codex/config.toml stores user settings; trusted projects may add .codex/config.toml. | /debug-config |
| How do I set reasoning effort? | Set model_reasoning_effort to a value supported by the selected model. | /status |
| Where should credentials live? | Use codex login --with-api-key; do not put secrets in config.toml. | codex login status |
| How do I change the Base URL? | Edit base_url inside the active [model_providers.<id>] table. | /status |
| Should I set disable_response_storage? | No. Codex CLI 0.145.0 rejects it under strict config, the field is absent from the current public reference, and strict config validation catches it. | --strict-config |
Configuration location and precedence
The user-level file is:
~/.codex/config.toml
Higher-precedence values override lower-precedence values in this order:
- CLI flags and
-c/--configoverrides; .codex/config.tomlfiles from the trusted project root down to the current directory;- the selected
$CODEX_HOME/<name>.config.tomlprofile; - user configuration at
~/.codex/config.toml; - system configuration;
- Codex defaults.
A trusted project can provide project-local configuration, hooks, and rules. It still cannot override
provider routing, authentication, or profile selection. Codex ignores model_provider,
[model_providers.<id>], openai_base_url, and profile-related keys in project-local configuration.
Keep those settings in ~/.codex/config.toml or the selected
$CODEX_HOME/<name>.config.toml profile file.
Top-level TOML keys must appear before the first table:
model = "gpt-5.6-sol"
model_reasoning_effort = "xhigh"
[model_providers.icodeeasy]
name = "I Code Easy"
After a table header, later keys belong to that table until another table begins.
Model and reasoning settings
model
model = "gpt-5.6-sol"
The model name is sent to the active Provider. Verify the selected model, tool calls, streaming completion, and usage reporting with a real request.
model_reasoning_effort
model_reasoning_effort = "xhigh"
| Value | Good fit | Trade-off |
|---|---|---|
minimal or low | Small, mechanical edits | Faster, less reasoning |
medium | Routine coding and explanations | Balanced |
high | Multi-file work and difficult debugging | More latency and reasoning use |
xhigh | High-value, ambiguous work | Highest supported reasoning use |
The official reference lists minimal, low, medium, high, and xhigh.
xhigh remains model-dependent. A value accepted by TOML parsing can still be unsupported by the
selected model, so confirm the effective value in /status.
plan_mode_reasoning_effort
plan_mode_reasoning_effort = "xhigh"
This is a Plan-mode-specific override. Remove it to use Codex's built-in Plan-mode preset.
Avoid hard-coding model_context_window or model_auto_compact_token_limit unless the active
model's real limit has been verified.
Provider ID, Base URL, and authentication
model_provider = "icodeeasy"
[model_providers.icodeeasy]
name = "I Code Easy"
base_url = "https://api.icodeeasy.cc"
wire_api = "responses"
requires_openai_auth = true
| Field | What it does |
|---|---|
model_provider | Selects the Provider ID. |
[model_providers.icodeeasy] | Defines settings for that ID. |
name | Sets the display label shown in /status. |
base_url | Sets the actual request destination. |
wire_api | Selects the Responses API protocol; responses is the supported value. |
requires_openai_auth | Uses the credential managed by codex login. |
Changing only name does not change routing, authentication, latency, or billing. The Provider ID
is also stored in session metadata. If you rename or remove it, an older session may fail to resume
with:
failed to load configuration: Model provider `icodeeasy` not found
Restore the original Provider definition to resume the session.
Authentication
The copy-paste configuration uses:
cli_auth_credentials_store = "file"
requires_openai_auth = true
The official reference supports file, keyring, and auto for
cli_auth_credentials_store. file stores credentials in ~/.codex/auth.json; keyring uses the
operating-system credential store; auto uses the OS store when available and otherwise falls back
to the file.
With requires_openai_auth = true, Codex can use an API key saved by
codex login --with-api-key, and it ignores a Provider-level env_key. These are alternative
authentication methods, not two settings to combine.
For a provider-specific environment variable instead, remove requires_openai_auth = true and use:
[model_providers.example]
name = "Example Provider"
base_url = "https://example.com"
env_key = "EXAMPLE_API_KEY"
wire_api = "responses"
Do not use both methods for one Provider. Run codex login --with-api-key again to rotate the saved
key, or codex logout to remove the current login.
Project trust and profiles
Trust only repositories you control:
[projects."/absolute/path/to/repository"]
trust_level = "trusted"
An untrusted project skips project-scoped .codex/ configuration, hooks, and rules. User and system
configuration still load.
Current Codex profiles are separate files next to the user configuration. Keep only the differences in each profile:
# ~/.codex/quick.config.toml
model_reasoning_effort = "medium"
plan_mode_reasoning_effort = "high"
codex --profile quick
Keep the stable Provider ID in the base user configuration so saved sessions can still find it.
Fix 401, 429, and connection errors
401 Unauthorized
A 401 normally means Codex sent no usable credential or the saved key is invalid.
- Run
codex login status. - Copy an active key from API Keys.
- Run
codex login --with-api-keyagain. - Confirm that
requires_openai_auth = trueis present and that you did not also rely onenv_key. - Restart the failed Codex session and check
/status.
Do not paste the key into config.toml while debugging.
429 Too Many Requests
A 429 is not a TOML syntax error. Check account balance and model availability, then retry with lower concurrency. If only one model fails, test another available model before changing authentication. Use Endpoints to compare access domains and Recharge when the account needs more balance.
Connection failed or timed out
- Confirm that
base_urlhas no/v1suffix and no trailing path. - Try
https://jp.icodeeasy.ccorhttps://sg.icodeeasy.ccas the Base URL. - Check whether a VPN, corporate proxy, DNS filter, or local firewall can reach the selected domain.
- Run
/statusagain to prove that Codex loaded the URL you changed.
If the URL in /status did not change, another configuration layer has higher precedence.
Provider not found after resume
If an old session names a Provider ID that is no longer defined, restore the matching
[model_providers.<id>] table. Do not edit Codex session files by hand.
Unknown configuration field
Run a strict validation after changing fields:
codex --strict-config mcp-server </dev/null
Fix the first reported field, then run the command again. A field from an old blog post or issue may no longer be part of the current public contract.
Obsolete fields and validation
Do not add this old field to Codex CLI 0.145.0:
disable_response_storage = true
The current public configuration reference does not list it. A local strict check reports
unknown configuration field disable_response_storage; that proves only that the tested Codex
version rejects the setting. It does not make a claim about service-side retention.
Next steps
- New to the product? Create an account and then open API Keys.
- Already have a key? Compare Endpoints, paste the configuration, and verify
it with
/status. - Need installation or Windows steps? Follow Codex Setup.
- Using the IDE extension? Continue with VS Code setup.
Official references
- Codex configuration basics
- Codex Configuration Reference
- Codex Advanced Configuration
- Codex Authentication
- Codex CLI command reference
Related guides
Codex Setup
Install Codex CLI, store the API key in auth.json, configure the I Code Easy provider and Base URL, and start a first Codex session.
VS Code Setup
Install and configure Codex or Claude extensions in VS Code, use secure credentials and custom API addresses, and resolve login prompts.
FAQ
Troubleshoot API keys, 401 and 429 responses, Windows environment variables, client connectivity, quotas, and support reporting.