Codex CLI config.toml Reference

Updated by

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.

LayerPrecedenceRead fromNotes
LegacyManagedConfigTomlFromMdm50managed_config.toml delivered by MDMLegacy managed configuration delivered by MDM.
LegacyManagedConfigTomlFromFile40/etc/codex/managed_config.tomlLegacy managed configuration loaded from a file.
SessionFlags30-c key=value and flags such as --model or --sandbox for this runOverrides supplied for the current session.
Project25.codex/config.toml in the working directory and each parent up to the project root; skipped while the project is untrustedConfiguration 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.
User20$CODEX_HOME/config.toml ($CODEX_HOME defaults to ~/.codex)User configuration, optionally augmented by a selected profile.
EnterpriseManaged15enterprise cloud config bundleConfiguration delivered by an enterprise cloud bundle.
System10/etc/codex/config.toml, or %ProgramData%\OpenAI\Codex\config.toml on WindowsHost-wide configuration loaded from a file.
Mdm0macOS managed preferences (MDM profile)Managed preferences delivered by MDM.
PackagedDefaults-10defaults shipped with the installed Codex packageDefault 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
InputBehaviour
-c key=valuedotted path (foo.bar.baz); value parsed as TOML, else used as a literal string
CODEX_HOMEmust exist and be a directory when set; otherwise ~/.codex
--profile <name>name limited to letters, digits, _ and -
--strict-configerrors 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:

SettingBehaviour 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
KeyTypeDefaultNotes
authobject—Command-backed bearer-token configuration for this provider.
auth.argsstring[][]Command arguments.
auth.commandstring—Command to execute. Bare names are resolved via `PATH`; paths are resolved against `cwd`.
auth.cwdstring—Working directory used when running the token command.
auth.refresh_interval_msinteger300000Maximum 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_msinteger5000Maximum time to wait for the token command to exit successfully.
awsobject—AWS SigV4 auth configuration for this provider.
aws.auth_refreshobject—Optional command used to reauthenticate after a refreshable AWS auth failure.
aws.auth_refresh.argsstring[][]Arguments passed to the refresh command.
aws.auth_refresh.commandstring—Executable to invoke directly, without a shell.
aws.auth_refresh.timeout_msinteger300000Maximum time to wait for the refresh command to complete.
aws.credential_exportobject—Optional command whose exported credentials replace the AWS SDK credential chain.
aws.credential_export.argsstring[][]Arguments passed to the credential export command.
aws.credential_export.commandstring—Executable to invoke directly, without a shell.
aws.credential_export.timeout_msinteger30000Maximum time to wait for the credential export command to complete.
aws.profilestring—AWS profile name to use. When unset, the AWS SDK default chain decides.
aws.regionstring—AWS region to use for provider-specific endpoints.
base_urlstring—Base URL for the provider's OpenAI-compatible API.
env_http_headersobject—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_keystring—Environment variable that stores the user's API key for this provider.
env_key_instructionsstring—Optional instructions to help the user get a valid value for the variable and set it.
experimental_bearer_tokenstring—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_oauthobject—Secondary OAuth credentials required by the provider's gateway.
gateway_oauth.authorization_urlstring——
gateway_oauth.client_idstring——
gateway_oauth.deliveryobject | object——
gateway_oauth.redirect_portinteger——
gateway_oauth.resourcestring——
gateway_oauth.scopesstring[][]—
gateway_oauth.token_urlstring——
http_headersobject—Additional HTTP headers to include in requests to this provider where the (key, value) pairs are the header name and value.
model_catalog_urlstring—Optional full URL for a Codex-native model catalog. When unset, OpenAI discovery uses the Codex backend unless `base_url` overrides the inference endpoint.
namestring""Friendly display name.
query_paramsobject—Optional query parameters to append to the base URL.
request_max_retriesinteger—Maximum number of times to retry a failed HTTP request to this provider.
requires_openai_authbooleanfalseDoes 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_msinteger—Idle timeout (in milliseconds) to wait for activity on a streaming response before treating the connection as lost.
stream_max_retriesinteger—Number of times to retry reconnecting a dropped streaming response before failing.
supports_standalone_web_searchbooleanfalseWhether this provider supports the standalone web-search endpoint.
supports_websocketsbooleanfalseWhether this provider supports the Responses API WebSocket transport.
websocket_connect_timeout_msinteger—Maximum time (in milliseconds) to wait for a websocket connection attempt before treating it as failed.
wire_apiresponses"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"]
TransportKeys that select itMCP spec section
stdiocommand, args, env, env_vars, cwdstdio
streamable httpurl, bearer_token_env_var, http_headers, env_http_headers, http_headers_helperstreamable-http
KeyTypeDefaultNotes
argsstring[]——
authoauth | 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_varstring——
commandstring——
cwdstring——
default_tools_approval_modeauto | prompt | writes | approve——
disabled_toolsstring[]——
enabledboolean——
enabled_toolsstring[]——
envobject——
env_http_headersobject——
env_varsstring | object[]——
environment_idstring——
http_headersobject——
http_headers_helperstring——
namestring—Legacy display-name field accepted for backward compatibility.
oauthobject—Client settings for MCP OAuth login or enterprise token exchange.
oauth.authorization_server_issuerstring—Expected resource authorization server issuer for EMA token exchange.
oauth.callback_portinteger—Fixed callback port that takes precedence over Codex's global OAuth callback port.
oauth.callback_urlstring—Registered callback URL associated with this OAuth client.
oauth.client_idstring—Explicit OAuth client identifier to present during authorization and token exchange.
oauth.client_secretstring—OAuth client secret used for token exchange with a pre-registered client.
oauth_resourcestring——
omit_tools_fromcode_mode | deferred | direct[]——
requiredboolean——
scopesstring[]——
startup_readinessconnection | catalog—Whether startup requires a live connection or can use a valid cached tool catalog.
startup_timeout_msinteger——
startup_timeout_secnumber——
supports_parallel_tool_callsboolean——
tool_input_schema_max_bytesinteger—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_secnumber——
toolsobject——
urlstring——

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.

StageFeatures
under development58
stable47
removed40
deprecated4
experimental3
KeyStageDefaultWhat it doesLegacy alias
analytics_plan_historyexperimentaloffPreview consumer five-hour and weekly allowance history.—
daemon_auto_startstableonAutomatically start the shared local daemon for eligible interactive launches.—
transcript_v2deprecatedoffDeprecated no-op; use `tui.fullscreen_transcript` instead.—
undoremovedoffRemoved compatibility flag retained as a no-op so old configs can still parse `undo`.—
shell_toolstableonEnable the default shell tool.—
view_imagestableonEnable the built-in local image viewer.—
sleep_toolstableonAllow registration of the built-in sleep tool.—
secret_auth_storagestableon (Windows only)Store CLI auth in the encrypted local secrets backend when keyring storage is selected.—
unified_execstableonUse the single unified PTY-backed exec tool.experimental_use_unified_exec_tool
unified_exec_ttystableonAllow unified exec commands to allocate an interactive terminal.—
shell_zsh_forkunder developmentoffRoute shell tool execution through the zsh exec bridge.—
unified_exec_zsh_forkremovedonAllow unified exec to compose with the zsh exec bridge.—
shell_snapshotstableonExperimental shell snapshotting.—
powershell_shell_versionunder developmentoffExpose the selected PowerShell execution host's bounded major/minor version.—
shell_snapshot_v2under developmentoffKeep policy-filtered shell snapshots entirely in executor memory.—
deferred_executorunder developmentoffAllow turns to start while selected executors are still starting.—
cwd_relative_turn_diffsunder developmentoffUse the current working directory for turn diff display paths.—
js_replremovedoffRemoved compatibility flag for the deleted JavaScript REPL feature.—
content_item_kindsstableonSend per-content-entry classifications in internal Responses metadata.—
executed_tool_call_metadataunder developmentoffRecord model-attempted tool calls in internal Responses metadata.—
code_modeunder developmentoffEnable JavaScript code mode backed by the standalone host process.—
code_mode_buffered_execremovedoffRemoved compatibility flag for the configurable code-mode exec yield timeout.—
code_mode_hoststableonRun JavaScript code mode in the standalone host process.—
code_mode_prewarmunder developmentoffEstablish the code-mode host connection during session startup.—
code_mode_interruptunder developmentoffTerminate active code mode cells when their turn is interrupted.—
instant_interruptunder developmentoffPreempt responses and yield foreground code-mode observations on new user input.—
code_mode_onlyunder developmentoffRestrict model-visible tools to code mode entrypoints (`exec`, `wait`).—
js_repl_tools_onlyremovedoffRemoved compatibility flag for the deleted JavaScript REPL tool-only mode.—
terminal_resize_reflowremovedonRemoved compatibility flag. Transcript scrollback reflow on terminal resize is always on.—
web_search_requestdeprecatedoffAllow the model to request web searches that fetch live content.web_search
web_search_cacheddeprecatedoffAllow the model to request web searches that fetch cached content. Takes precedence over `WebSearchRequest`.—
standalone_web_searchunder developmentoffExpose the extension-backed standalone web search tool.—
search_toolremovedoffLegacy search-tool feature flag kept for backward compatibility.—
codex_git_commitremovedoffRemoved legacy git commit attribution guidance flag.—
runtime_metricsunder developmentoffEnable runtime metrics snapshots via a manual reader.—
sqliteremovedonPersist rollout metadata to a local SQLite database.—
memoriesstableoffEnable startup memory extraction and file-backed memory consolidation.memory_tool
external_agent_memory_importunder developmentoffEnable importing project-scoped memory from external agents.—
local_thread_store_compressionunder developmentoffCompress 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_compressionremovedoffRemoved compatibility flag; local_thread_store_compression controls all rollout files.—
background_paginated_rollout_migrationunder developmentoffMigrate legacy local rollout files to paginated history in the background.—
chronicleunder developmentoffEnable the Chronicle sidecar for passive screen-context memories.telepathy
apply_patch_freeformremovedoffRemoved compatibility flag for the deleted apply_patch fallback feature.—
apply_patch_streaming_eventsunder developmentoffStream structured progress while apply_patch input is being generated.—
apply_patch_preserve_line_endingsunder developmentoffPreserve existing line endings when apply_patch updates files.—
exec_permission_approvalsunder developmentoffAllow exec tools to request additional permissions while staying sandboxed.request_permissions
write_stdin_approvalstableonRequire approval before writing input to escalated unified-exec terminals.—
hooksstableonEnable Claude-style lifecycle hooks loaded from hooks.json files.codex_hooks
request_permissions_toolunder developmentoffExpose the built-in request_permissions tool.—
use_linux_sandbox_bwrapremovedoffRemoved legacy Linux bubblewrap opt-in flag retained as a no-op so old wrappers and config can still parse it.—
use_legacy_landlockdeprecatedoffUse the legacy Landlock Linux sandbox fallback instead of the default bubblewrap pipeline.—
request_ruleremovedoffAllow the model to request approval and propose exec rules.—
experimental_windows_sandboxremovedoffEnable Windows sandbox (restricted token) on Windows.enable_experimental_windows_sandbox
elevated_windows_sandboxremovedoffUse the elevated Windows sandbox pipeline (setup + runner).—
windows_sandbox_serviceunder developmentoffAttempt elevated Windows sandbox provisioning through the installed service.—
prefer_mxcunder developmentoffPrefer the local native Windows sandbox when available, retaining legacy fallback.—
remote_modelsremovedoffLegacy remote models flag kept for backward compatibility.—
api_key_model_discoveryunder developmentoffDiscover model catalogs for OpenAI API-key authentication.—
enable_request_compressionstableonCompress request bodies (zstd) when sending streaming requests to codex-backend.—
unbounded_connection_retriesstableonKeep active sampling turns alive until a failed network connection recovers.—
network_proxyexperimentaloffStart the managed network proxy for sandboxed sessions.—
worktreesstableonEnable managed worktree creation and repository-aware sessions.—
respect_system_proxyunder developmentoffRespect host system proxy settings for Codex-owned network clients.—
system_proxy_fallbackstableonRetry eligible bootstrap requests through the system proxy after normal routing fails.—
multi_agentstableonEnable collab tools.collab
multi_agent_v2stableoffEnable task-path-based multi-agent routing.—
defer_mailbox_preemptionunder developmentoffKeep sampling through reasoning and commentary boundaries when agent mail arrives. Pending mail is delivered at the next normal input boundary instead.—
agent_message_boardunder developmentoffEnable shared discussion tools for an agent tree.—
multi_agent_moderemovedoffRemoved compatibility flag retained as a no-op.—
enable_fanoutremovedoffRemoved compatibility flag for the deleted agent-job tools.—
appsstableonEnable apps.connectors
pspunder developmentoffRoute first-party ChatGPT requests through PSP.—
enable_mcp_appsunder developmentoffEnable MCP apps.—
mcp_2026_07_28under developmentoffEnable MCP protocol version 2026-07-28 support.—
codex_apps_mcp_2026_07_28under developmentoffEnable MCP protocol version 2026-07-28 for the host-owned Codex Apps server.—
mcp_oauth_refresh_coordinationunder developmentoffLet RMCP coordinate OAuth refresh through the configured credential store.—
use_xaaunder developmentoffEnable enterprise refresh-token authorization for configured MCP resources.—
apps_mcp_path_overrideremovedoffRemoved compatibility flag for the legacy Apps MCP path override.—
tool_searchremovedoffRemoved compatibility flag retained as a no-op now that tool_search is always enabled.—
tool_search_always_defer_mcp_toolsremovedonRemoved compatibility flag. MCP tools are always deferred when tool_search is available.—
deferred_tool_world_stateunder developmentoffDescribe deferred tool namespaces in the model-visible world state.—
non_prefixed_mcp_tool_namesunder developmentoffExpose MCP model-visible namespaces without the legacy `mcp__` prefix.—
unavailable_dummy_toolsremovedoffRemoved compatibility flag for the deleted unavailable-tool placeholder backfill.—
tool_suggeststableonEnable discoverable tool suggestions for apps.—
recommended_pluginsstableoffInclude recommended plugins in model-visible context.—
pluginsstableonEnable plugins.—
executor_capability_discoveryunder developmentoffDiscover selected-root plugin and skill manifests through one high-level exec-server RPC.—
skip_host_skill_discoveryunder developmentoffSkip host skill snapshots when no registered contributor requires them.—
plugin_hooksremovedoffRemoved compatibility flag for plugin-bundled lifecycle hooks.—
in_app_browserstableonAllow the in-app browser pane in desktop apps.—
in_app_chatstableonAllow the in-app chat pane in desktop apps.—
in_app_dictationstableonAllow in-app dictation in desktop apps.—
in_app_local_automationstableonAllow desktop apps to run local automations.—
in_app_updatesstableonAllow desktop apps to perform in-app updates.—
browser_usestableonAllow Browser Use agent integration in desktop apps.—
browser_use_full_cdp_accessstableonAllow Browser Use integration to access the full Chrome DevTools Protocol surface.—
browser_use_externalstableonAllow Browser Use integration with external browsers.—
computer_usestableonAllow Codex Computer Use.—
remote_pluginstableonEnable the PS-backed remote plugin catalog.—
plugin_sharingstableonEnable remote plugin sharing flows.—
external_migrationremovedoffRemoved compatibility flag retained as a no-op.—
image_generationstableonEnable extension-backed image generation.imagegenext
omit_app_server_notification_mediaunder developmentoffOmit inline image and audio content from app-server item notifications.—
image_resize_noticeunder developmentoffTell the model when a prompt image was resized and include its dimensions.—
unified_image_budgetunder developmentoffApply one shared pixel and token budget to every image, regardless of legacy detail hints.—
resize_all_imagesremovedonRemoved compatibility flag for always-on centralized image preparation.—
item_idsremovedonRemoved compatibility flag for always-on response item IDs.—
concurrent_reasoning_summariesunder developmentoffRequest sequential cutoff reasoning summary delivery.—
skill_mcp_dependency_installstableonAllow prompting and installing missing MCP dependencies.—
skill_searchstableonRun cheap skill-search methods in shadow mode and emit experiment metrics.—
skill_env_var_dependency_promptremovedoffRemoved compatibility flag for deleted skill env var dependency prompting.—
mentions_v2stableonEnable the unified mention popup used by default in the TUI.—
steerremovedonSteer feature flag - when enabled, Enter submits immediately instead of queuing. Kept for config backward compatibility; behavior is always steer-enabled.—
default_mode_request_user_inputunder developmentoffAllow request_user_input in Default collaboration mode.—
send_async_messageremovedoffRemoved compatibility flag for model-enabled async user messaging.—
send_message_to_user_asyncunder developmentoffAllow root agents to send async user messages without model catalog support.—
terminal_visualization_instructionsunder developmentoffAdd terminal-specific visualization guidance to TUI developer instructions.—
guardian_approvalstableonEnable automatic review for approval prompts.—
guardianv2.thread_contextremovedoffRemoved compatibility flag for always-on thread-owned Guardian context.—
guardian_reuse_parent_compactionstableonReuse encrypted parent compaction when restarting Guardian review sessions. When disabled, retain an independent review transcript across parent compaction.—
guardian_enhanced_node_repl_transcriptsunder developmentoffInclude completed node_repl or cua_repl Code Mode responses in Guardian reviews.—
guardian_node_repl_transcript_imagesunder developmentoffInclude completed node_repl or cua_repl Code Mode response images in Guardian reviews.—
guardianv2under developmentoffEnable Guardian V2 automatic approval reviews.—
guardian_extremovedoffRemoved compatibility flag for the unused Guardian extension prototype.—
goalsstableonEnable persisted thread goals and automatic goal continuation.—
token_budgetunder developmentoffAdd current context-window metadata to model-visible context.—
context_managementunder developmentoffEnables experimental context management.—
rollout_budgetunder developmentoffTrack and report a shared token budget across a session's agent threads.—
reasoning_effort_overrideunder developmentoffAppend trusted response configuration items when the selected reasoning effort changes.—
current_time_reminderunder developmentoffAdd current-time reminders to model-visible context.—
nonfatal_clock_read_errorsunder developmentoffReport failed clock reads to the model without failing the turn.—
collaboration_modesremovedonEnable collaboration modes (Plan, Default). Kept for config backward compatibility; behavior is always collaboration-modes-enabled.—
tool_call_mcp_elicitationstableonRoute MCP tool approval prompts through the MCP elicitation request path.—
auth_elicitationstableonPrompt Codex Apps connector auth failures through MCP URL elicitations.—
bedrock_setup_wizardunder developmentoffOffer Amazon Bedrock setup during TUI sign-in onboarding.—
personalityremovedoffRemoved compatibility flag retained as a no-op.—
artifactunder developmentoffEnable native artifact tools.—
fast_modestableonEnable Fast mode selection in the TUI and request layer.—
step_model_switchingunder developmentoffEnable explicitly requested model changes for later step captures.—
realtime_conversationstableonEnable voice conversations in the TUI.—
remote_controlremovedoffRemoved compatibility flag for the deleted remote control feature.—
image_detail_originalremovedoffRemoved compatibility flag retained as a no-op so old wrappers can still pass `--enable image_detail_original`.—
tui_app_serverremovedonRemoved compatibility flag. The TUI now always uses the app-server implementation.—
prevent_idle_sleepexperimental on macOS, Linux, Windows; under development elsewhereoffPrevent idle system sleep while a turn is actively running.—
workspace_owner_usage_nudgeremovedoffRemoved compatibility flag retained as a no-op now that workspace owner usage nudges are always enabled.—
responses_websocketsremovedoffLegacy rollout flag for Responses API WebSocket transport experiments.—
responses_websockets_v2removedoffLegacy rollout flag for Responses API WebSocket transport v2 experiments.—
remote_compaction_v2removedoffRemoved compatibility key, still advertised to the Responses API.—
compaction_image_budgetstableonInclude retained images in the remote compaction context budget.—
retain_client_developer_messagesunder developmentoffRetain client-authored developer messages across compacted context windows.—
use_agent_identityunder developmentoffUse Agent Identity for ChatGPT-authenticated sessions.—
workspace_dependenciesstableonEnable 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.

KeyTypeDefaultNotes
agentstable—Agent-related settings (thread limits, etc.).
allow_login_shellboolean—Whether the model may request a login shell for shell-based tools. Default to `true`
allow_symlinked_codex_homeboolean—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.
analyticstable—When `false`, disables analytics across Codex product surfaces in this machine. Defaults to `true`.
approval_policyon-request | object | never—Default approval policy for executing commands.
approvals_revieweruser | 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.
appstable—Settings for app-specific controls.
apps_mcp_product_skustring—Optional product SKU forwarded on host-owned Codex Apps MCP requests.
audiotable—Machine-local realtime audio device preferences used by realtime voice.
auto_reviewtable—Optional policy instructions for the guardian auto-reviewer.
background_terminal_max_timeoutinteger—Maximum poll window for background terminal output (`write_stdin`), in milliseconds. Default: `300000` (5 minutes).
browser_usetable——
chatgpt_base_urlstring—Base URL for requests to ChatGPT (as opposed to the OpenAI API).
check_for_update_on_startupboolean—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_storefile | 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.
cloudtable—Cloud-owned feature settings.
compact_promptstring—Compact prompt used for history compaction.
computer_usetable——
default_permissionsstring—Default permissions profile to apply. Names starting with `:` refer to built-in profiles; other names are resolved from the `[permissions]` table.
desktoptable—Opaque desktop settings stored alongside the rest of config.toml.
developer_instructionsstring—Developer instructions inserted as a `developer` role message.
disable_paste_burstboolean—Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`.
experimental_compact_prompt_filestring—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_instructionsstring—Experimental / do not use. Replaces the built-in realtime start instructions inserted into developer messages when realtime becomes active.
experimental_realtime_webrtc_call_base_urlstring—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_promptstring—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_urlstring—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_modelstring—Experimental / do not use. Selects the realtime websocket model/snapshot used for the `Op::RealtimeConversation` connection.
experimental_realtime_ws_startup_contextstring—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_storeobject—Experimental / do not use. Selects the thread store implementation.
experimental_use_unified_exec_toolboolean——
featurestable—Centralized feature flags (new). Prefer this over individual toggles.
feedbacktable—When `false`, disables feedback collection across Codex product surfaces. Defaults to `true`.
file_openervscode | 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_idstring | string[]—When set, restricts ChatGPT login to one or more workspace identifiers.
forced_login_methodchatgpt | api—When set, restricts the login mechanism users may use.
ghost_snapshottable—Compatibility-only settings retained so legacy `ghost_snapshot` config still loads.
goalstable—Goal-related settings.
hide_agent_reasoningbooleanfalseWhen set to `true`, `AgentReasoning` events will be hidden from the UI/output. Defaults to `false`.
historytable{"max_bytes": null, "persistence": "save-all"}Settings that govern if and what will be written to `~/.codex/history.jsonl`.
hookstable—Lifecycle hooks configured inline in TOML plus user-level overrides.
include_apps_instructionsboolean—Whether to inject the `<apps_instructions>` developer block.
include_collaboration_mode_instructionsboolean—Whether to inject the `<collaboration_mode>` developer block.
include_environment_contextboolean—Whether to inject the `<environment_context>` user block.
include_permissions_instructionsboolean—Whether to inject the `<permissions instructions>` developer block.
instructionsstring—System instructions.
log_dirstring—Directory where Codex writes log files. Setting this value explicitly also enables the TUI text log in this directory. Defaults to `$CODEX_HOME/log`.
marketplacestable—User-level marketplace entries keyed by marketplace name.
mcp_enterprise_managed_authtable—Trusted enterprise IdP shared by EMA-enabled MCP servers and plugins.
mcp_oauth_callback_portinteger—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_urlstring—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_storeauto | 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_msinteger—Milliseconds to wait for optional MCP servers while building the initial tool catalog.
mcp_serverstable—Definition for MCP servers that Codex can reach out to for tool calls.
memoriestable—Memories subsystem settings.
modelstring—Optional override of model selection.
model_auto_compact_token_limitinteger—Token usage threshold triggering auto-compaction of conversation history.
model_auto_compact_token_limit_scopetotal | 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_jsonstring—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_windowinteger—Size of the context window for the model, in tokens.
model_instructions_filestring—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_percentinteger—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_providerstring—Provider to use from the model_providers map.
model_providerstable—User-defined provider entries that extend the built-in list. Built-in IDs cannot be overridden.
model_reasoning_effortstring—A non-empty reasoning effort value advertised by the model.
model_reasoning_summaryauto | 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_verbositylow | medium | high—Optional verbosity control for GPT-5 models (Responses API `text.verbosity`).
noticetable—Collection of in-product notices (different from notifications) See [`crate::types::Notice`] for more details
notifystring[]—Optional external command to spawn for end-user notifications.
openai_base_urlstring—Base URL override for the built-in `openai` model provider.
orchestratortable—Orchestrator-owned feature settings.
oss_providerstring—Preferred OSS provider for local models, e.g. "lmstudio" or "ollama".
oteltable—OTEL configuration.
permissionstable—Named permissions profiles.
personalitynone | friendly | pragmatic—Deprecated: `friendly` and `pragmatic` no longer select a style.
plan_mode_reasoning_effortstring—A non-empty reasoning effort value advertised by the model.
pluginstable—User-level plugin config entries keyed by plugin name.
profilestring—Profile to use from the `profiles` map.
profilestable—Named profiles to facilitate switching between different configurations.
project_doc_fallback_filenamesstring[]—Ordered list of fallback filenames to look for when AGENTS.md is missing.
project_doc_max_bytesinteger32768Maximum total bytes of project instruction content across all selected environments.
project_root_markersstring[]—Markers used to detect the project root when searching parent directories for `.codex` folders. Defaults to [".git"] when unset.
projectstable——
realtimetable—Experimental / do not use. Realtime websocket session selection. `version` controls v1/v2 and `type` controls conversational/transcription.
responses_api_metadatatable—Bounded, product-owned metadata attached to every Responses API request.
review_modelstring—Review model override used by the `/review` feature.
sandbox_moderead-only | workspace-write | danger-full-access—Sandbox mode to use.
sandbox_workspace_writetable—Sandbox configuration to apply if `sandbox` is `WorkspaceWrite`.
service_tierstring—Optional explicit service tier request id for new turns (for example `default`, `priority`, or `flex`; legacy `fast` also works).
shell_environment_policytable{"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_reasoningboolean—When set to `true`, `AgentReasoningRawContentEvent` events will be shown in the UI/output. Defaults to `false`.
skillstable—User-level skill config entries keyed by SKILL.md path.
sqlite_homestring—Directory where Codex stores the SQLite state DB. Defaults to `$CODEX_SQLITE_HOME` when set. Otherwise uses `$CODEX_HOME`.
suppress_unstable_features_warningboolean—Suppress warnings about unstable (under development) features.
thread_unload_delay_secsinteger—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_limitinteger—Token budget applied when storing tool/function outputs in the context manager.
tool_suggesttable—Additional discoverable tools that can be suggested for installation.
toolstable—Nested tools section for feature toggles
tuitable—Collection of settings that are specific to the TUI.
web_searchdisabled | cached | indexed | live—Controls the web search tool mode: disabled, cached, indexed, or live.
windowstable—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

Release-by-release changes: Codex CLI version tracker. All Codex CLI pages: Codex CLI reference index.