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.
Article · Use DeepSeek in Claude Code and Codex: the official setup, and a per-session switch → Running Codex on DeepSeek, with DeepSeek's own setup script.
Codex in Mira
Mira runs the Codex CLI itself, on your ChatGPT sign-in, an API key, or Mira credit, and you can pick the agent and model for each session instead of editing a file. Mira 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.
Article · Using an API key with Claude Code and Codex: setup, custom endpoints, and switching back → Using an API key or custom endpoint with Claude Code and Codex.
Article · Running Claude Code and Codex with Ollama: local models, 64k context, and setup → Full setup guide for running Claude Code and Codex with Ollama and local models.
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

Fixing OpenAI and Codex 403 “unsupported_country_region_territory”
Why OpenAI and Codex return 403 unsupported_country_region_territory, how to fix false positives on VPNs or cloud IPs, and compliant alternatives.

Running Claude Code and Codex on Amazon Bedrock, Vertex AI, and Microsoft Foundry
Connect Claude Code and Codex to Amazon Bedrock, Vertex AI, and Microsoft Foundry: env vars, config.toml, auth, model pinning, and limits.

Using Claude Code with Chrome and Codex Browser: live debugging, Playwright, and previews
How to connect Claude Code to Chrome (extension, console logs, login limits) and use Codex Browser or Playwright, plus live dev-server previews in Mira.