← Blog

How-to4 min read

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.

Mirasim's agent and model picker open in a session, where you pick Codex and its modelMirasim's agent and model picker open in a session, where you pick Codex and its model

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=value overrides
  • 2. The project's .codex/config.toml files, 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

toml
# ~/.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" or sandbox_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.

bash
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.

toml
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.

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 .codex folder 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_HOME environment 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 example codex -c model_reasoning_effort="high".

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