config-advanced.md +11 −4
17```toml17```toml
18model = "gpt-5-codex"18model = "gpt-5-codex"
19approval_policy = "on-request"19approval_policy = "on-request"
20model_catalog_json = "/Users/me/.codex/model-catalogs/default.json"
20 21
21[profiles.deep-review]22[profiles.deep-review]
22model = "gpt-5-pro"23model = "gpt-5-pro"
23model_reasoning_effort = "high"24model_reasoning_effort = "high"
24approval_policy = "never"25approval_policy = "never"
26model_catalog_json = "/Users/me/.codex/model-catalogs/deep-review.json"
25 27
26[profiles.lightweight]28[profiles.lightweight]
27model = "gpt-4.1"29model = "gpt-4.1"
30 32
31To make a profile the default, add `profile = "deep-review"` at the top level of `config.toml`. Codex loads that profile unless you override it on the command line.33To make a profile the default, add `profile = "deep-review"` at the top level of `config.toml`. Codex loads that profile unless you override it on the command line.
32 34
35Profiles can also override `model_catalog_json`. When both the top level and the selected profile set `model_catalog_json`, Codex prefers the profile value.
36
33## One-off overrides from the CLI37## One-off overrides from the CLI
34 38
35In addition to editing `~/.codex/config.toml`, you can override configuration for a single run from the CLI:39In addition to editing `~/.codex/config.toml`, you can override configuration for a single run from the CLI:
41 45
42```shell46```shell
43# Dedicated flag47# Dedicated flag
4448codex --model gpt-5.2codex --model gpt-5.4
45 49
46# Generic key/value override (value is TOML, not JSON)50# Generic key/value override (value is TOML, not JSON)
4751codex --config model='"gpt-5.2"'codex --config model='"gpt-5.4"'
48codex --config sandbox_workspace_write.network_access=true52codex --config sandbox_workspace_write.network_access=true
49codex --config 'shell_environment_policy.include_only=["PATH","HOME"]'53codex --config 'shell_environment_policy.include_only=["PATH","HOME"]'
50```54```
186 190
187Pick approval strictness (affects when Codex pauses) and sandbox level (affects file/network access).191Pick approval strictness (affects when Codex pauses) and sandbox level (affects file/network access).
188 192
189193For operational details that are easy to miss while editing `config.toml`, see [Common sandbox and approval combinations](https://developers.openai.com/codex/security#common-sandbox-and-approval-combinations), [Protected paths in writable roots](https://developers.openai.com/codex/security#protected-paths-in-writable-roots), and [Network access](https://developers.openai.com/codex/security#network-access).For operational details people often miss while editing `config.toml`, see [Common sandbox and approval combinations](https://developers.openai.com/codex/security#common-sandbox-and-approval-combinations), [Protected paths in writable roots](https://developers.openai.com/codex/security#protected-paths-in-writable-roots), and [Network access](https://developers.openai.com/codex/security#network-access).
194
195You can also use a granular reject policy (`approval_policy = { reject = { ... } }`) to auto-reject only selected prompt categories, such as sandbox approvals, `execpolicy` rule prompts, or MCP input requests (`mcp_elicitations`), while keeping other prompts interactive.
190 196
191```197```
192198approval_policy = "untrusted" # Other options: on-request, neverapproval_policy = "untrusted" # Other options: on-request, never, or { reject = { ... } }
193sandbox_mode = "workspace-write"199sandbox_mode = "workspace-write"
200allow_login_shell = false # Optional hardening: disallow login shells for shell tools
194 201
195[sandbox_workspace_write]202[sandbox_workspace_write]
196exclude_tmpdir_env_var = false # Allow $TMPDIR203exclude_tmpdir_env_var = false # Allow $TMPDIR