Codex config.toml: where it is, and the settings worth changing
Where Codex keeps config.toml, which file wins, and the settings people change most: model, approvals, sandbox, web search, profiles and custom providers.


The short answer
Your Codex settings live in ~/.codex/config.toml (on Windows, in the .codex folder in your user folder). The CLI and the IDE extension read the same file; in the IDE extension, the gear icon › Codex Settings › Open config.toml opens it. A repository can add its own .codex/config.toml, which Codex loads only in projects you trust.
- When the same setting appears in several places, the first one in this order wins:
- 1. Command-line flags and
-c key=valueoverrides - 2. The project's
.codex/config.tomlfiles, closest to the current folder first (trusted projects only) - 3. A profile you chose with
--profile - 4. Your own
~/.codex/config.toml - 5. Defaults your workspace or system administrator set, then Codex's built-in defaults
Not sure which value is in effect? Run /debug-config in Codex to print every layer.
The settings people change most
# ~/.codex/config.toml
model = "gpt-6.1-sol" # the default model
model_reasoning_effort = "medium" # how hard it thinks, where the model supports it
approval_policy = "on-request" # when Codex stops to ask before running a command
sandbox_mode = "workspace-write" # how much of the disk and network it can reach
web_search = "cached" # cached (default), indexed, live or disabled- Use a model your account or workspace has access to; the example follows OpenAI's docs.
web_search = "live"fetches fresh pages, the same as starting Codex with--search.- On a managed computer, your organization can forbid some values, such as
approval_policy = "never"orsandbox_mode = "danger-full-access".
A config for one repository
Put a .codex/config.toml in the repository for settings the whole team should share, such as the model or the sandbox. Codex reads every one from the project root down to the folder you start in, and only in projects you've marked as trusted. Relative paths inside it are resolved from that .codex folder.
Profiles: switch a set of settings at once
A profile is a separate file next to your config, named <name>.config.toml, holding only the values that differ. codex --profile deep-review reads your config.toml first, then lays deep-review.config.toml on top. Write the keys at the top level of that file.
codex --profile deep-review
codex exec --profile deep-review "review this change"Since Codex 0.134.0, [profiles.<name>] tables inside config.toml and the profile = "<name>" line are no longer read. Move them into their own files.
Custom model providers
To send Codex's requests through a proxy, or to another OpenAI-compatible service, define a provider and point model_provider at it. If you only need the built-in OpenAI provider to go through a proxy, setting openai_base_url is enough.
model = "gpt-6.1-sol"
model_provider = "proxy"
[model_providers.proxy]
name = "OpenAI using LLM proxy"
base_url = "http://proxy.example.com"
env_key = "OPENAI_API_KEY"
[model_providers.local_ollama]
name = "Ollama"
base_url = "http://localhost:11434/v1"env_key names the environment variable that holds the key, so the key itself stays out of the file. A provider you route through will see your prompts and code, so pick one you trust.
deepseek-claude-code-codex → Running Codex on DeepSeek, with DeepSeek's own setup script.
Codex in Mirasim
Mirasim runs the Codex CLI itself, on your ChatGPT sign-in, an API key, or Mirasim credit, and you can pick the agent and model for each session instead of editing a file. Mirasim is not an OpenAI product.
Questions
- Where is config.toml on Windows?
- In the
.codexfolder in your user folder,%USERPROFILE%\.codex. The Codex desktop app and the CLI share it. - Can I move the Codex folder?
- Yes: set the
CODEX_HOMEenvironment variable. Codex keeps config.toml and its other local state, such as logs, there. - My project's .codex/config.toml is ignored
- Codex only loads project files in projects you trust. Mark the project as trusted, and check that the keys you set aren't ones a project file is not allowed to set.
- How do I change one setting just this once?
- Pass it on the command line with
-c, for examplecodex -c model_reasoning_effort="high".
Article · How to use Codex: your first task, permissions, and the commands you'll use → How to use Codex: your first task, permissions and common commands.
Article · How to add MCP servers to Claude Code and Codex → Adding MCP servers to Codex, and the same server for Claude Code.
Article · Claude Code settings.json: where it is, which file wins, and the settings worth changing → The same for Claude Code: settings.json, where it is and which file wins.
Sources
Checked on November 25, 2026 against OpenAI's documentation at learn.chatgpt.com/docs: config basics, advanced configuration, the command reference and the Windows app page. Codex changes quickly, so check those pages and the full configuration reference for the latest.
Keep reading

Code review with Claude Code and Codex: /review, GitHub reviews and a second opinion
Code review with Claude Code and Codex: /review for local changes, automatic GitHub PR reviews, where review rules go, and a second opinion from the other agent.

Hooks in Claude Code and Codex: run your own commands when the agent acts
What hooks are in Claude Code and Codex, where they go, when they fire, and examples: a notification, formatting after edits, blocking edits to protected files.

Claude Code and Codex permission modes: auto, plan, --dangerously-skip-permissions and --yolo
What each Claude Code and Codex permission mode allows without asking, what --dangerously-skip-permissions and --yolo turn off, and safer ways to get fewer prompts.