Codex CLI config.toml Reference
Updated by Alex Sorokoletov
Independent reference, not affiliated with OpenAI. Tables are generated from the Codex CLI source at rust-v0.159.2 (v0.159.2). Official documentation: learn.chatgpt.com.
Codex CLI reads ~/.codex/config.toml (or $CODEX_HOME/config.toml) and merges it with system, project, profile and command-line layers, the higher layer winning key by key. A project's .codex/config.toml loads only once the project is trusted and cannot set model providers, base URLs or notify. Legacy managed_config.toml outranks everything, including -c flags.
Where is Codex config.toml located?#
The user file is config.toml in $CODEX_HOME, which defaults to .codex in your home directory. When CODEX_HOME is set it must point at an existing directory, or Codex refuses to start. The machine-wide file is /etc/codex/config.toml on macOS and Linux and %ProgramData%\OpenAI\Codex\config.toml on Windows. Repositories can add .codex/config.toml; Codex finds every one from the working directory up to the project root, but applies them only after the project is trusted, recorded in config.toml as trust_level = "trusted" under [projects."/path/to/repo"].
What overrides config.toml?#
Every source is a layer with a fixed precedence; a key set in a higher layer replaces the same key from lower ones, and tables merge recursively.
| Layer | Precedence | Read from | Notes |
|---|---|---|---|
| LegacyManagedConfigTomlFromMdm | 50 | managed_config.toml delivered by MDM | Legacy managed configuration delivered by MDM. |
| LegacyManagedConfigTomlFromFile | 40 | /etc/codex/managed_config.toml | Legacy managed configuration loaded from a file. |
| SessionFlags | 30 | -c key=value and flags such as --model or --sandbox for this run | Overrides supplied for the current session. |
| Project | 25 | .codex/config.toml in the working directory and each parent up to the project root; skipped while the project is untrusted | Configuration loaded from a project's `.codex` directory. |
| User (with --profile) | 21 | $CODEX_HOME/<name>.config.toml, selected with --profile <name> | User configuration with a selected profile layered on top. |
| User | 20 | $CODEX_HOME/config.toml ($CODEX_HOME defaults to ~/.codex) | User configuration, optionally augmented by a selected profile. |
| EnterpriseManaged | 15 | enterprise cloud config bundle | Configuration delivered by an enterprise cloud bundle. |
| System | 10 | /etc/codex/config.toml, or %ProgramData%\OpenAI\Codex\config.toml on Windows | Host-wide configuration loaded from a file. |
| Mdm | 0 | macOS managed preferences (MDM profile) | Managed preferences delivered by MDM. |
| PackagedDefaults | -10 | defaults shipped with the installed Codex package | Default configuration supplied with the installed Codex package. |
Two results of that order surprise people. -c flags and --profile files override the user file, but the legacy managed_config.toml layers sit above session flags, so an administrator's file there beats anything typed on the command line. And a trusted project's config beats your user config for most keys, except the ones below, which a repository may not set because they decide where credentials go and which local commands run:
| Ignored in .codex/config.toml |
|---|
openai_base_url |
chatgpt_base_url |
apps_mcp_product_sku |
responses_api_metadata |
model_provider |
model_providers |
notify |
profile |
profiles |
experimental_realtime_webrtc_call_base_url |
experimental_realtime_ws_base_url |
otel |
codex -c hide_agent_reasoning=true -c sandbox_workspace_write.network_access=true
| Input | Behaviour |
|---|---|
-c key=value | dotted path (foo.bar.baz); value parsed as TOML, else used as a literal string |
CODEX_HOME | must exist and be a directory when set; otherwise ~/.codex |
--profile <name> | name limited to letters, digits, _ and - |
--strict-config | errors on keys this version does not recognise |
[model_providers.<built-in id>] | ignored, except amazon-bedrock and amazon-bedrock-runtime, which accept base_url, auth, aws and http_headers overrides |
How do Codex profiles work?#
A profile is a separate file, $CODEX_HOME/<name>.config.toml, selected with --profile <name> (or -p). It layers on top of config.toml, so it only needs the keys that differ, and it stays below project config and command-line flags. The old style, a profile = "<name>" selector plus [profiles.<name>] tables inside config.toml, no longer works in 0.159.2:
| Setting | Behaviour in this release |
|---|---|
wire_api = "chat" | rejected at load: set wire_api = "responses" |
model_provider = "ollama-chat" | rejected: replace with "ollama" |
profile = "<name>" | rejected: use --profile <name> with <name>.config.toml |
[profiles.<name>] while running --profile <name> | refuses to start until the legacy table is removed |
approval_policy = "untrusted" | rejected: remove the setting |
How do I add a custom model provider?#
Define the provider under [model_providers.<id>] and select it with model_provider. Codex speaks only the OpenAI Responses API to providers, so the endpoint must implement /v1/responses; wire_api = "chat" is rejected at load.
model_provider = "my-gateway"
[model_providers.my-gateway]
name = "My gateway"
base_url = "https://llm.example.com/v1"
env_key = "MY_GATEWAY_API_KEY"
wire_api = "responses"
query_params = { api-version = "2026-01-01" }
env_key names the environment variable that holds the API key; http_headers adds fixed headers and env_http_headers fills header values from environment variables. These provider ids are built in and cannot be redefined, except the two Bedrock ids, which accept endpoint, auth, AWS and header overrides:
| Built-in model_provider id |
|---|
openai |
amazon-bedrock |
amazon-bedrock-runtime |
ollama |
lmstudio |
| Key | Type | Default | Notes |
|---|---|---|---|
auth | object | — | Command-backed bearer-token configuration for this provider. |
auth.args | string[] | [] | Command arguments. |
auth.command | string | — | Command to execute. Bare names are resolved via `PATH`; paths are resolved against `cwd`. |
auth.cwd | string | — | Working directory used when running the token command. |
auth.refresh_interval_ms | integer | 300000 | Maximum age for the cached token before rerunning the command. Set to `0` to disable proactive refresh and only rerun after a 401 retry path. |
auth.timeout_ms | integer | 5000 | Maximum time to wait for the token command to exit successfully. |
aws | object | — | AWS SigV4 auth configuration for this provider. |
aws.auth_refresh | object | — | Optional command used to reauthenticate after a refreshable AWS auth failure. |
aws.auth_refresh.args | string[] | [] | Arguments passed to the refresh command. |
aws.auth_refresh.command | string | — | Executable to invoke directly, without a shell. |
aws.auth_refresh.timeout_ms | integer | 300000 | Maximum time to wait for the refresh command to complete. |
aws.credential_export | object | — | Optional command whose exported credentials replace the AWS SDK credential chain. |
aws.credential_export.args | string[] | [] | Arguments passed to the credential export command. |
aws.credential_export.command | string | — | Executable to invoke directly, without a shell. |
aws.credential_export.timeout_ms | integer | 30000 | Maximum time to wait for the credential export command to complete. |
aws.profile | string | — | AWS profile name to use. When unset, the AWS SDK default chain decides. |
aws.region | string | — | AWS region to use for provider-specific endpoints. |
base_url | string | — | Base URL for the provider's OpenAI-compatible API. |
env_http_headers | object | — | Optional HTTP headers to include in requests to this provider where the (key, value) pairs are the header name and _environment variable_ whose value should be used. If the environment variable is not set, or the value is empty, the header will not be included in the request. |
env_key | string | — | Environment variable that stores the user's API key for this provider. |
env_key_instructions | string | — | Optional instructions to help the user get a valid value for the variable and set it. |
experimental_bearer_token | string | — | Value to use with `Authorization: Bearer <token>` header. Use of this config is discouraged in favor of `env_key` for security reasons, but this may be necessary when using this programmatically. |
gateway_oauth | object | — | Secondary OAuth credentials required by the provider's gateway. |
gateway_oauth.authorization_url | string | — | — |
gateway_oauth.client_id | string | — | — |
gateway_oauth.delivery | object | object | — | — |
gateway_oauth.redirect_port | integer | — | — |
gateway_oauth.resource | string | — | — |
gateway_oauth.scopes | string[] | [] | — |
gateway_oauth.token_url | string | — | — |
http_headers | object | — | Additional HTTP headers to include in requests to this provider where the (key, value) pairs are the header name and value. |
model_catalog_url | string | — | Optional full URL for a Codex-native model catalog. When unset, OpenAI discovery uses the Codex backend unless `base_url` overrides the inference endpoint. |
name | string | "" | Friendly display name. |
query_params | object | — | Optional query parameters to append to the base URL. |
request_max_retries | integer | — | Maximum number of times to retry a failed HTTP request to this provider. |
requires_openai_auth | boolean | false | Does this provider require an OpenAI API Key or ChatGPT login token? If true, user is presented with login screen on first run, and login preference and token/key are stored in auth.json. If false (which is the default), login screen is skipped, and API key (if needed) comes from the "env_key" environment variable. |
stream_idle_timeout_ms | integer | — | Idle timeout (in milliseconds) to wait for activity on a streaming response before treating the connection as lost. |
stream_max_retries | integer | — | Number of times to retry reconnecting a dropped streaming response before failing. |
supports_standalone_web_search | boolean | false | Whether this provider supports the standalone web-search endpoint. |
supports_websockets | boolean | false | Whether this provider supports the Responses API WebSocket transport. |
websocket_connect_timeout_ms | integer | — | Maximum time (in milliseconds) to wait for a websocket connection attempt before treating it as failed. |
wire_api | responses | "responses" | Which wire protocol this provider expects. |
How do I configure MCP servers in config.toml?#
Each server is a [mcp_servers.<name>] table. The keys pick the transport: command starts a local process over stdio, url connects over streamable HTTP.
[mcp_servers.docs]
command = "npx"
args = ["-y", "@example/docs-mcp"]
startup_timeout_sec = 20
tool_timeout_sec = 60
[mcp_servers.tracker]
url = "https://mcp.example.com/mcp"
bearer_token_env_var = "TRACKER_TOKEN"
enabled_tools = ["search", "get_issue"]
| Transport | Keys that select it | MCP spec section |
|---|---|---|
| stdio | command, args, env, env_vars, cwd | stdio |
| streamable http | url, bearer_token_env_var, http_headers, env_http_headers, http_headers_helper | streamable-http |
| Key | Type | Default | Notes |
|---|---|---|---|
args | string[] | — | — |
auth | oauth | chatgpt | ema_auth | — | Authentication flow for an HTTP MCP server. Explicit credentials take precedence for OAuth and ChatGPT; EMA rejects alternate credentials and fallback. |
bearer_token_env_var | string | — | — |
command | string | — | — |
cwd | string | — | — |
default_tools_approval_mode | auto | prompt | writes | approve | — | — |
disabled_tools | string[] | — | — |
enabled | boolean | — | — |
enabled_tools | string[] | — | — |
env | object | — | — |
env_http_headers | object | — | — |
env_vars | string | object[] | — | — |
environment_id | string | — | — |
http_headers | object | — | — |
http_headers_helper | string | — | — |
name | string | — | Legacy display-name field accepted for backward compatibility. |
oauth | object | — | Client settings for MCP OAuth login or enterprise token exchange. |
oauth.authorization_server_issuer | string | — | Expected resource authorization server issuer for EMA token exchange. |
oauth.callback_port | integer | — | Fixed callback port that takes precedence over Codex's global OAuth callback port. |
oauth.callback_url | string | — | Registered callback URL associated with this OAuth client. |
oauth.client_id | string | — | Explicit OAuth client identifier to present during authorization and token exchange. |
oauth.client_secret | string | — | OAuth client secret used for token exchange with a pre-registered client. |
oauth_resource | string | — | — |
omit_tools_from | code_mode | deferred | direct[] | — | — |
required | boolean | — | — |
scopes | string[] | — | — |
startup_readiness | connection | catalog | — | Whether startup requires a live connection or can use a valid cached tool catalog. |
startup_timeout_ms | integer | — | — |
startup_timeout_sec | number | — | — |
supports_parallel_tool_calls | boolean | — | — |
tool_input_schema_max_bytes | integer | — | UTF-8 byte threshold for compacting each ordinary MCP tool input schema. Defaults to 5,000 bytes. Code Mode also uses an explicitly configured limit when rendering each tool's input type. Larger limits preserve more parameter descriptions. |
tool_timeout_sec | number | — | — |
tools | object | — | — |
url | string | — | — |
MCP servers that ship inside a plugin are configured under the plugin's entry instead; see the plugins reference.
Which feature flags does Codex have?#
Feature flags are booleans under [features], for example hooks = false or network_proxy = true. The Default column is what applies when the key is absent. Under-development features are incomplete and trigger a warning when enabled, which suppress_unstable_features_warning = true silences. Removed flags still parse, as no-ops, so old configs keep loading. A trusted project's [features] table cannot set respect_system_proxy.
| Stage | Features |
|---|---|
| under development | 58 |
| stable | 47 |
| removed | 40 |
| deprecated | 4 |
| experimental | 3 |
| Key | Stage | Default | What it does | Legacy alias |
|---|---|---|---|---|
analytics_plan_history | experimental | off | Preview consumer five-hour and weekly allowance history. | — |
daemon_auto_start | stable | on | Automatically start the shared local daemon for eligible interactive launches. | — |
transcript_v2 | deprecated | off | Deprecated no-op; use `tui.fullscreen_transcript` instead. | — |
undo | removed | off | Removed compatibility flag retained as a no-op so old configs can still parse `undo`. | — |
shell_tool | stable | on | Enable the default shell tool. | — |
view_image | stable | on | Enable the built-in local image viewer. | — |
sleep_tool | stable | on | Allow registration of the built-in sleep tool. | — |
secret_auth_storage | stable | on (Windows only) | Store CLI auth in the encrypted local secrets backend when keyring storage is selected. | — |
unified_exec | stable | on | Use the single unified PTY-backed exec tool. | experimental_use_unified_exec_tool |
unified_exec_tty | stable | on | Allow unified exec commands to allocate an interactive terminal. | — |
shell_zsh_fork | under development | off | Route shell tool execution through the zsh exec bridge. | — |
unified_exec_zsh_fork | removed | on | Allow unified exec to compose with the zsh exec bridge. | — |
shell_snapshot | stable | on | Experimental shell snapshotting. | — |
powershell_shell_version | under development | off | Expose the selected PowerShell execution host's bounded major/minor version. | — |
shell_snapshot_v2 | under development | off | Keep policy-filtered shell snapshots entirely in executor memory. | — |
deferred_executor | under development | off | Allow turns to start while selected executors are still starting. | — |
cwd_relative_turn_diffs | under development | off | Use the current working directory for turn diff display paths. | — |
js_repl | removed | off | Removed compatibility flag for the deleted JavaScript REPL feature. | — |
content_item_kinds | stable | on | Send per-content-entry classifications in internal Responses metadata. | — |
executed_tool_call_metadata | under development | off | Record model-attempted tool calls in internal Responses metadata. | — |
code_mode | under development | off | Enable JavaScript code mode backed by the standalone host process. | — |
code_mode_buffered_exec | removed | off | Removed compatibility flag for the configurable code-mode exec yield timeout. | — |
code_mode_host | stable | on | Run JavaScript code mode in the standalone host process. | — |
code_mode_prewarm | under development | off | Establish the code-mode host connection during session startup. | — |
code_mode_interrupt | under development | off | Terminate active code mode cells when their turn is interrupted. | — |
instant_interrupt | under development | off | Preempt responses and yield foreground code-mode observations on new user input. | — |
code_mode_only | under development | off | Restrict model-visible tools to code mode entrypoints (`exec`, `wait`). | — |
js_repl_tools_only | removed | off | Removed compatibility flag for the deleted JavaScript REPL tool-only mode. | — |
terminal_resize_reflow | removed | on | Removed compatibility flag. Transcript scrollback reflow on terminal resize is always on. | — |
web_search_request | deprecated | off | Allow the model to request web searches that fetch live content. | web_search |
web_search_cached | deprecated | off | Allow the model to request web searches that fetch cached content. Takes precedence over `WebSearchRequest`. | — |
standalone_web_search | under development | off | Expose the extension-backed standalone web search tool. | — |
search_tool | removed | off | Legacy search-tool feature flag kept for backward compatibility. | — |
codex_git_commit | removed | off | Removed legacy git commit attribution guidance flag. | — |
runtime_metrics | under development | off | Enable runtime metrics snapshots via a manual reader. | — |
sqlite | removed | on | Persist rollout metadata to a local SQLite database. | — |
memories | stable | off | Enable startup memory extraction and file-backed memory consolidation. | memory_tool |
external_agent_memory_import | under development | off | Enable importing project-scoped memory from external agents. | — |
local_thread_store_compression | under development | off | Compress cold local thread-store rollout files, including shared histories. Requires every reader of the Codex home to support compressed shared histories. | — |
local_thread_store_shared_compression | removed | off | Removed compatibility flag; local_thread_store_compression controls all rollout files. | — |
background_paginated_rollout_migration | under development | off | Migrate legacy local rollout files to paginated history in the background. | — |
chronicle | under development | off | Enable the Chronicle sidecar for passive screen-context memories. | telepathy |
apply_patch_freeform | removed | off | Removed compatibility flag for the deleted apply_patch fallback feature. | — |
apply_patch_streaming_events | under development | off | Stream structured progress while apply_patch input is being generated. | — |
apply_patch_preserve_line_endings | under development | off | Preserve existing line endings when apply_patch updates files. | — |
exec_permission_approvals | under development | off | Allow exec tools to request additional permissions while staying sandboxed. | request_permissions |
write_stdin_approval | stable | on | Require approval before writing input to escalated unified-exec terminals. | — |
hooks | stable | on | Enable Claude-style lifecycle hooks loaded from hooks.json files. | codex_hooks |
request_permissions_tool | under development | off | Expose the built-in request_permissions tool. | — |
use_linux_sandbox_bwrap | removed | off | Removed legacy Linux bubblewrap opt-in flag retained as a no-op so old wrappers and config can still parse it. | — |
use_legacy_landlock | deprecated | off | Use the legacy Landlock Linux sandbox fallback instead of the default bubblewrap pipeline. | — |
request_rule | removed | off | Allow the model to request approval and propose exec rules. | — |
experimental_windows_sandbox | removed | off | Enable Windows sandbox (restricted token) on Windows. | enable_experimental_windows_sandbox |
elevated_windows_sandbox | removed | off | Use the elevated Windows sandbox pipeline (setup + runner). | — |
windows_sandbox_service | under development | off | Attempt elevated Windows sandbox provisioning through the installed service. | — |
prefer_mxc | under development | off | Prefer the local native Windows sandbox when available, retaining legacy fallback. | — |
remote_models | removed | off | Legacy remote models flag kept for backward compatibility. | — |
api_key_model_discovery | under development | off | Discover model catalogs for OpenAI API-key authentication. | — |
enable_request_compression | stable | on | Compress request bodies (zstd) when sending streaming requests to codex-backend. | — |
unbounded_connection_retries | stable | on | Keep active sampling turns alive until a failed network connection recovers. | — |
network_proxy | experimental | off | Start the managed network proxy for sandboxed sessions. | — |
worktrees | stable | on | Enable managed worktree creation and repository-aware sessions. | — |
respect_system_proxy | under development | off | Respect host system proxy settings for Codex-owned network clients. | — |
system_proxy_fallback | stable | on | Retry eligible bootstrap requests through the system proxy after normal routing fails. | — |
multi_agent | stable | on | Enable collab tools. | collab |
multi_agent_v2 | stable | off | Enable task-path-based multi-agent routing. | — |
defer_mailbox_preemption | under development | off | Keep sampling through reasoning and commentary boundaries when agent mail arrives. Pending mail is delivered at the next normal input boundary instead. | — |
agent_message_board | under development | off | Enable shared discussion tools for an agent tree. | — |
multi_agent_mode | removed | off | Removed compatibility flag retained as a no-op. | — |
enable_fanout | removed | off | Removed compatibility flag for the deleted agent-job tools. | — |
apps | stable | on | Enable apps. | connectors |
psp | under development | off | Route first-party ChatGPT requests through PSP. | — |
enable_mcp_apps | under development | off | Enable MCP apps. | — |
mcp_2026_07_28 | under development | off | Enable MCP protocol version 2026-07-28 support. | — |
codex_apps_mcp_2026_07_28 | under development | off | Enable MCP protocol version 2026-07-28 for the host-owned Codex Apps server. | — |
mcp_oauth_refresh_coordination | under development | off | Let RMCP coordinate OAuth refresh through the configured credential store. | — |
use_xaa | under development | off | Enable enterprise refresh-token authorization for configured MCP resources. | — |
apps_mcp_path_override | removed | off | Removed compatibility flag for the legacy Apps MCP path override. | — |
tool_search | removed | off | Removed compatibility flag retained as a no-op now that tool_search is always enabled. | — |
tool_search_always_defer_mcp_tools | removed | on | Removed compatibility flag. MCP tools are always deferred when tool_search is available. | — |
deferred_tool_world_state | under development | off | Describe deferred tool namespaces in the model-visible world state. | — |
non_prefixed_mcp_tool_names | under development | off | Expose MCP model-visible namespaces without the legacy `mcp__` prefix. | — |
unavailable_dummy_tools | removed | off | Removed compatibility flag for the deleted unavailable-tool placeholder backfill. | — |
tool_suggest | stable | on | Enable discoverable tool suggestions for apps. | — |
recommended_plugins | stable | off | Include recommended plugins in model-visible context. | — |
plugins | stable | on | Enable plugins. | — |
executor_capability_discovery | under development | off | Discover selected-root plugin and skill manifests through one high-level exec-server RPC. | — |
skip_host_skill_discovery | under development | off | Skip host skill snapshots when no registered contributor requires them. | — |
plugin_hooks | removed | off | Removed compatibility flag for plugin-bundled lifecycle hooks. | — |
in_app_browser | stable | on | Allow the in-app browser pane in desktop apps. | — |
in_app_chat | stable | on | Allow the in-app chat pane in desktop apps. | — |
in_app_dictation | stable | on | Allow in-app dictation in desktop apps. | — |
in_app_local_automation | stable | on | Allow desktop apps to run local automations. | — |
in_app_updates | stable | on | Allow desktop apps to perform in-app updates. | — |
browser_use | stable | on | Allow Browser Use agent integration in desktop apps. | — |
browser_use_full_cdp_access | stable | on | Allow Browser Use integration to access the full Chrome DevTools Protocol surface. | — |
browser_use_external | stable | on | Allow Browser Use integration with external browsers. | — |
computer_use | stable | on | Allow Codex Computer Use. | — |
remote_plugin | stable | on | Enable the PS-backed remote plugin catalog. | — |
plugin_sharing | stable | on | Enable remote plugin sharing flows. | — |
external_migration | removed | off | Removed compatibility flag retained as a no-op. | — |
image_generation | stable | on | Enable extension-backed image generation. | imagegenext |
omit_app_server_notification_media | under development | off | Omit inline image and audio content from app-server item notifications. | — |
image_resize_notice | under development | off | Tell the model when a prompt image was resized and include its dimensions. | — |
unified_image_budget | under development | off | Apply one shared pixel and token budget to every image, regardless of legacy detail hints. | — |
resize_all_images | removed | on | Removed compatibility flag for always-on centralized image preparation. | — |
item_ids | removed | on | Removed compatibility flag for always-on response item IDs. | — |
concurrent_reasoning_summaries | under development | off | Request sequential cutoff reasoning summary delivery. | — |
skill_mcp_dependency_install | stable | on | Allow prompting and installing missing MCP dependencies. | — |
skill_search | stable | on | Run cheap skill-search methods in shadow mode and emit experiment metrics. | — |
skill_env_var_dependency_prompt | removed | off | Removed compatibility flag for deleted skill env var dependency prompting. | — |
mentions_v2 | stable | on | Enable the unified mention popup used by default in the TUI. | — |
steer | removed | on | Steer feature flag - when enabled, Enter submits immediately instead of queuing. Kept for config backward compatibility; behavior is always steer-enabled. | — |
default_mode_request_user_input | under development | off | Allow request_user_input in Default collaboration mode. | — |
send_async_message | removed | off | Removed compatibility flag for model-enabled async user messaging. | — |
send_message_to_user_async | under development | off | Allow root agents to send async user messages without model catalog support. | — |
terminal_visualization_instructions | under development | off | Add terminal-specific visualization guidance to TUI developer instructions. | — |
guardian_approval | stable | on | Enable automatic review for approval prompts. | — |
guardianv2.thread_context | removed | off | Removed compatibility flag for always-on thread-owned Guardian context. | — |
guardian_reuse_parent_compaction | stable | on | Reuse encrypted parent compaction when restarting Guardian review sessions. When disabled, retain an independent review transcript across parent compaction. | — |
guardian_enhanced_node_repl_transcripts | under development | off | Include completed node_repl or cua_repl Code Mode responses in Guardian reviews. | — |
guardian_node_repl_transcript_images | under development | off | Include completed node_repl or cua_repl Code Mode response images in Guardian reviews. | — |
guardianv2 | under development | off | Enable Guardian V2 automatic approval reviews. | — |
guardian_ext | removed | off | Removed compatibility flag for the unused Guardian extension prototype. | — |
goals | stable | on | Enable persisted thread goals and automatic goal continuation. | — |
token_budget | under development | off | Add current context-window metadata to model-visible context. | — |
context_management | under development | off | Enables experimental context management. | — |
rollout_budget | under development | off | Track and report a shared token budget across a session's agent threads. | — |
reasoning_effort_override | under development | off | Append trusted response configuration items when the selected reasoning effort changes. | — |
current_time_reminder | under development | off | Add current-time reminders to model-visible context. | — |
nonfatal_clock_read_errors | under development | off | Report failed clock reads to the model without failing the turn. | — |
collaboration_modes | removed | on | Enable collaboration modes (Plan, Default). Kept for config backward compatibility; behavior is always collaboration-modes-enabled. | — |
tool_call_mcp_elicitation | stable | on | Route MCP tool approval prompts through the MCP elicitation request path. | — |
auth_elicitation | stable | on | Prompt Codex Apps connector auth failures through MCP URL elicitations. | — |
bedrock_setup_wizard | under development | off | Offer Amazon Bedrock setup during TUI sign-in onboarding. | — |
personality | removed | off | Removed compatibility flag retained as a no-op. | — |
artifact | under development | off | Enable native artifact tools. | — |
fast_mode | stable | on | Enable Fast mode selection in the TUI and request layer. | — |
step_model_switching | under development | off | Enable explicitly requested model changes for later step captures. | — |
realtime_conversation | stable | on | Enable voice conversations in the TUI. | — |
remote_control | removed | off | Removed compatibility flag for the deleted remote control feature. | — |
image_detail_original | removed | off | Removed compatibility flag retained as a no-op so old wrappers can still pass `--enable image_detail_original`. | — |
tui_app_server | removed | on | Removed compatibility flag. The TUI now always uses the app-server implementation. | — |
prevent_idle_sleep | experimental on macOS, Linux, Windows; under development elsewhere | off | Prevent idle system sleep while a turn is actively running. | — |
workspace_owner_usage_nudge | removed | off | Removed compatibility flag retained as a no-op now that workspace owner usage nudges are always enabled. | — |
responses_websockets | removed | off | Legacy rollout flag for Responses API WebSocket transport experiments. | — |
responses_websockets_v2 | removed | off | Legacy rollout flag for Responses API WebSocket transport v2 experiments. | — |
remote_compaction_v2 | removed | off | Removed compatibility key, still advertised to the Responses API. | — |
compaction_image_budget | stable | on | Include retained images in the remote compaction context budget. | — |
retain_client_developer_messages | under development | off | Retain client-authored developer messages across compacted context windows. | — |
use_agent_identity | under development | off | Use Agent Identity for ChatGPT-authenticated sessions. | — |
workspace_dependencies | stable | on | Enable workspace dependency support. | — |
config.toml key reference#
Every top-level key in the JSON Schema Codex generates from its config types. Table-valued keys such as permissions, sandbox_workspace_write and hooks have their own references: permissions and hooks.
| Key | Type | Default | Notes |
|---|---|---|---|
agents | table | — | Agent-related settings (thread limits, etc.). |
allow_login_shell | boolean | — | Whether the model may request a login shell for shell-based tools. Default to `true` |
allow_symlinked_codex_home | boolean | — | Allow macOS sandbox writable roots at or beneath CODEX_HOME to traverse symlinks. Read only from the host's user config at startup; defaults to false. This grants no write access by itself, but trusts symlink targets even if they change between commands or lie outside CODEX_HOME. This setting has no effect on Linux or Windows. |
analytics | table | — | When `false`, disables analytics across Codex product surfaces in this machine. Defaults to `true`. |
approval_policy | on-request | object | never | — | Default approval policy for executing commands. |
approvals_reviewer | user | auto_review | guardian_subagent | — | Configures who approval requests are routed to for review once they have been escalated. This does not disable separate safety checks such as ARC. |
apps | table | — | Settings for app-specific controls. |
apps_mcp_product_sku | string | — | Optional product SKU forwarded on host-owned Codex Apps MCP requests. |
audio | table | — | Machine-local realtime audio device preferences used by realtime voice. |
auto_review | table | — | Optional policy instructions for the guardian auto-reviewer. |
background_terminal_max_timeout | integer | — | Maximum poll window for background terminal output (`write_stdin`), in milliseconds. Default: `300000` (5 minutes). |
browser_use | table | — | — |
chatgpt_base_url | string | — | Base URL for requests to ChatGPT (as opposed to the OpenAI API). |
check_for_update_on_startup | boolean | — | When `true`, checks for Codex updates on startup and surfaces update prompts. Set to `false` only if your Codex updates are centrally managed. Defaults to `true`. |
cli_auth_credentials_store | file | keyring | auto | ephemeral | — | Preferred backend for storing CLI auth credentials. file (default): Use a file in the Codex home directory. keyring: Use an OS-specific keyring service. auto: Use the keyring if available, otherwise use a file. |
cloud | table | — | Cloud-owned feature settings. |
compact_prompt | string | — | Compact prompt used for history compaction. |
computer_use | table | — | — |
default_permissions | string | — | Default permissions profile to apply. Names starting with `:` refer to built-in profiles; other names are resolved from the `[permissions]` table. |
desktop | table | — | Opaque desktop settings stored alongside the rest of config.toml. |
developer_instructions | string | — | Developer instructions inserted as a `developer` role message. |
disable_paste_burst | boolean | — | Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`. |
experimental_compact_prompt_file | string | — | A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem). |
experimental_realtime_start_instructions | string | — | Experimental / do not use. Replaces the built-in realtime start instructions inserted into developer messages when realtime becomes active. |
experimental_realtime_webrtc_call_base_url | string | — | Experimental / do not use. Overrides only the WebRTC realtime call creation base URL. This is separate from `experimental_realtime_ws_base_url` because WebRTC call creation is HTTP, while sideband control is websocket. |
experimental_realtime_ws_backend_prompt | string | — | Experimental / do not use. Overrides only the realtime conversation websocket transport instructions (the `Op::RealtimeConversation` `/ws` session.update instructions) without changing normal prompts. |
experimental_realtime_ws_base_url | string | — | Experimental / do not use. Overrides only the realtime conversation websocket transport base URL (the `Op::RealtimeConversation` `/v1/realtime` connection) without changing normal provider HTTP requests. |
experimental_realtime_ws_model | string | — | Experimental / do not use. Selects the realtime websocket model/snapshot used for the `Op::RealtimeConversation` connection. |
experimental_realtime_ws_startup_context | string | — | Experimental / do not use. Replaces the synthesized realtime startup context appended to websocket session instructions. An empty string disables startup context injection entirely. |
experimental_thread_store | object | — | Experimental / do not use. Selects the thread store implementation. |
experimental_use_unified_exec_tool | boolean | — | — |
features | table | — | Centralized feature flags (new). Prefer this over individual toggles. |
feedback | table | — | When `false`, disables feedback collection across Codex product surfaces. Defaults to `true`. |
file_opener | vscode | vscode-insiders | windsurf | cursor | none | — | Optional URI-based file opener. If set, citations to files in the model output will be hyperlinked using the specified URI scheme. |
forced_chatgpt_workspace_id | string | string[] | — | When set, restricts ChatGPT login to one or more workspace identifiers. |
forced_login_method | chatgpt | api | — | When set, restricts the login mechanism users may use. |
ghost_snapshot | table | — | Compatibility-only settings retained so legacy `ghost_snapshot` config still loads. |
goals | table | — | Goal-related settings. |
hide_agent_reasoning | boolean | false | When set to `true`, `AgentReasoning` events will be hidden from the UI/output. Defaults to `false`. |
history | table | {"max_bytes": null, "persistence": "save-all"} | Settings that govern if and what will be written to `~/.codex/history.jsonl`. |
hooks | table | — | Lifecycle hooks configured inline in TOML plus user-level overrides. |
include_apps_instructions | boolean | — | Whether to inject the `<apps_instructions>` developer block. |
include_collaboration_mode_instructions | boolean | — | Whether to inject the `<collaboration_mode>` developer block. |
include_environment_context | boolean | — | Whether to inject the `<environment_context>` user block. |
include_permissions_instructions | boolean | — | Whether to inject the `<permissions instructions>` developer block. |
instructions | string | — | System instructions. |
log_dir | string | — | Directory where Codex writes log files. Setting this value explicitly also enables the TUI text log in this directory. Defaults to `$CODEX_HOME/log`. |
marketplaces | table | — | User-level marketplace entries keyed by marketplace name. |
mcp_enterprise_managed_auth | table | — | Trusted enterprise IdP shared by EMA-enabled MCP servers and plugins. |
mcp_oauth_callback_port | integer | — | Optional fixed port for the local HTTP callback server used during MCP OAuth login. When unset, Codex will bind to an ephemeral port chosen by the OS. |
mcp_oauth_callback_url | string | — | Optional redirect URI to use during MCP OAuth login. When set, this URI is used in the OAuth authorization request instead of the local listener address. The local callback listener still binds to 127.0.0.1 (using `mcp_oauth_callback_port` when provided). |
mcp_oauth_credentials_store | auto | file | keyring | — | Preferred backend for storing MCP OAuth credentials. keyring: Use an OS-specific keyring service. https://github.com/openai/codex/blob/main/codex-rs/rmcp-client/src/oauth.rs#L2 file: Use a file in the Codex home directory. auto (default): Use the OS-specific keyring service if available, otherwise use a file. |
mcp_optional_startup_grace_ms | integer | — | Milliseconds to wait for optional MCP servers while building the initial tool catalog. |
mcp_servers | table | — | Definition for MCP servers that Codex can reach out to for tool calls. |
memories | table | — | Memories subsystem settings. |
model | string | — | Optional override of model selection. |
model_auto_compact_token_limit | integer | — | Token usage threshold triggering auto-compaction of conversation history. |
model_auto_compact_token_limit_scope | total | body_after_prefix | — | Controls whether the auto-compaction limit applies to the full context or only to tokens after the carried prefix in the current compaction window. |
model_catalog_json | string | — | Optional path to a JSON model catalog (applied on startup only). Per-thread `config` overrides are accepted but do not reapply this (no-ops). |
model_context_window | integer | — | Size of the context window for the model, in tokens. |
model_instructions_file | string | — | Optional path to a file containing model instructions that will override the built-in instructions for the selected model. Users are STRONGLY DISCOURAGED from using this field, as deviating from the instructions sanctioned by Codex will likely degrade model performance. |
model_post_turn_compact_threshold_percent | integer | — | Percentage of the usable context window that triggers compaction after a final response. Existing auto-compaction limits still apply. Omitted or zero disables turn-end compaction; valid values are 0–100. |
model_provider | string | — | Provider to use from the model_providers map. |
model_providers | table | — | User-defined provider entries that extend the built-in list. Built-in IDs cannot be overridden. |
model_reasoning_effort | string | — | A non-empty reasoning effort value advertised by the model. |
model_reasoning_summary | auto | concise | detailed | none | — | A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process. See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries |
model_verbosity | low | medium | high | — | Optional verbosity control for GPT-5 models (Responses API `text.verbosity`). |
notice | table | — | Collection of in-product notices (different from notifications) See [`crate::types::Notice`] for more details |
notify | string[] | — | Optional external command to spawn for end-user notifications. |
openai_base_url | string | — | Base URL override for the built-in `openai` model provider. |
orchestrator | table | — | Orchestrator-owned feature settings. |
oss_provider | string | — | Preferred OSS provider for local models, e.g. "lmstudio" or "ollama". |
otel | table | — | OTEL configuration. |
permissions | table | — | Named permissions profiles. |
personality | none | friendly | pragmatic | — | Deprecated: `friendly` and `pragmatic` no longer select a style. |
plan_mode_reasoning_effort | string | — | A non-empty reasoning effort value advertised by the model. |
plugins | table | — | User-level plugin config entries keyed by plugin name. |
profile | string | — | Profile to use from the `profiles` map. |
profiles | table | — | Named profiles to facilitate switching between different configurations. |
project_doc_fallback_filenames | string[] | — | Ordered list of fallback filenames to look for when AGENTS.md is missing. |
project_doc_max_bytes | integer | 32768 | Maximum total bytes of project instruction content across all selected environments. |
project_root_markers | string[] | — | Markers used to detect the project root when searching parent directories for `.codex` folders. Defaults to [".git"] when unset. |
projects | table | — | — |
realtime | table | — | Experimental / do not use. Realtime websocket session selection. `version` controls v1/v2 and `type` controls conversational/transcription. |
responses_api_metadata | table | — | Bounded, product-owned metadata attached to every Responses API request. |
review_model | string | — | Review model override used by the `/review` feature. |
sandbox_mode | read-only | workspace-write | danger-full-access | — | Sandbox mode to use. |
sandbox_workspace_write | table | — | Sandbox configuration to apply if `sandbox` is `WorkspaceWrite`. |
service_tier | string | — | Optional explicit service tier request id for new turns (for example `default`, `priority`, or `flex`; legacy `fast` also works). |
shell_environment_policy | table | {"exclude": null, "experimental_use_profile": null, "filters": null, "ignore_default_excludes": null, "include_only": null, "inherit": null, "set": null} | Policy for building the `env` when spawning a process via shell-like tools. |
show_raw_agent_reasoning | boolean | — | When set to `true`, `AgentReasoningRawContentEvent` events will be shown in the UI/output. Defaults to `false`. |
skills | table | — | User-level skill config entries keyed by SKILL.md path. |
sqlite_home | string | — | Directory where Codex stores the SQLite state DB. Defaults to `$CODEX_SQLITE_HOME` when set. Otherwise uses `$CODEX_HOME`. |
suppress_unstable_features_warning | boolean | — | Suppress warnings about unstable (under development) features. |
thread_unload_delay_secs | integer | — | Seconds a thread must have no subscribers and no activity before app-server unloads it. Defaults to 60; zero unloads immediately. Changes require a server restart. |
tool_output_token_limit | integer | — | Token budget applied when storing tool/function outputs in the context manager. |
tool_suggest | table | — | Additional discoverable tools that can be suggested for installation. |
tools | table | — | Nested tools section for feature toggles |
tui | table | — | Collection of settings that are specific to the TUI. |
web_search | disabled | cached | indexed | live | — | Controls the web search tool mode: disabled, cached, indexed, or live. |
windows | table | — | Windows-specific configuration. |
Frequently asked questions#
Where is Codex config.toml located?#
In .codex under your home directory: ~/.codex/config.toml on macOS and Linux, and the .codex folder in your user profile on Windows. Setting CODEX_HOME moves it to $CODEX_HOME/config.toml, and that directory must already exist. Machine-wide settings go in /etc/codex/config.toml or %ProgramData%\OpenAI\Codex\config.toml, and repositories can add .codex/config.toml.
What overrides config.toml?#
From highest to lowest: legacy managed_config.toml (MDM, then file), command-line flags and -c key=value, a trusted project's .codex/config.toml, the --profile file, ~/.codex/config.toml, enterprise cloud config, /etc/codex/config.toml, macOS managed preferences, and packaged defaults. Separately, requirements.toml can restrict which values are allowed at all.
How do I add a custom model provider such as OpenRouter, Azure or a local model?#
Add a [model_providers.<id>] table with base_url, env_key and wire_api = "responses", then set model_provider = "<id>". The endpoint must implement the Responses API, because chat completions support was removed. Ollama and LM Studio are built in as ollama and lmstudio; use them with --oss and --local-provider instead of defining your own.
What does wire_api do in Codex?#
wire_api names the protocol Codex uses to talk to a model provider. In 0.159.2 the only accepted value is responses, the OpenAI Responses API, and it is also the default. The old wire_api = "chat" value now fails config loading with an instruction to switch to responses, and the ollama-chat provider id was removed the same way.
How do I configure MCP servers in Codex config.toml?#
Add one [mcp_servers.<name>] table per server. Use command and args (plus optional env and cwd) for a local stdio server, or url with bearer_token_env_var or http_headers for a streamable HTTP server. enabled_tools, disabled_tools, startup_timeout_sec and tool_timeout_sec tune each server, and enabled = false switches one off.
Why does Codex ignore my project .codex/config.toml?#
Project config applies only to trusted projects; until you accept the trust prompt, or set trust_level = "trusted" for the path under [projects], the layer loads but stays disabled. Even when trusted, a project file cannot set keys that redirect credentials or run local commands, such as model_provider, model_providers, openai_base_url, notify and otel; Codex drops them from the project layer and keeps your user values.
Why does Codex say legacy profile config is no longer supported?#
Profiles moved out of config.toml. Codex 0.159.2 rejects profile = "<name>" and refuses --profile <name> while a [profiles.<name>] table exists. Move those settings into ~/.codex/<name>.config.toml, delete the old selector and table, and start Codex with --profile <name>. The profile file only needs the keys that differ, because it layers on top of config.toml.
Sources
- Codex CLI official documentation
- Codex CLI release notes
codex-rs/core/config.schema.json: config.toml JSON Schema generated from ConfigToml (at rust-v0.159.2)codex-rs/config/src/config_layer_source.rs: config layers and their precedence (at rust-v0.159.2)codex-rs/config/src/loader/mod.rs(at rust-v0.159.2)codex-rs/utils/cli/src/config_override.rs(at rust-v0.159.2)codex-rs/utils/cli/src/shared_options.rs(at rust-v0.159.2)codex-rs/utils/home-dir/src/lib.rs(at rust-v0.159.2)codex-rs/model-provider-info/src/lib.rs: built-in model providers and removed wire APIs (at rust-v0.159.2)codex-rs/core/src/config/mod.rs(at rust-v0.159.2)codex-rs/config/src/mcp_types.rs: MCP transport variants (at rust-v0.159.2)codex-rs/features/src/lib.rs: feature flags (key, stage, default) (at rust-v0.159.2)codex-rs/features/src/legacy.rs: legacy feature keys (at rust-v0.159.2)codex-rs/protocol/src/config_types.rs(at rust-v0.159.2)codex-rs/tui/src/cli.rs(at rust-v0.159.2)
Release-by-release changes: Codex CLI version tracker. All Codex CLI pages: Codex CLI reference index.