English
主导航

配置参考

Codex config.toml 和 requirements.toml 完整参考

将此页面作为 Codex 配置文件的可搜索参考。如需获取概念性指南和示例,请先阅读 配置基础 and 高级配置.

config.toml

用户级配置位于 ~/.codex/config.toml。你还可以在以下位置添加项目级覆盖: .codex/config.toml 文件中。Codex 仅在您信任该项目时才加载项目范围的配置文件。

项目范围的配置无法覆盖本机的提供商、身份验证、主机拥有的应用请求元数据、通知、配置文件选择或遥测路由密钥。当其出现在项目本地的 openai_base_url, chatgpt_base_url, apps_mcp_product_sku, model_provider, model_providers, notify, profile, profiles, experimental_realtime_ws_base_url,且 otel 中时,Codex 会忽略 .codex/config.toml;请改为将提供商、通知和遥测密钥放在用户级别的配置中。配置 配置文件 实时连接到 config.toml as $CODEX_HOME/profile-name.config.toml;选择一个包含 --profile profile-name.

对于沙盒和审批密钥(approval_policy, sandbox_mode,且 sandbox_workspace_write.*),请将此引用与 沙盒与审批, 可写根目录中的受保护路径,且 网络访问。有关 beta 权限 profile,请参阅 权限.

agents.<name>.config_file
类型 / 值
string (path)
详情
agents.<name>.description
类型 / 值
string
详情
agents.<name>.nickname_candidates
类型 / 值
array<string>
详情
agents.job_max_runtime_seconds
类型 / 值
number
详情
agents.max_depth
类型 / 值
number
详情
agents.max_threads
类型 / 值
number
详情
allow_login_shell
类型 / 值
boolean
详情
analytics.enabled
类型 / 值
boolean
详情
approval_policy
类型 / 值
untrusted | on-request | never | { granular = { sandbox_approval = bool, rules = bool, mcp_elicitations = bool, request_permissions = bool, skill_approval = bool } }
详情
approval_policy.granular.mcp_elicitations
类型 / 值
boolean
详情
approval_policy.granular.request_permissions
类型 / 值
boolean
详情
approval_policy.granular.rules
类型 / 值
boolean
详情
approval_policy.granular.sandbox_approval
类型 / 值
boolean
详情
approval_policy.granular.skill_approval
类型 / 值
boolean
详情
approvals_reviewer
类型 / 值
user | auto_review
详情
apps._default.destructive_enabled
类型 / 值
boolean
详情
apps._default.enabled
类型 / 值
boolean
详情
apps._default.open_world_enabled
类型 / 值
boolean
详情
apps.<id>.default_tools_approval_mode
类型 / 值
auto | prompt | approve
详情
apps.<id>.default_tools_enabled
类型 / 值
boolean
详情
apps.<id>.destructive_enabled
类型 / 值
boolean
详情
apps.<id>.enabled
类型 / 值
boolean
详情
apps.<id>.open_world_enabled
类型 / 值
boolean
详情
apps.<id>.tools.<tool>.approval_mode
类型 / 值
auto | prompt | approve
详情
apps.<id>.tools.<tool>.enabled
类型 / 值
boolean
详情
auto_review.policy
类型 / 值
string
详情
background_terminal_max_timeout
类型 / 值
number
详情
chatgpt_base_url
类型 / 值
string
详情
check_for_update_on_startup
类型 / 值
boolean
详情
cli_auth_credentials_store
类型 / 值
file | keyring | auto
详情
commit_attribution
类型 / 值
string
详情
compact_prompt
类型 / 值
string
详情
default_permissions
类型 / 值
string
详情
developer_instructions
类型 / 值
string
详情
disable_paste_burst
类型 / 值
boolean
详情
experimental_compact_prompt_file
类型 / 值
string (path)
详情
experimental_use_unified_exec_tool
类型 / 值
boolean
详情
features.apps
类型 / 值
boolean
详情
features.codex_git_commit
类型 / 值
boolean
详情
features.enable_request_compression
类型 / 值
boolean
详情
features.fast_mode
类型 / 值
boolean
详情
features.hooks
类型 / 值
boolean
详情
features.memories
类型 / 值
boolean
详情
features.multi_agent
类型 / 值
boolean
详情
features.network_proxy
类型 / 值
boolean | table
详情
features.network_proxy.allow_local_binding
类型 / 值
boolean
详情
features.network_proxy.allow_upstream_proxy
类型 / 值
boolean
详情
features.network_proxy.dangerously_allow_all_unix_sockets
类型 / 值
boolean
详情
features.network_proxy.dangerously_allow_non_loopback_proxy
类型 / 值
boolean
详情
features.network_proxy.domains
类型 / 值
map<string, allow | deny>
详情
features.network_proxy.enable_socks5
类型 / 值
boolean
详情
features.network_proxy.enable_socks5_udp
类型 / 值
boolean
详情
features.network_proxy.enabled
类型 / 值
boolean
详情
features.network_proxy.proxy_url
类型 / 值
string
详情
features.network_proxy.socks_url
类型 / 值
string
详情
features.network_proxy.unix_sockets
类型 / 值
map<string, allow | deny>
详情
features.personality
类型 / 值
boolean
详情
features.prevent_idle_sleep
类型 / 值
boolean
详情
features.shell_snapshot
类型 / 值
boolean
详情
features.shell_tool
类型 / 值
boolean
详情
features.skill_mcp_dependency_install
类型 / 值
boolean
详情
features.undo
类型 / 值
boolean
详情
features.unified_exec
类型 / 值
boolean
详情
features.web_search
类型 / 值
boolean
详情
features.web_search_cached
类型 / 值
boolean
详情
features.web_search_request
类型 / 值
boolean
详情
feedback.enabled
类型 / 值
boolean
详情
file_opener
类型 / 值
vscode | vscode-insiders | windsurf | cursor | none
详情
forced_chatgpt_workspace_id
类型 / 值
string (uuid)
详情
forced_login_method
类型 / 值
chatgpt | api
详情
hide_agent_reasoning
类型 / 值
boolean
详情
history.max_bytes
类型 / 值
number
详情
history.persistence
类型 / 值
save-all | none
详情
hooks
类型 / 值
table
详情
hooks.<Event>
类型 / 值
array<table>
详情
hooks.<Event>[].hooks
类型 / 值
array<table>
详情
hooks.<Event>[].hooks[].commandWindows
类型 / 值
string
详情
instructions
类型 / 值
string
详情
log_dir
类型 / 值
string (path)
详情
mcp_oauth_callback_port
类型 / 值
integer
详情
mcp_oauth_callback_url
类型 / 值
string
详情
mcp_oauth_credentials_store
类型 / 值
auto | file | keyring
详情
mcp_servers.<id>.args
类型 / 值
array<string>
详情
mcp_servers.<id>.bearer_token_env_var
类型 / 值
string
详情
mcp_servers.<id>.command
类型 / 值
string
详情
mcp_servers.<id>.cwd
类型 / 值
string
详情
mcp_servers.<id>.default_tools_approval_mode
类型 / 值
auto | prompt | approve
详情
mcp_servers.<id>.disabled_tools
类型 / 值
array<string>
详情
mcp_servers.<id>.enabled
类型 / 值
boolean
详情
mcp_servers.<id>.enabled_tools
类型 / 值
array<string>
详情
mcp_servers.<id>.env
类型 / 值
map<string,string>
详情
mcp_servers.<id>.env_http_headers
类型 / 值
map<string,string>
详情
mcp_servers.<id>.env_vars
类型 / 值
array<string | { name = string, source = "local" | "remote" }>
详情
mcp_servers.<id>.experimental_environment
类型 / 值
local | remote
详情
mcp_servers.<id>.http_headers
类型 / 值
map<string,string>
详情
mcp_servers.<id>.oauth_resource
类型 / 值
string
详情
mcp_servers.<id>.required
类型 / 值
boolean
详情
mcp_servers.<id>.scopes
类型 / 值
array<string>
详情
mcp_servers.<id>.startup_timeout_ms
类型 / 值
number
详情
mcp_servers.<id>.startup_timeout_sec
类型 / 值
number
详情
mcp_servers.<id>.tool_timeout_sec
类型 / 值
number
详情
mcp_servers.<id>.tools.<tool>.approval_mode
类型 / 值
auto | prompt | approve
详情
mcp_servers.<id>.url
类型 / 值
string
详情
memories.consolidation_model
类型 / 值
string
详情
memories.disable_on_external_context
类型 / 值
boolean
详情
memories.extract_model
类型 / 值
string
详情
memories.generate_memories
类型 / 值
boolean
详情
memories.max_raw_memories_for_consolidation
类型 / 值
number
详情
memories.max_rollout_age_days
类型 / 值
number
详情
memories.max_rollouts_per_startup
类型 / 值
number
详情
memories.max_unused_days
类型 / 值
number
详情
memories.min_rate_limit_remaining_percent
类型 / 值
number
详情
memories.min_rollout_idle_hours
类型 / 值
number
详情
memories.use_memories
类型 / 值
boolean
详情
model
类型 / 值
string
详情
model_auto_compact_token_limit
类型 / 值
number
详情
model_catalog_json
类型 / 值
string (path)
详情
model_context_window
类型 / 值
number
详情
model_instructions_file
类型 / 值
string (path)
详情
model_provider
类型 / 值
string
详情
model_providers.<id>
类型 / 值
table
详情
model_providers.<id>.auth
类型 / 值
table
详情
model_providers.<id>.auth.args
类型 / 值
array<string>
详情
model_providers.<id>.auth.command
类型 / 值
string
详情
model_providers.<id>.auth.cwd
类型 / 值
string (path)
详情
model_providers.<id>.auth.refresh_interval_ms
类型 / 值
number
详情
model_providers.<id>.auth.timeout_ms
类型 / 值
number
详情
model_providers.<id>.base_url
类型 / 值
string
详情
model_providers.<id>.env_http_headers
类型 / 值
map<string,string>
详情
model_providers.<id>.env_key
类型 / 值
string
详情
model_providers.<id>.env_key_instructions
类型 / 值
string
详情
model_providers.<id>.experimental_bearer_token
类型 / 值
string
详情
model_providers.<id>.http_headers
类型 / 值
map<string,string>
详情
model_providers.<id>.name
类型 / 值
string
详情
model_providers.<id>.query_params
类型 / 值
map<string,string>
详情
model_providers.<id>.request_max_retries
类型 / 值
number
详情
model_providers.<id>.requires_openai_auth
类型 / 值
boolean
详情
model_providers.<id>.stream_idle_timeout_ms
类型 / 值
number
详情
model_providers.<id>.stream_max_retries
类型 / 值
number
详情
model_providers.<id>.supports_websockets
类型 / 值
boolean
详情
model_providers.<id>.wire_api
类型 / 值
responses
详情
model_providers.amazon-bedrock.aws.profile
类型 / 值
string
详情
model_providers.amazon-bedrock.aws.region
类型 / 值
string
详情
model_reasoning_effort
类型 / 值
minimal | low | medium | high | xhigh
详情
model_reasoning_summary
类型 / 值
auto | concise | detailed | none
详情
model_supports_reasoning_summaries
类型 / 值
boolean
详情
model_verbosity
类型 / 值
low | medium | high
详情
notice.hide_full_access_warning
类型 / 值
boolean
详情
notice.hide_gpt-5.1-codex-max_migration_prompt
类型 / 值
boolean
详情
notice.hide_gpt5_1_migration_prompt
类型 / 值
boolean
详情
notice.hide_rate_limit_model_nudge
类型 / 值
boolean
详情
notice.hide_world_writable_warning
类型 / 值
boolean
详情
notice.model_migrations
类型 / 值
map<string,string>
详情
notify
类型 / 值
array<string>
详情
openai_base_url
类型 / 值
string
详情
oss_provider
类型 / 值
lmstudio | ollama
详情
otel.environment
类型 / 值
string
详情
otel.exporter
类型 / 值
none | otlp-http | otlp-grpc
详情
otel.exporter.<id>.endpoint
类型 / 值
string
详情
otel.exporter.<id>.headers
类型 / 值
map<string,string>
详情
otel.exporter.<id>.protocol
类型 / 值
binary | json
详情
otel.exporter.<id>.tls.ca-certificate
类型 / 值
string
详情
otel.exporter.<id>.tls.client-certificate
类型 / 值
string
详情
otel.exporter.<id>.tls.client-private-key
类型 / 值
string
详情
otel.log_user_prompt
类型 / 值
boolean
详情
otel.metrics_exporter
类型 / 值
none | statsig | otlp-http | otlp-grpc
详情
otel.trace_exporter
类型 / 值
none | otlp-http | otlp-grpc
详情
otel.trace_exporter.<id>.endpoint
类型 / 值
string
详情
otel.trace_exporter.<id>.headers
类型 / 值
map<string,string>
详情
otel.trace_exporter.<id>.protocol
类型 / 值
binary | json
详情
otel.trace_exporter.<id>.tls.ca-certificate
类型 / 值
string
详情
otel.trace_exporter.<id>.tls.client-certificate
类型 / 值
string
详情
otel.trace_exporter.<id>.tls.client-private-key
类型 / 值
string
详情
permissions.<name>.description
类型 / 值
string
详情
permissions.<name>.extends
类型 / 值
string
详情
permissions.<name>.filesystem
类型 / 值
table
详情
permissions.<name>.filesystem.":workspace_roots".<subpath-or-glob>
类型 / 值
"read" | "write" | "deny"
详情
permissions.<name>.filesystem.<path-or-glob>
类型 / 值
"read" | "write" | "deny" | table
详情
permissions.<name>.filesystem.glob_scan_max_depth
类型 / 值
number
详情
permissions.<name>.network.allow_local_binding
类型 / 值
boolean
详情
permissions.<name>.network.allow_upstream_proxy
类型 / 值
boolean
详情
permissions.<name>.network.dangerously_allow_all_unix_sockets
类型 / 值
boolean
详情
permissions.<name>.network.dangerously_allow_non_loopback_proxy
类型 / 值
boolean
详情
permissions.<name>.network.domains
类型 / 值
table
详情
permissions.<name>.network.domains.<pattern>
类型 / 值
allow | deny
详情
permissions.<name>.network.enable_socks5
类型 / 值
boolean
详情
permissions.<name>.network.enable_socks5_udp
类型 / 值
boolean
详情
permissions.<name>.network.enabled
类型 / 值
boolean
详情
permissions.<name>.network.mode
类型 / 值
limited | full
详情
permissions.<name>.network.proxy_url
类型 / 值
string
详情
permissions.<name>.network.socks_url
类型 / 值
string
详情
permissions.<name>.network.unix_sockets
类型 / 值
table
详情
permissions.<name>.network.unix_sockets.<path>
类型 / 值
allow | deny
详情
permissions.<name>.workspace_roots
类型 / 值
table
详情
permissions.<name>.workspace_roots.<path>
类型 / 值
boolean
详情
personality
类型 / 值
none | friendly | pragmatic
详情
plan_mode_reasoning_effort
类型 / 值
none | minimal | low | medium | high | xhigh
详情
plugins.<plugin>.mcp_servers.<server>.default_tools_approval_mode
类型 / 值
auto | prompt | approve
详情
plugins.<plugin>.mcp_servers.<server>.disabled_tools
类型 / 值
array<string>
详情
plugins.<plugin>.mcp_servers.<server>.enabled
类型 / 值
boolean
详情
plugins.<plugin>.mcp_servers.<server>.enabled_tools
类型 / 值
array<string>
详情
plugins.<plugin>.mcp_servers.<server>.tools.<tool>.approval_mode
类型 / 值
auto | prompt | approve
详情
project_doc_fallback_filenames
类型 / 值
array<string>
详情
project_doc_max_bytes
类型 / 值
number
详情
project_root_markers
类型 / 值
array<string>
详情
projects.<path>.trust_level
类型 / 值
string
详情
review_model
类型 / 值
string
详情
sandbox_mode
类型 / 值
read-only | workspace-write | danger-full-access
详情
sandbox_workspace_write.exclude_slash_tmp
类型 / 值
boolean
详情
sandbox_workspace_write.exclude_tmpdir_env_var
类型 / 值
boolean
详情
sandbox_workspace_write.network_access
类型 / 值
boolean
详情
sandbox_workspace_write.writable_roots
类型 / 值
array<string>
详情
service_tier
类型 / 值
string
详情
shell_environment_policy.exclude
类型 / 值
array<string>
详情
shell_environment_policy.experimental_use_profile
类型 / 值
boolean
详情
shell_environment_policy.ignore_default_excludes
类型 / 值
boolean
详情
shell_environment_policy.include_only
类型 / 值
array<string>
详情
shell_environment_policy.inherit
类型 / 值
all | core | none
详情
shell_environment_policy.set
类型 / 值
map<string,string>
详情
show_raw_agent_reasoning
类型 / 值
boolean
详情
skills.config
类型 / 值
array<object>
详情
skills.config.<index>.enabled
类型 / 值
boolean
详情
skills.config.<index>.path
类型 / 值
string (path)
详情
sqlite_home
类型 / 值
string (path)
详情
suppress_unstable_features_warning
类型 / 值
boolean
详情
tool_output_token_limit
类型 / 值
number
详情
tool_suggest.disabled_tools
类型 / 值
array<table>
详情
tool_suggest.discoverables
类型 / 值
array<table>
详情
tools.view_image
类型 / 值
boolean
详情
tools.web_search
类型 / 值
boolean | { context_size = "low|medium|high", allowed_domains = [string], location = { country, region, city, timezone } }
详情
tui
类型 / 值
table
详情
tui.alternate_screen
类型 / 值
auto | always | never
详情
tui.animations
类型 / 值
boolean
详情
tui.keymap.<context>.<action>
类型 / 值
string | array<string>
详情
tui.keymap.<context>.<action> = []
类型 / 值
empty array
详情
tui.model_availability_nux.<model>
类型 / 值
integer
详情
tui.notification_condition
类型 / 值
unfocused | always
详情
tui.notification_method
类型 / 值
auto | osc9 | bel
详情
tui.notifications
类型 / 值
boolean | array<string>
详情
tui.raw_output_mode
类型 / 值
boolean
详情
tui.show_tooltips
类型 / 值
boolean
详情
tui.status_line
类型 / 值
array<string> | null
详情
tui.terminal_title
类型 / 值
array<string> | null
详情
tui.theme
类型 / 值
string
详情
tui.vim_mode_default
类型 / 值
boolean
详情
web_search
类型 / 值
disabled | cached | live
详情
windows_wsl_setup_acknowledged
类型 / 值
boolean
详情
windows.sandbox
类型 / 值
unelevated | elevated
详情
windows.sandbox_private_desktop
类型 / 值
boolean
详情

您可以在以下位置找到最新的 JSON schema config.toml 此处.

要在 VS Code 或 Cursor 中编辑 config.toml 时获得自动补全和诊断功能,您可以安装 Even Better TOML 扩展,并将以下行添加到您的 config.toml:

#:schema https://developers.openai.com/codex/config-schema.json

文件的顶部。注意:重命名 experimental_instructions_file to model_instructions_file。Codex 会弃用旧键;请将现有配置更新为新名称。

requirements.toml

requirements.toml 是由管理员强制执行的配置文件,用于限制用户无法覆盖的安全敏感设置。有关详细信息、文件位置和示例,请参阅 管理员强制要求.

对于 ChatGPT Business 和 Enterprise 用户,Codex 还可以应用云端获取的需求。有关优先级的详细信息,请参阅安全页面。

使用 [features] in requirements.toml 用于固定特性标志,它使用与 config.toml 相同的规范键。省略的键将不受限制。

allow_managed_hooks_only
类型 / 值
boolean
详情
allowed_approval_policies
类型 / 值
array<string>
详情
allowed_approvals_reviewers
类型 / 值
array<string>
详情
allowed_sandbox_modes
类型 / 值
array<string>
详情
allowed_web_search_modes
类型 / 值
array<string>
详情
experimental_network
类型 / 值
table
详情
experimental_network.allow_local_binding
类型 / 值
boolean
详情
experimental_network.allow_upstream_proxy
类型 / 值
boolean
详情
experimental_network.allowed_domains
类型 / 值
array<string>
详情
experimental_network.dangerously_allow_all_unix_sockets
类型 / 值
boolean
详情
experimental_network.dangerously_allow_non_loopback_proxy
类型 / 值
boolean
详情
experimental_network.denied_domains
类型 / 值
array<string>
详情
experimental_network.domains
类型 / 值
map<string, allow | deny>
详情
experimental_network.enabled
类型 / 值
boolean
详情
experimental_network.http_port
类型 / 值
integer
详情
experimental_network.managed_allowed_domains_only
类型 / 值
boolean
详情
experimental_network.socks_port
类型 / 值
integer
详情
experimental_network.unix_sockets
类型 / 值
map<string, allow | deny>
详情
features
类型 / 值
table
详情
features.<name>
类型 / 值
boolean
详情
features.browser_use
类型 / 值
boolean
详情
features.computer_use
类型 / 值
boolean
详情
features.in_app_browser
类型 / 值
boolean
详情
guardian_policy_config
类型 / 值
string
详情
hooks
类型 / 值
table
详情
hooks.<Event>
类型 / 值
array<table>
详情
hooks.<Event>[].hooks
类型 / 值
array<table>
详情
hooks.<Event>[].hooks[].commandWindows
类型 / 值
string
详情
hooks.managed_dir
类型 / 值
string (absolute path)
详情
hooks.windows_managed_dir
类型 / 值
string (absolute path)
详情
mcp_servers
类型 / 值
table
详情
mcp_servers.<id>.identity
类型 / 值
table
详情
mcp_servers.<id>.identity.command
类型 / 值
string
详情
mcp_servers.<id>.identity.url
类型 / 值
string
详情
permissions.filesystem.deny_read
类型 / 值
array<string>
详情
plugin_sharing
类型 / 值
boolean
详情
remote_sandbox_config
类型 / 值
array<table>
详情
remote_sandbox_config[].allowed_sandbox_modes
类型 / 值
array<string>
详情
remote_sandbox_config[].hostname_patterns
类型 / 值
array<string>
详情
rules
类型 / 值
table
详情
rules.prefix_rules
类型 / 值
array<table>
详情
rules.prefix_rules[].decision
类型 / 值
prompt | forbidden
详情
rules.prefix_rules[].justification
类型 / 值
string
详情
rules.prefix_rules[].pattern
类型 / 值
array<table>
详情
rules.prefix_rules[].pattern[].any_of
类型 / 值
array<string>
详情
rules.prefix_rules[].pattern[].token
类型 / 值
string
详情