Codex config.toml: location, keys and examples
Codex reads its settings from a TOML file. This guide is a short map of the official Codex config documentation: where the file lives, how layers override each other, a hand-picked set of documented keys, and a few examples copied from the official pages. It is not the full reference — the Configuration Reference documents far more keys than appear here — and anything the pages checked do not say is marked “not found in the sources checked”. Checked against official sources on Oct 13, 2026.
Where the Codex CLI config.toml lives
Per the basic config page, user-level configuration is stored at ~/.codex/config.toml. To scope settings to a project or subfolder, add a .codex/config.toml file in the repository. The CLI and the IDE extension share the same configuration layers, and the extension can open the file from the gear icon via Codex Settings > Open config.toml.
CODEX_HOME sets the root for Codex state — config, auth, logs, sessions, skills and standalone package metadata — and defaults to ~/.codex; if you set it, the directory must already exist (environment variables). Files commonly found there include config.toml, auth.json and history.jsonl (advanced config).
On Windows, OpenAI’s Help Center (Using Codex with your ChatGPT plan) says to open ~/.codex/config.toml on macOS or Linux, or %USERPROFILE%\.codex\config.toml on Windows.
Codex configuration layers and precedence
The basic config page lists the order Codex resolves a value in, highest precedence first:
- CLI flags and
--configoverrides - Project
.codex/config.toml(trusted projects only; the closest one wins) - The profile file selected with
--profile - User
~/.codex/config.toml - Cloud-managed defaults
- System
/etc/codex/config.toml - Built-in defaults
For security, Codex loads project .codex/ layers only when you trust the project. Even then, the advanced config page says Codex ignores some keys in a project-local file and prints a startup warning: openai_base_url, chatgpt_base_url, apps_mcp_product_sku, model_provider, model_providers, notify, profile, profiles, experimental_realtime_ws_base_url and otel. On managed machines an organization may also enforce constraints through requirements.toml. Inside the CLI, /debug-config prints the config layers and policy sources (command reference).
Codex config keys documented in the reference
A selection, one line each, paraphrased from the descriptions in the Configuration Reference (which documents many more). Re-read the reference before relying on any key not listed here.
| Key | What the reference says it does | Source |
|---|---|---|
model | Which model Codex uses. | Configuration Reference |
approval_policy | When Codex pauses for approval before executing commands (values include on-request and never). | Configuration Reference |
sandbox_mode | Sandbox policy for filesystem and network access: read-only, workspace-write or danger-full-access. | Configuration Reference |
sandbox_workspace_write.network_access | Allow outbound network access inside the workspace-write sandbox. | Configuration Reference |
default_permissions | Name of the default permissions profile applied to sandboxed tool calls. | Configuration Reference |
model_reasoning_effort | Reasoning effort level; the available levels depend on the model and client. | Configuration Reference |
web_search | Web search mode: disabled, cached, indexed or live. | Configuration Reference |
notify | Command invoked for notifications; it receives a JSON payload from Codex. | Configuration Reference |
developer_instructions | Additional developer instructions injected into the session. | Configuration Reference |
model_instructions_file | Replacement for the built-in instructions instead of AGENTS.md. | Configuration Reference |
project_doc_max_bytes | Maximum bytes read from AGENTS.md when building project instructions. | Configuration Reference |
log_dir | Directory where Codex writes log files; defaults to $CODEX_HOME/log. | Configuration Reference |
check_for_update_on_startup | Check for Codex updates on startup (the reference says to set it to false only when updates are centrally managed). | Configuration Reference |
cli_auth_credentials_store | Where the CLI stores cached credentials: file, keyring, auto or ephemeral. | Configuration Reference |
forced_login_method | Restrict Codex to one authentication method: chatgpt or api. | Configuration Reference |
history.persistence | Whether session transcripts are saved to history.jsonl: save-all or none. | Configuration Reference |
history.max_bytes | If set, caps the history file size by dropping the oldest entries. | Configuration Reference |
shell_environment_policy.inherit | Baseline environment inheritance when spawning subprocesses: all, core or none. | Configuration Reference |
model_providers.<id> | Custom provider definition; the built-in IDs openai, ollama and lmstudio are reserved. | Configuration Reference |
mcp_servers.<id>.command | Launcher command for an MCP stdio server. | Configuration Reference |
tui.status_line | Ordered list of footer status-line items; null disables the status line. | Configuration Reference |
[features] | Table that toggles optional and experimental capabilities (basic config page). | Basic config |
Profiles
Profiles are separate files. When you pass --profile profile-name, Codex loads ~/.codex/config.toml and then overlays ~/.codex/profile-name.config.toml; the profile file uses top-level keys, not a table. Try it with codex --profile deep-review. The advanced config page also says that in current releases the older [profiles.profile-name] table in config.toml and the top-level profile = "profile-name" selector no longer work.
One-off overrides with -c / --config
Prefer a dedicated flag when one exists; use -c / --config to override an arbitrary key. Values are parsed as TOML, dot notation sets nested keys, and the docs advise quoting the value so your shell does not split it on spaces. Lines copied from the “One-off overrides from the CLI” section of the advanced config page:
# Generic key/value override (value is TOML, not JSON) codex --config sandbox_workspace_write.network_access=true codex --config 'shell_environment_policy.include_only=["PATH","HOME"]'
Feature flags have their own switch: codex --enable feature_name from the CLI, and codex features enable|disable persists flags into $CODEX_HOME/config.toml.
Codex config toml example snippets
Copied line for line from the official pages. Lines that name a specific model were left out on purpose, because model names change.
A profile file
From the “Profiles” section of the advanced config page:
# ~/.codex/deep-review.config.toml model_reasoning_effort = "medium" approval_policy = "on-request"
Turning off history, and a notify command
From the “History persistence” and “Notifications” sections of the same page:
[history] persistence = "none"
notify = ["python3", "/path/to/notify.py"]
A custom model provider
From the “Custom model providers” section of the same page:
model_provider = "proxy" [model_providers.proxy] name = "OpenAI using LLM proxy" base_url = "http://proxy.example.com" env_key = "OPENAI_API_KEY"
Is there a usage-limit or reset setting in config.toml?
No rate-limit, usage or reset key appears in the Configuration Reference, and none of the pages checked links config.toml to usage limits. The closest thing is display only: tui.status_line (set interactively by /statusline) can show rate limits in the CLI footer. Likewise, this guide found no command that resets the config file to defaults, and nothing suggests that clearing or editing local configuration refreshes a usage window. Limits are tracked by your account, and OpenAI Support does not reset usage limits; see how to check Codex usage, how the windows work, and the three kinds of reset OpenAI describes.
Sources
- Basic config
- Advanced config
- Configuration Reference
- Environment variables
- CLI command reference
- OpenAI Help Center: Using Codex with your ChatGPT plan
Checked against official sources on Oct 13, 2026. This site is not affiliated with OpenAI; where a statement below comes from a user report or a string in the open-source CLI rather than documentation, it says so.
Frequently asked questions
Where is the Codex config.toml file?
User-level settings live at ~/.codex/config.toml, and a project can add its own .codex/config.toml (https://learn.chatgpt.com/docs/config-file/config-basic). CODEX_HOME moves the whole state directory. On Windows, OpenAI's Help Center (https://help.openai.com/en/articles/11369540-using-codex-with-your-chatgpt-plan) says to open %USERPROFILE%\.codex\config.toml.
Is there a Codex config toml example I can copy?
The advanced config page has examples for profiles, history, notifications, custom model providers and one-off --config overrides, and the examples section above copies several line for line (https://learn.chatgpt.com/docs/config-file/config-advanced). Lines naming a specific model are left out here because model names change.
Does the Codex CLI config.toml control my usage limit?
No documented key does. The Configuration Reference has no rate-limit, usage or reset key. The closest feature is display-only: tui.status_line can show rate limits in the CLI footer. Limits are tracked by your account, so see /usage-check/ and /how-to-reset-usage-limit/.
Which Codex config wins when a project and my user file disagree?
The project file, if the project is trusted and the key is allowed there, and CLI flags or --config overrides beat both. Codex ignores some keys in a project-local file (for example model_provider and notify) and prints a startup warning. /debug-config prints the layers and policy sources.
Can I use profiles in Codex configuration?
Yes, as separate files: --profile profile-name overlays ~/.codex/profile-name.config.toml on top of ~/.codex/config.toml. The older [profiles.profile-name] table and top-level profile selector no longer work in current releases, per the advanced config page.