config-advanced.md +18 −7
1# Advanced Configuration1# Advanced Configuration
2 2
3More advanced configuration options for Codex local clients
4
5Use these options when you need more control over providers, policies, and integrations. For a quick start, see [Config basics](https://developers.openai.com/codex/config-basic).3Use these options when you need more control over providers, policies, and integrations. For a quick start, see [Config basics](https://developers.openai.com/codex/config-basic).
6 4
5For background on project guidance, reusable capabilities, custom slash commands, multi-agent workflows, and integrations, see [Customization](https://developers.openai.com/codex/concepts/customization). For configuration keys, see [Configuration Reference](https://developers.openai.com/codex/config-reference).
6
7## Profiles7## Profiles
8 8
9Profiles let you save named sets of configuration values and switch between them from the CLI.9Profiles let you save named sets of configuration values and switch between them from the CLI.
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```
184 188
185## Approval policies and sandbox modes189## Approval policies and sandbox modes
186 190
187191Pick approval strictness (affects when Codex pauses) and sandbox level (affects file/network access). See [Sandbox & approvals](https://developers.openai.com/codex/security) for deeper examples.Pick approval strictness (affects when Codex pauses) and sandbox level (affects file/network access).
192
193For operational details that are easy to miss while editing `config.toml`, see [Common sandbox and approval combinations](https://developers.openai.com/codex/agent-approvals-security#common-sandbox-and-approval-combinations), [Protected paths in writable roots](https://developers.openai.com/codex/agent-approvals-security#protected-paths-in-writable-roots), and [Network access](https://developers.openai.com/codex/agent-approvals-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.
188 196
189```197```
190198approval_policy = "untrusted" # Other options: on-request, neverapproval_policy = "untrusted" # Other options: on-request, never, or { reject = { ... } }
191sandbox_mode = "workspace-write"199sandbox_mode = "workspace-write"
200allow_login_shell = false # Optional hardening: disallow login shells for shell tools
192 201
193[sandbox_workspace_write]202[sandbox_workspace_write]
194exclude_tmpdir_env_var = false # Allow $TMPDIR203exclude_tmpdir_env_var = false # Allow $TMPDIR
197network_access = false # Opt in to outbound network206network_access = false # Opt in to outbound network
198```207```
199 208
209Need the complete key list (including profile-scoped overrides and requirements constraints)? See [Configuration Reference](https://developers.openai.com/codex/config-reference) and [Managed configuration](https://developers.openai.com/codex/enterprise/managed-configuration).
210
200In workspace-write mode, some environments keep `.git/` and `.codex/`211In workspace-write mode, some environments keep `.git/` and `.codex/`
201 read-only even when the rest of the workspace is writable. This is why212 read-only even when the rest of the workspace is writable. This is why
202 commands like `git commit` may still require approval to run outside the213 commands like `git commit` may still require approval to run outside the
291| `codex.tool.call` | counter | `tool`, `success` | Tool invocation count by tool name and success/failure. |302| `codex.tool.call` | counter | `tool`, `success` | Tool invocation count by tool name and success/failure. |
292| `codex.tool.call.duration_ms` | histogram | `tool`, `success` | Tool execution duration in milliseconds by tool name and outcome. |303| `codex.tool.call.duration_ms` | histogram | `tool`, `success` | Tool execution duration in milliseconds by tool name and outcome. |
293 304
294305For more security and privacy guidance around telemetry, see [Security](https://developers.openai.com/codex/security#monitoring-and-telemetry).For more security and privacy guidance around telemetry, see [Security](https://developers.openai.com/codex/agent-approvals-security#monitoring-and-telemetry).
295 306
296### Metrics307### Metrics
297 308