中文

配置参考

配置参考

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

将此页面用作 Codex 配置文件的可搜索参考。如需概念指导和示例,请先参阅配置基础高级配置

config.toml

用户级配置位于 ~/.codex/config.toml。你还可以在 .codex/config.toml 文件中添加项目范围的覆盖配置。只有当你信任项目时,Codex 才会加载项目范围的配置文件。

项目范围的配置不能覆盖计算机本地的提供商、身份验证、 宿主应用拥有的请求元数据、通知、配置档案选择或 遥测路由键。当 openai_base_urlchatgpt_base_urlapps_mcp_product_skumodel_providermodel_providersnotifyprofileprofilesexperimental_realtime_ws_base_urlotel 出现在项目本地的 .codex/config.toml 中时,Codex 会忽略它们;请改为将提供商、通知和遥测 键放在用户级配置中。配置档案文件$CODEX_HOME/profile-name.config.toml 的形式与 config.toml 位于同一位置;使用 --profile profile-name 选择一个档案。

对于沙盒和审批键(approval_policysandbox_modesandbox_workspace_write.*),请将本参考与沙盒和审批可写根目录中的受保护路径网络访问配合使用。有关测试版权限档案,请参阅权限

<ConfigTable options={[ { key: "model", type: "string", description: "要使用的模型(例如 gpt-5.5)。", }, { key: "review_model", type: "string", description: "/review 使用的可选模型覆盖项(默认为当前会话模型)。", }, { key: "model_provider", type: "string", description: "model_providers 中的提供商 ID(默认值:openai)。", }, { key: "openai_base_url", type: "string", description: "覆盖内置 openai 模型提供商的基础 URL。", }, { key: "model_context_window", type: "number", description: "当前模型可用的上下文窗口 token 数。", }, { key: "model_auto_compact_token_limit", type: "number", description: "触发自动压缩历史记录的 token 阈值(未设置时使用模型默认值)。", }, { key: "model_auto_compact_token_limit_scope", type: "total | body_after_prefix", description: "控制自动压缩阈值是计算完整的当前上下文(total,默认值),还是仅计算所保留压缩窗口前缀之后的增长量(body_after_prefix)。", }, { key: "model_catalog_json", type: "string (path)", description: "启动时加载的 JSON 模型目录的可选路径。所选 $CODEX_HOME/profile-name.config.toml 配置文件可按配置覆盖此设置。", }, { key: "oss_provider", type: "lmstudio | ollama", description: "使用 --oss 运行时采用的默认本地提供商(未设置时默认提示选择)。", }, { key: "approval_policy", type: "untrusted | on-request | never | { granular = { sandbox_approval = bool, rules = bool, mcp_elicitations = bool, request_permissions = bool, skill_approval = bool } }", description: "控制 Codex 在执行命令前何时暂停并请求批准。你还可以使用 approval_policy = { granular = { ... } },在保持其他提示可交互的同时,允许或自动拒绝特定提示类别。on-failure 已弃用;交互式运行请使用 on-request,非交互式运行请使用 never。", }, { key: "approval_policy.granular.sandbox_approval", type: "boolean", description: "设为 true 时,允许显示沙箱权限提升批准提示。", }, { key: "approval_policy.granular.rules", type: "boolean", description: "设为 true 时,允许显示由 execpolicy prompt 规则触发的批准提示。", }, { key: "approval_policy.granular.mcp_elicitations", type: "boolean", description: "设为 true 时,允许显示 MCP 信息征询提示,而不是自动拒绝。", }, { key: "approval_policy.granular.request_permissions", type: "boolean", description: "设为 true 时,允许显示来自 request_permissions 工具的提示。", }, { key: "approval_policy.granular.skill_approval", type: "boolean", description: "设为 true 时,允许显示技能脚本批准提示。", }, { key: "approvals_reviewer", type: "user | auto_review", description: "指定由谁审核 on-request 或细粒度批准策略下符合条件的批准提示。默认值为 userauto_review 使用审核子代理。此设置不会改变沙箱机制,也不会改变沙箱内已允许的审核操作。", }, { key: "auto_review.policy", type: "string", description: "用于自动审核的本地 Markdown 策略说明。托管的 guardian_policy_config 优先级更高。空值将被忽略。", }, { key: "allow_login_shell", type: "boolean", description: "允许基于 shell 的工具使用登录 shell 语义。默认值为 true;设为 false 时,将拒绝 login = true 请求,省略的 login 则默认为非登录 shell。", }, { key: "sandbox_mode", type: "read-only | workspace-write | danger-full-access", description: "命令执行期间文件系统和网络访问所采用的沙箱策略。", }, { key: "sandbox_workspace_write.writable_roots", type: "array", description: '使用 sandbox_mode = "workspace-write" 时的其他可写根目录。', }, { key: "sandbox_workspace_write.network_access", type: "boolean", description: "允许在 workspace-write 沙箱内访问出站网络。", }, { key: "sandbox_workspace_write.exclude_tmpdir_env_var", type: "boolean", description: "在 workspace-write 模式下,从可写根目录中排除 $TMPDIR。", }, { key: "sandbox_workspace_write.exclude_slash_tmp", type: "boolean", description: "在 workspace-write 模式下,从可写根目录中排除 /tmp。", }, { key: "windows.sandbox", type: "unelevated | elevated", description: "在 Windows 上原生运行 Codex 时使用的仅限 Windows 的原生沙箱模式。", }, { key: "windows.sandbox_private_desktop", type: "boolean", description: "在原生 Windows 上,默认在专用桌面中运行最终的沙箱子进程。仅为兼容旧版 Winsta0\\\\Default 行为时才设为 false。", }, { key: "computer_use.windows.always_allowed_app_ids", type: "array", description: "Computer Use 无需提示即可打开的 Windows 应用标识符。不在列表中的应用需要批准;可从 ChatGPT 桌面应用的 Computer Use 设置中移除已保存的条目。", }, { key: "notify", type: "array", description: "通知时调用的命令;该命令会接收来自 Codex 的 JSON 有效载荷。", }, { key: "check_for_update_on_startup", type: "boolean", description: "启动时检查 Codex 更新(仅当更新由中央统一管理时才设为 false)。", }, { key: "feedback.enabled", type: "boolean", description: "允许在本地客户端中通过 /feedback 提交反馈(默认值:true)。", }, { key: "analytics.enabled", type: "boolean", description: "为此计算机/配置启用或禁用分析。未设置时,应用客户端默认值。", }, { key: "instructions", type: "string", description: "保留供将来使用;请优先使用 model_instructions_fileAGENTS.md。", }, { key: "developer_instructions", type: "string", description: "注入会话的其他开发者说明(可选)。", }, { key: "log_dir", type: "string (path)", description: "Codex 写入日志文件的目录;默认为 $CODEX_HOME/log。显式设置此项还会在该目录中启用可选的纯文本 TUI 日志 codex-tui.log。", }, { key: "sqlite_home", type: "string (path)", description: "Codex 存储由 SQLite 支持的状态数据库的目录,该数据库用于代理作业及其他可恢复的运行时状态。", }, { key: "compact_prompt", type: "string", description: "对历史记录压缩提示词的内联覆盖。", }, { key: "model_instructions_file", type: "string (path)", description: "用于替换内置说明,而不是 AGENTS.md。", }, { key: "personality", type: "none | friendly | pragmatic", description: "为声明支持 supportsPersonality 的模型设置默认沟通风格;可按线程/轮次或通过 /personality 覆盖。", }, { key: "service_tier", type: "string", description: "新轮次的首选服务层级。使用 fast 或当前模型声明的其他层级;fast 会映射到请求值 priority。", }, { key: "experimental_compact_prompt_file", type: "string (path)", description: "从文件加载压缩提示词覆盖项(实验性)。", }, { key: "skills.config", type: "array", description: "存储在 config.toml 中的逐技能启用覆盖项。", }, { key: "skills.config..path", type: "string (path)", description: "包含 SKILL.md 的技能文件夹路径。", }, { key: "skills.config..enabled", type: "boolean", description: "启用或禁用所引用的技能。", }, { key: "apps..enabled", type: "boolean", description: "按 ID 启用或禁用特定应用/连接器(默认值:true)。", }, { key: "apps._default.enabled", type: "boolean", description: "所有应用的默认启用状态,除非按应用覆盖。", }, { key: "apps._default.destructive_enabled", type: "boolean", description: "默认允许或拒绝带有 destructive_hint = true 的应用工具。", }, { key: "apps._default.open_world_enabled", type: "boolean", description: "默认允许或拒绝带有 open_world_hint = true 的应用工具。", }, { key: "apps._default.approvals_reviewer", type: "user | auto_review", description: "应用工具批准提示的默认审核者,除非按应用覆盖。省略时,应用继承顶层 approvals_reviewer 值。", }, { key: "apps._default.default_tools_approval_mode", type: "auto | prompt | writes | approve", description: "没有逐应用或逐工具覆盖项的应用工具所采用的默认批准行为。", }, { key: "apps..destructive_enabled", type: "boolean", description: "允许或阻止此应用中声明 destructive_hint = true 的工具。", }, { key: "apps..open_world_enabled", type: "boolean", description: "允许或阻止此应用中声明 open_world_hint = true 的工具。", }, { key: "apps..default_tools_enabled", type: "boolean", description: "此应用中工具的默认启用状态,除非存在逐工具覆盖项。", }, { key: "apps..approvals_reviewer", type: "user | auto_review", description: "此应用工具批准提示的审核者。覆盖 apps._default.approvals_reviewer。", }, { key: "apps..default_tools_approval_mode", type: "auto | prompt | writes | approve", description: "此应用中工具的默认批准行为,除非存在逐工具覆盖项。", }, { key: "apps..tools..enabled", type: "boolean", description: "应用工具的逐工具启用覆盖项(例如 repos/list)。", }, { key: "apps..tools..approval_mode", type: "auto | prompt | writes | approve", description: "单个应用工具的逐工具批准行为覆盖项。", }, { key: "tool_suggest.discoverables", type: "array", description: '允许推荐其他可发现的连接器或插件。每个条目使用 type = "connector""plugin",以及一个 id。', }, { key: "tool_suggest.disabled_tools", type: "array
", description: '禁用对特定可发现连接器或插件的推荐。每个条目使用 type = "connector""plugin",以及一个 id。', }, { key: "features.apps", type: "boolean", description: "启用应用(连接器)集成(稳定;默认开启)。应用和连接器流量不受沙箱命令网络代理或其域名允许列表控制。", }, { key: "features.hooks", type: "boolean", description: "启用从 hooks.json 或内联 [hooks] 配置加载的生命周期钩子。features.codex_hooks 是已弃用的别名。", }, { key: "features.code_mode.enabled", type: "boolean", description: "启用代码模式功能配置。此功能仍在开发中,默认关闭。", }, { key: "features.code_mode.excluded_tool_namespaces", type: "array", description: "代码模式从嵌套代码模式工具指引和执行器暴露范围中排除的工具命名空间。", }, { key: "features.code_mode.direct_only_tool_namespaces", type: "array", description: "代码模式只能通过直接工具调用使用的工具命名空间。", }, { key: "features.rollout_budget.enabled", type: "boolean", description: "启用 rollout 预算跟踪。此功能仍在开发中,默认关闭。启用时必须设置 features.rollout_budget.limit_tokens。", }, { key: "features.rollout_budget.limit_tokens", type: "integer", description: "rollout 预算跟踪的正 token 上限。启用 rollout 预算时必须设置。", }, { key: "features.rollout_budget.reminder_interval_tokens", type: "integer", description: "rollout 预算提醒之间的正 token 间隔。默认为 limit_tokens 的 10%,最小为 1 个 token。", }, { key: "features.rollout_budget.sampling_token_weight", type: "number", description: "rollout 预算核算中采样 token 的有限非负乘数。默认为 1.0。", }, { key: "features.rollout_budget.prefill_token_weight", type: "number", description: "rollout 预算核算中预填充 token 的有限非负乘数。默认为 1.0。", }, { key: "hooks", type: "table", description: "在 config.toml 中内联配置的生命周期钩子。使用与 hooks.json 相同的事件架构;有关示例和支持的事件,请参阅 Hooks 指南。", }, { key: "hooks.", type: "array
", description: "用于 PreToolUsePermissionRequestPostToolUsePreCompactPostCompactSessionStartSessionEndSubagentStartSubagentStopUserPromptSubmitStop 等钩子事件的匹配器组。", }, { key: "hooks.[].hooks", type: "array
", description: "匹配器组的钩子处理程序。目前支持命令钩子;提示词和代理钩子处理程序会被解析,但会跳过。", }, { key: "hooks.[].hooks[].async", type: "boolean", description: "在后台运行命令钩子,不延迟触发操作。默认为 falseSessionEnd 始终同步运行。请参阅在后台运行钩子。", }, { key: "hooks.[].hooks[].commandWindows", type: "string", description: "仅限 Windows 的命令钩子命令覆盖项。也接受 TOML 别名 command_windows。", }, { key: "features.memories", type: "boolean", description: "启用记忆(默认关闭)。", }, { key: "mcp_servers..command", type: "string", description: "MCP stdio 服务器的启动命令。", }, { key: "mcp_servers..args", type: "array", description: "传递给 MCP stdio 服务器命令的参数。", }, { key: "mcp_servers..env", type: "map<string,string>", description: "转发给 MCP stdio 服务器的环境变量。", }, { key: "mcp_servers..env_vars", type: 'array<string | { name = string, source = "local" | "remote" }>', description: '要加入 MCP stdio 服务器允许列表的其他环境变量。字符串条目默认为 source = "local";仅对由执行器支持的远程 stdio 使用 source = "remote"。', }, { key: "mcp_servers..cwd", type: "string", description: "MCP stdio 服务器进程的工作目录。", }, { key: "mcp_servers..url", type: "string", description: "MCP 可流式 HTTP 服务器的端点。", }, { key: "mcp_servers..auth", type: "oauth | chatgpt", description: "配置的 bearer token 和授权标头之后,MCP HTTP 服务器采用的身份验证回退方式。oauth(默认值)会在可用时使用已存储的 MCP OAuth 凭据。chatgpt 对可信的第一方 ChatGPT 源使用当前 ChatGPT 会话,随后回退到已存储的 OAuth。如果未解析到任何凭据来源,两种模式都可以在不进行身份验证的情况下连接。", }, { key: "mcp_servers..bearer_token_env_var", type: "string", description: "为 MCP HTTP 服务器提供 bearer token 的环境变量。", }, { key: "mcp_servers..http_headers", type: "map<string,string>", description: "每个 MCP HTTP 请求中包含的静态 HTTP 标头。", }, { key: "mcp_servers..env_http_headers", type: "map<string,string>", description: "从环境变量填充、用于 MCP HTTP 服务器的 HTTP 标头。", }, { key: "mcp_servers..enabled", type: "boolean", description: "不移除配置即可禁用 MCP 服务器。", }, { key: "mcp_servers..required", type: "boolean", description: "设为 true 时,如果此已启用的 MCP 服务器无法初始化,则启动/恢复失败。", }, { key: "mcp_servers..startup_timeout_sec", type: "number", description: "覆盖 MCP 服务器默认的 10 秒启动超时。", }, { key: "mcp_servers..startup_timeout_ms", type: "number", description: "startup_timeout_sec 的毫秒别名。", }, { key: "mcp_servers..tool_timeout_sec", type: "number", description: "覆盖 MCP 服务器默认的单工具 60 秒超时。", }, { key: "mcp_servers..enabled_tools", type: "array", description: "MCP 服务器暴露的工具名称允许列表。", }, { key: "mcp_servers..disabled_tools", type: "array", description: "在 MCP 服务器的 enabled_tools 之后应用的拒绝列表。", }, { key: "mcp_servers..default_tools_approval_mode", type: "auto | prompt | writes | approve", description: "此服务器上没有逐工具覆盖项的 MCP 工具所采用的默认批准行为。", }, { key: "mcp_servers..tools..approval_mode", type: "auto | prompt | writes | approve", description: "此服务器上单个 MCP 工具的逐工具批准行为覆盖项。", }, { key: "mcp_servers..scopes", type: "array", description: "向该 MCP 服务器进行身份验证时要请求的 OAuth 作用域。", }, { key: "mcp_servers..oauth_resource", type: "string", description: "MCP 登录期间要包含的可选 RFC 8707 OAuth 资源参数。", }, { key: "mcp_servers..experimental_environment", type: "local | remote", description: "MCP 服务器的实验性部署位置。remote 通过远程执行器环境启动 stdio 服务器;尚未实现可流式 HTTP 的远程部署。", }, { key: "agents", type: "table", description: "多代理设置和自定义角色声明。标量设置名称为保留名称,不能用作自定义角色名称。", }, { key: "agents.enabled", type: "boolean", description: "启用或禁用多代理工具(默认值:true)。", }, { key: "agents.max_concurrent_threads_per_session", type: "number", description: "可同时打开的已生成代理线程数上限,不包括主线程。未设置时,由 Codex 选择默认值。", }, { key: "agents.max_threads", type: "number", description: "agents.max_concurrent_threads_per_session 的旧版别名。", }, { key: "agents.default_subagent_model", type: "string", description: "已生成代理的默认模型。显式指定的生成模型优先级更高。", }, { key: "agents.default_subagent_reasoning_effort", type: "string", description: "已生成代理的默认推理强度。显式指定的生成推理强度优先级更高。", }, { key: "agents.interrupt_message", type: "boolean", description: "代理轮次被中断时,记录一条模型可见消息(默认值:true)。", }, { key: "agents..description", type: "string", description: "Codex 选择并生成该代理类型时显示的角色指引。", }, { key: "agents..config_file", type: "string (path)", description: "该角色的 TOML 配置层路径;相对路径以声明该角色的配置文件为基准解析。", }, { key: "memories.generate_memories", type: "boolean", description: "设为 false 时,新建线程不会存储为记忆生成输入。默认为 true。", }, { key: "memories.use_memories", type: "boolean", description: "设为 false 时,Codex 不会将现有记忆注入未来的会话。默认为 true。", }, { key: "memories.disable_on_external_context", type: "boolean", description: "设为 true 时,使用 MCP 工具调用、网络搜索或工具搜索等外部上下文的线程不会参与记忆生成。默认为 false。旧版别名:memories.no_memories_if_mcp_or_web_search。", }, { key: "memories.max_raw_memories_for_consolidation", type: "number", description: "为全局整合保留的近期原始记忆数上限。默认为 256,且上限为 4096。", }, { key: "memories.max_unused_days", type: "number", description: "记忆自上次使用后仍有资格参与整合的最大天数。默认为 30,并限制在 0-365 范围内。", }, { key: "memories.max_rollout_age_days", type: "number", description: "纳入记忆生成考虑范围的线程最大存续天数。默认为 30,并限制在 0-90 范围内。", }, { key: "memories.max_rollouts_per_startup", type: "number", description: "每次启动过程中处理的 rollout 候选项上限。默认为 16,且上限为 128。", }, { key: "memories.min_rollout_idle_hours", type: "number", description: "线程被纳入记忆生成考虑范围之前所需的最短空闲时间。默认为 6,并限制在 1-48 范围内。", }, { key: "memories.min_rate_limit_remaining_percent", type: "number", description: "开始生成记忆前,Codex 速率限制窗口所需的最低剩余百分比。默认为 25,并限制在 0-100 范围内。", }, { key: "memories.extract_model", type: "string", description: "用于逐线程记忆提取的可选模型覆盖项。", }, { key: "memories.consolidation_model", type: "string", description: "用于全局记忆整合的可选模型覆盖项。", }, { key: "features.unified_exec", type: "boolean", description: "使用由 PTY 支持的统一 exec 工具(稳定;除 Windows 外默认启用)。", }, { key: "features.shell_snapshot", type: "boolean", description: "对 shell 环境拍摄快照,以加快重复命令的执行速度(稳定;默认开启)。", }, { key: "features.multi_agent", type: "boolean", description: "启用多代理协作工具(spawn_agentsend_inputresume_agentwait_agentclose_agent)(稳定;默认开启)。", }, { key: "features.goals", type: "boolean", description: "启用持久化目标和自动继续(稳定;默认开启)。", }, { key: "features.remote_plugin", type: "boolean", description: "启用远程插件目录(稳定;默认开启)。", }, { key: "features.personality", type: "boolean", description: "启用个性选择控件(稳定;默认开启)。", }, { key: "features.network_proxy", type: "boolean | table", description: "为沙箱命令启动网络代理(实验性;默认关闭)。除非已启用且由管理员管理的 experimental_network 要求会启动代理,否则必须启用此项才能强制实施权限配置文件的域名规则。设置 domains 等功能级策略选项时,请使用表。不会筛选网络搜索、应用、MCP 或其他托管工具。", }, { key: "features.network_proxy.enabled", type: "boolean", description: "启用命令网络访问时,启动沙箱命令网络代理。默认为 false;代理关闭时,不会强制实施权限配置文件的域名规则。", }, { key: "features.network_proxy.domains", type: "map<string, allow | deny>", description: "沙箱网络的域名策略。默认未设置,这意味着在添加 allow 规则之前,不允许访问任何外部目标。支持精确主机、仅匹配子域名的 *.example.com、匹配根域名及其子域名的 **.example.com,以及全局 * 允许规则;请优先使用范围明确的规则,因为 * 会广泛开放公共出站访问。为被阻止的目标添加 deny 规则;发生冲突时,deny 优先。", }, { key: "features.network_proxy.unix_sockets", type: "map<string, allow | deny>", description: "沙箱网络的 Unix 套接字策略。默认未设置;为允许使用的套接字添加 allow 条目。", }, { key: "features.network_proxy.allow_local_binding", type: "boolean", description: "允许更广泛的本地/专用网络访问。默认为 false;精确的本地 IP 字面量或 localhost 允许规则仍可放行特定本地目标。", }, { key: "features.network_proxy.enable_socks5", type: "boolean", description: "开放 SOCKS5 支持。默认为 true。", }, { key: "features.network_proxy.enable_socks5_udp", type: "boolean", description: "允许通过 SOCKS5 使用 UDP。默认为 true。", }, { key: "features.network_proxy.allow_upstream_proxy", type: "boolean", description: "允许通过环境中的上游代理进行链式转发。默认为 true。", }, { key: "features.network_proxy.dangerously_allow_non_loopback_proxy", type: "boolean", description: "允许使用非环回监听地址。默认为 false;启用后可能会将代理监听器暴露到 localhost 之外。", }, { key: "features.network_proxy.dangerously_allow_all_unix_sockets", type: "boolean", description: "允许任意 Unix 套接字目标,而不是仅允许列表中的目标。默认为 false;仅在严格受控的环境中使用。", }, { key: "features.network_proxy.proxy_url", type: "string", description: '沙箱网络的 HTTP 监听器 URL。默认为 "http://127.0.0.1:3128"。', }, { key: "features.network_proxy.socks_url", type: "string", description: 'SOCKS5 监听器 URL。默认为 "http://127.0.0.1:8081"。', }, { key: "features.web_search", type: "boolean", description: "已弃用的旧版开关;请优先使用顶层 web_search 设置。", }, { key: "features.web_search_cached", type: "boolean", description: '已弃用的旧版开关。未设置 web_search 时,true 映射到 web_search = "cached"。', }, { key: "features.web_search_request", type: "boolean", description: '已弃用的旧版开关。未设置 web_search 时,true 映射到 web_search = "live"。', }, { key: "features.shell_tool", type: "boolean", description: "启用用于运行命令的默认 shell 工具(稳定;默认开启)。", }, { key: "features.enable_request_compression", type: "boolean", description: "在支持时使用 zstd 压缩流式请求正文(稳定;默认开启)。", }, { key: "features.skill_mcp_dependency_install", type: "boolean", description: "允许提示并安装技能缺失的 MCP 依赖项(稳定;默认开启)。", }, { key: "features.fast_mode", type: "boolean", description: "在 TUI 中启用模型目录服务层级选择,包括当前模型声明支持时的 Fast 层级命令(稳定;默认开启)。", }, { key: "features.prevent_idle_sleep", type: "boolean", description: "轮次正在运行时阻止计算机进入睡眠状态(实验性;默认关闭)。", }, { key: "suppress_unstable_features_warning", type: "boolean", description: "隐藏启用开发中功能标志时出现的警告。", }, { key: "model_providers.", type: "table", description: "自定义提供商定义。内置提供商 ID(openaiollamalmstudio)为保留 ID,无法覆盖。", }, { key: "model_providers..name", type: "string", description: "自定义模型提供商的显示名称。", }, { key: "model_providers..base_url", type: "string", description: "模型提供商的 API 基础 URL。", }, { key: "model_providers..env_key", type: "string", description: "提供商 API key 的环境变量。", }, { key: "model_providers..env_key_instructions", type: "string", description: "提供商 API key 的可选设置指引。", }, { key: "model_providers..experimental_bearer_token", type: "string", description: "直接用于提供商的 bearer token(不建议;请使用 env_key)。", }, { key: "model_providers..requires_openai_auth", type: "boolean", description: "提供商使用 OpenAI 身份验证(默认值为 false)。", }, { key: "model_providers..wire_api", type: "responses", description: "提供商使用的协议。responses 是唯一支持的值,省略时也以此为默认值。", }, { key: "model_providers..query_params", type: "map<string,string>", description: "追加到提供商请求的额外查询参数。", }, { key: "model_providers..http_headers", type: "map<string,string>", description: "添加到提供商请求的静态 HTTP 标头。", }, { key: "model_providers..env_http_headers", type: "map<string,string>", description: "存在相应环境变量时,从中填充的 HTTP 标头。", }, { key: "model_providers..request_max_retries", type: "number", description: "向提供商发送 HTTP 请求时的重试次数(默认值:4)。", }, { key: "model_providers..stream_max_retries", type: "number", description: "SSE 流中断时的重试次数(默认值:5)。", }, { key: "model_providers..stream_idle_timeout_ms", type: "number", description: "SSE 流的空闲超时(毫秒)(默认值:300000)。", }, { key: "model_providers..supports_websockets", type: "boolean", description: "该提供商是否支持 Responses API WebSocket 传输。", }, { key: "model_providers..supports_standalone_web_search", type: "boolean", description: "声明支持兼容的独立网络搜索端点(默认值:false)。独立搜索仍在开发中,且默认关闭;仅提供商兼容并不会启用它。", }, { key: "model_providers..auth", type: "table", description: "自定义提供商由命令支持的 bearer token 配置。请勿与 env_keyexperimental_bearer_tokenrequires_openai_auth 组合使用。", }, { key: "model_providers..auth.command", type: "string", description: "Codex 需要 bearer token 时运行的命令。该命令必须将 token 输出到 stdout。", }, { key: "model_providers..auth.args", type: "array", description: "传递给 token 命令的参数。", }, { key: "model_providers..auth.timeout_ms", type: "number", description: "token 命令的最长运行时间(毫秒)(默认值:5000)。", }, { key: "model_providers..auth.refresh_interval_ms", type: "number", description: "Codex 主动刷新 token 的时间间隔(毫秒)(默认值:300000)。设为 0 可仅在身份验证重试后刷新。", }, { key: "model_providers..auth.cwd", type: "string (path)", description: "token 命令的工作目录。", }, { key: "model_providers.amazon-bedrock.aws.profile", type: "string", description: "内置 amazon-bedrock 提供商使用的 AWS 配置文件名称。", }, { key: "model_providers.amazon-bedrock.aws.region", type: "string", description: "内置 amazon-bedrock 提供商使用的 AWS 区域。", }, { key: "model_reasoning_effort", type: "minimal | low | medium | high | xhigh", description: "调整受支持模型的推理强度(仅限 Responses API;xhigh 取决于模型)。", }, { key: "plan_mode_reasoning_effort", type: "none | minimal | low | medium | high | xhigh", description: "Plan 模式专用的推理强度覆盖项。未设置时,Plan 模式使用其内置预设默认值。", }, { key: "model_reasoning_summary", type: "auto | concise | detailed | none", description: "选择推理摘要的详细程度,或完全禁用摘要。", }, { key: "model_verbosity", type: "low | medium | high", description: "可选的 GPT-5 Responses API 详略程度覆盖项;未设置时,使用所选模型/预设的默认值。", }, { key: "model_supports_reasoning_summaries", type: "boolean", description: "强制 Codex 发送或不发送推理元数据。", }, { key: "shell_environment_policy.inherit", type: "all | core | none", description: "生成子进程时采用的基准环境继承策略。", }, { key: "shell_environment_policy.ignore_default_excludes", type: "boolean", description: "在运行其他筛选器前,保留名称中包含 KEY、SECRET 或 TOKEN 的变量(默认值:true)。设为 false 可应用自动的机密名称排除规则。", }, { key: "shell_environment_policy.filters", type: "map<string, include | exclude>", description: "规范的、不区分大小写的环境变量模式筛选器。include 条目会创建允许列表,且无法恢复已排除的值。显式的 set 值在排除后应用。请勿在同一配置层中将筛选器与旧版 excludeinclude_only 数组组合使用。", }, { key: "shell_environment_policy.exclude", type: "array", description: "旧版环境变量排除模式。新配置请使用 shell_environment_policy.filters;请勿在同一配置层中组合使用两种形式。", }, { key: "shell_environment_policy.include_only", type: "array", description: "旧版环境变量模式允许列表。新配置请使用 shell_environment_policy.filters;请勿在同一配置层中组合使用两种形式。", }, { key: "shell_environment_policy.set", type: "map<string,string>", description: "在排除后注入的显式环境值;include 筛选器仍可移除这些值。", }, { key: "shell_environment_policy.experimental_use_profile", type: "boolean", description: "生成子进程时使用用户 shell 配置文件。", }, { key: "project_root_markers", type: "array", description: "项目根目录标记文件名列表;用于在父目录中搜索项目根目录。", }, { key: "project_doc_max_bytes", type: "number", description: "构建项目说明时从 AGENTS.md 读取的最大字节数。", }, { key: "project_doc_fallback_filenames", type: "array", description: "缺少 AGENTS.md 时要尝试的其他文件名。", }, { key: "history.persistence", type: "save-all | none", description: "控制 Codex 是否将会话转录保存到 history.jsonl。", }, { key: "tool_output_token_limit", type: "number", description: "在历史记录中存储单个工具/函数输出的 token 预算。", }, { key: "background_terminal_max_timeout", type: "number", description: "空 write_stdin 轮询(后台终端轮询)的最大轮询窗口(毫秒)。默认值:300000(5 分钟)。替代旧版 background_terminal_timeout 键。", }, { key: "history.max_bytes", type: "number", description: "如有设置,则通过丢弃最早的条目来限制历史记录文件的字节大小。", }, { key: "file_opener", type: "vscode | vscode-insiders | windsurf | cursor | none", description: "用于打开 Codex 输出中引用内容的 URI 方案(默认值:vscode)。", }, { key: "otel.environment", type: "string", description: "应用于所发出 OpenTelemetry 事件的环境标签(默认值:dev)。", }, { key: "otel.exporter", type: "none | otlp-http | otlp-grpc", description: "选择 OpenTelemetry 导出器并提供所有端点元数据。", }, { key: "otel.trace_exporter", type: "none | otlp-http | otlp-grpc", description: "选择 OpenTelemetry 跟踪导出器并提供所有端点元数据。", }, { key: "otel.metrics_exporter", type: "none | statsig | otlp-http | otlp-grpc", description: "选择 OpenTelemetry 指标导出器(默认为 statsig)。", }, { key: "otel.log_user_prompt", type: "boolean", description: "选择通过 OpenTelemetry 日志导出原始用户提示词。", }, { key: "otel.exporter..endpoint", type: "string", description: "OTEL 日志的导出器端点。", }, { key: "otel.exporter..protocol", type: "binary | json", description: "OTLP/HTTP 导出器使用的协议。", }, { key: "otel.exporter..headers", type: "map<string,string>", description: "OTEL 导出器请求中包含的静态标头。", }, { key: "otel.trace_exporter..endpoint", type: "string", description: "OTEL 日志的跟踪导出器端点。", }, { key: "otel.trace_exporter..protocol", type: "binary | json", description: "OTLP/HTTP 跟踪导出器使用的协议。", }, { key: "otel.trace_exporter..headers", type: "map<string,string>", description: "OTEL 跟踪导出器请求中包含的静态标头。", }, { key: "otel.exporter..tls.ca-certificate", type: "string", description: "OTEL 导出器 TLS 的 CA 证书路径。", }, { key: "otel.exporter..tls.client-certificate", type: "string", description: "OTEL 导出器 TLS 的客户端证书路径。", }, { key: "otel.exporter..tls.client-private-key", type: "string", description: "OTEL 导出器 TLS 的客户端私钥路径。", }, { key: "otel.trace_exporter..tls.ca-certificate", type: "string", description: "OTEL 跟踪导出器 TLS 的 CA 证书路径。", }, { key: "otel.trace_exporter..tls.client-certificate", type: "string", description: "OTEL 跟踪导出器 TLS 的客户端证书路径。", }, { key: "otel.trace_exporter..tls.client-private-key", type: "string", description: "OTEL 跟踪导出器 TLS 的客户端私钥路径。", }, { key: "tui", type: "table", description: "TUI 专用选项,例如启用内联桌面通知。", }, { key: "tui.notifications", type: "boolean | array", description: "启用 TUI 通知;也可选择仅限特定事件类型。", }, { key: "tui.notification_method", type: "auto | osc9 | bel", description: "终端通知的通知方式(默认值:auto)。", }, { key: "tui.notification_condition", type: "unfocused | always", description: "控制 TUI 通知是仅在终端未聚焦时触发,还是无论焦点状态如何都触发。默认为 unfocused。", }, { key: "tui.animations", type: "boolean", description: "启用终端动画(欢迎屏幕、闪烁和加载指示器)(默认值:true)。", }, { key: "tui.alternate_screen", type: "auto | always | never", description: "控制 TUI 是否使用备用屏幕(默认值:auto;在 Zellij 中,auto 会跳过备用屏幕以保留回滚缓冲区)。", }, { key: "tui.resume_cwd", type: "current | session", description: "恢复或分叉会话时要使用的工作目录。未设置时,如果当前目录与会话保存的目录不同,Codex 会要求你选择。", }, { key: "tui.vim_mode_default", type: "boolean", description: "启动编辑器时进入 Vim 普通模式,而非插入模式(默认值:false)。你仍可使用 /vim 按会话切换。", }, { key: "tui.raw_output_mode", type: "boolean", description: "启动 TUI 时进入原始回滚模式,以便在终端中选择并复制内容(默认值:false)。你可以使用 /raw 或默认的 alt-r 键绑定切换此模式。", }, { key: "tui.show_tooltips", type: "boolean", description: "在 TUI 欢迎屏幕中显示新手引导工具提示(默认值:true)。", }, { key: "tui.status_line", type: "array | null", description: "TUI 页脚状态栏项目标识符的有序列表。null 会禁用状态栏。", }, { key: "tui.terminal_title", type: "array | null", description: '终端窗口/标签页标题项目标识符的有序列表。默认为 ["spinner", "project"]null 会禁用标题更新。', }, { key: "tui.theme", type: "string", description: "语法高亮主题覆盖项(使用 kebab-case 主题名称)。", }, { key: "tui.keymap..", type: "string | array", description: "TUI 操作的键盘快捷键绑定。支持的上下文包括 globalchatcomposereditorvim_normalvim_operatorvim_text_objectpagerlistapproval。选定的编辑器操作会回退到匹配的 tui.keymap.global 绑定;支持时,上下文专用绑定优先。", }, { key: "tui.keymap.. = []", type: "empty array", description: "在该键映射上下文中解除操作绑定。键名使用规范化字符串,例如 ctrl-ashift-enterpage-downminus。", }, { key: "plugins..mcp_servers..enabled", type: "boolean", description: "无需更改插件清单,即可启用或禁用已安装插件捆绑的 MCP 服务器。", }, { key: "plugins..mcp_servers..default_tools_approval_mode", type: "auto | prompt | writes | approve", description: "插件提供的 MCP 服务器上工具的默认批准行为。", }, { key: "plugins..mcp_servers..enabled_tools", type: "array", description: "插件提供的 MCP 服务器所暴露工具的允许列表。", }, { key: "plugins..mcp_servers..disabled_tools", type: "array", description: "在插件提供的 MCP 服务器的 enabled_tools 之后应用的拒绝列表。", }, { key: "plugins..mcp_servers..tools..approval_mode", type: "auto | prompt | writes | approve", description: "插件提供的单个 MCP 工具的逐工具批准行为覆盖项。", }, { key: "tui.model_availability_nux.", type: "integer", description: "以模型 slug 为键的内部启动工具提示状态。", }, { key: "hide_agent_reasoning", type: "boolean", description: "在 TUI 和 codex exec 输出中隐藏推理事件。", }, { key: "show_raw_agent_reasoning", type: "boolean", description: "当前模型发出原始推理内容时,将其显示出来。", }, { key: "disable_paste_burst", type: "boolean", description: "在 TUI 中禁用突发粘贴检测。", }, { key: "windows_wsl_setup_acknowledged", type: "boolean", description: "跟踪 Windows 新手引导确认状态(仅限 Windows)。", }, { key: "chatgpt_base_url", type: "string", description: "覆盖 ChatGPT 登录流程中使用的基础 URL。", }, { key: "cli_auth_credentials_store", type: "file | keyring | auto", description: "控制 CLI 存储缓存凭据的位置(基于文件的 auth.json 或操作系统钥匙串)。", }, { key: "mcp_oauth_credentials_store", type: "auto | file | keyring", description: "MCP OAuth 凭据的首选存储位置。", }, { key: "mcp_oauth_callback_port", type: "integer", description: "MCP OAuth 登录期间本地 HTTP 回调服务器使用的可选固定端口。未设置时,Codex 会绑定到操作系统选择的临时端口。", }, { key: "mcp_oauth_callback_url", type: "string", description: "MCP OAuth 登录的可选基础回调 URL 覆盖项(例如 devbox 入口 URL)。Codex 会先追加服务器专用的回调 ID,再发送最终 OAuth redirect_uri,因此请向提供商注册完整的派生 URI。mcp_oauth_callback_port 仍控制回调监听器端口。", }, { key: "experimental_use_unified_exec_tool", type: "boolean", description: "启用统一 exec 的旧版名称;请优先使用 [features].unified_execcodex --enable unified_exec。", }, { key: "tools.web_search", type: 'boolean | { context_size = "low|medium|high", allowed_domains = [string], location = { country, region, city, timezone } }', description: "可选的网络搜索工具配置。对象形式可设置搜索上下文大小、允许搜索的域名和大致用户位置。这些搜索域名筛选器独立于沙箱命令网络域名规则,不会限制连接器或 MCP 服务器。", }, { key: "tools.view_image", type: "boolean", description: "启用本地图片附件工具 view_image。", }, { key: "web_search", type: "disabled | cached | indexed | live", description: '网络搜索模式(默认值:"cached";cached 使用 OpenAI 维护的索引,不访问外部网络;indexed 仅在搜索索引允许时访问外部网络;如果使用 --yolo 或其他完全访问沙箱设置,则默认为 "live")。使用 "live" 可进行不受限制的实时检索,使用 "disabled" 可移除该工具。', }, { key: "default_permissions", type: "string", description: "要应用于沙箱工具调用的默认权限配置文件名称。内置配置文件包括 :read-only:workspace:danger-full-access;自定义配置文件名称需要匹配的 [permissions.<name>] 表。请勿与 sandbox_mode[sandbox_workspace_write] 组合使用。", }, { key: "permissions..description", type: "string", description: "此命名配置文件的可读描述。配置文件不会通过 extends 继承父配置文件的描述。", }, { key: "permissions..extends", type: "string", description: "在此命名配置文件之前应用的可选父配置文件。将其设置为另一个命名配置文件、:read-only:workspace:danger-full-access、未定义的父配置文件和循环依赖会被拒绝。", }, { key: "permissions..workspace_roots", type: "table", description: "配置文件定义的工作区根目录,会与会话的运行时工作区根目录一起接收 :workspace_roots 文件系统规则。", }, { key: "permissions..workspace_roots.", type: "boolean", description: "设为 true 时,将路径加入配置文件的工作区根目录集。已禁用的条目保持非活动状态。", }, { key: "permissions..filesystem", type: "table", description: "命名的文件系统权限配置文件。每个键都是绝对路径或 :minimal:workspace_roots 等特殊 token。", }, { key: "permissions..filesystem.glob_scan_max_depth", type: "number", description: "在沙箱启动前对匹配项拍摄快照的平台上,展开拒绝读取 glob 模式时的最大深度。设置时必须至少为 1。", }, { key: "permissions..filesystem.", type: '"read" | "write" | "deny" | table', description: '授予对路径、glob 模式或特殊 token 的直接访问权限,或限定该根目录下的嵌套条目范围。使用 "deny" 可拒绝读取匹配路径。', }, { key: 'permissions..filesystem.":workspace_roots".', type: '"read" | "write" | "deny"', description: '相对于每个有效工作区根目录限定范围的文件系统访问权限。使用 "." 表示根目录本身;"**/*.env" 等 glob 子路径可通过 "deny" 拒绝读取。', }, { key: "permissions..network.enabled", type: "boolean", description: "为此权限配置文件中的命令启用网络访问。此设置不会启动网络代理。如果没有 features.network_proxy 或已启用且由管理员管理的网络要求,命令会直接访问网络,且不会强制实施配置文件域名规则。", }, { key: "permissions..network.proxy_url", type: "string", description: "此权限配置文件启用沙箱网络时使用的 HTTP 监听器 URL。", }, { key: "permissions..network.enable_socks5", type: "boolean", description: "此权限配置文件启用沙箱网络时开放 SOCKS5 支持。", }, { key: "permissions..network.socks_url", type: "string", description: "此权限配置文件使用的 SOCKS5 代理端点。", }, { key: "permissions..network.enable_socks5_udp", type: "boolean", description: "启用时,允许通过 SOCKS5 监听器使用 UDP。", }, { key: "permissions..network.allow_upstream_proxy", type: "boolean", description: "允许沙箱网络通过其他上游代理进行链式转发。", }, { key: "permissions..network.dangerously_allow_non_loopback_proxy", type: "boolean", description: "允许沙箱网络监听器使用非环回绑定地址。启用后可能会将监听器暴露到 localhost 之外。", }, { key: "permissions..network.dangerously_allow_all_unix_sockets", type: "boolean", description: "允许任意 Unix 套接字目标,而不是默认的受限集合。仅在严格受控的环境中使用。", }, { key: "permissions..network.mode", type: "limited | full", description: "用于子进程流量的网络代理模式。", }, { key: "permissions..network.domains", type: "table", description: "沙箱命令的域名规则。仅当 features.network_proxy 或已启用且由管理员管理的网络要求激活代理时,才会强制实施。支持精确主机、*.example.com**.example.com 和全局 * 允许规则;deny 优先。不会限制网络搜索、应用或 MCP 服务器。", }, { key: "permissions..network.domains.", type: "allow | deny", description: "允许或拒绝精确主机,或 *.example.com**.example.com 等限定范围的通配符模式。", }, { key: "permissions..network.unix_sockets", type: "table", description: "沙箱网络的 Unix 套接字允许列表覆盖项。使用套接字路径作为键;allow 添加路径,deny 拒绝路径。", }, { key: "permissions..network.unix_sockets.", type: "allow | deny", description: "使用 allow 将绝对 Unix 套接字路径添加到有效允许列表,或使用 deny 拒绝该路径。被拒绝的条目不会包含在有效允许列表中。", }, { key: "permissions..network.allow_local_binding", type: "boolean", description: "允许通过沙箱网络进行更广泛的本地/专用网络访问。当此项保持为 false 时,精确的本地 IP 字面量或 localhost 允许规则仍可放行特定本地目标。", }, { key: "projects..trust_level", type: "string", description: '将项目或工作树标记为可信或不可信("trusted" | "untrusted")。不可信项目会跳过项目范围的 .codex/ 配置层,包括项目本地配置、钩子和规则。', }, { key: "notice.hide_full_access_warning", type: "boolean", description: "跟踪对完全访问警告提示的确认状态。", }, { key: "notice.hide_world_writable_warning", type: "boolean", description: "跟踪对 Windows 全局可写目录警告的确认状态。", }, { key: "notice.hide_rate_limit_model_nudge", type: "boolean", description: "跟踪是否选择不再显示速率限制模型切换提醒。", }, { key: "notice.hide_gpt5_1_migration_prompt", type: "boolean", description: "跟踪对 GPT-5.1 迁移提示的确认状态。", }, { key: "notice.hide_gpt-5.1-codex-max_migration_prompt", type: "boolean", description: "跟踪对 gpt-5.1-codex-max 迁移提示的确认状态。", }, { key: "notice.model_migrations", type: "map<string,string>", description: "以旧模型到新模型映射的形式跟踪已确认的模型迁移。", }, { key: "forced_login_method", type: "chatgpt | api", description: "限制 Codex 只能使用特定身份验证方法。", }, { key: "forced_chatgpt_workspace_id", type: "string (uuid)", description: "限制 ChatGPT 只能登录到特定工作区标识符。", }, ]} client:load />

你可以在此处找到 config.toml 的最新 JSON 架构。

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

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

注意:将 experimental_instructions_file 重命名为 model_instructions_file。Codex 已弃用旧键;请将现有配置更新为新名称。

requirements.toml

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

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

requirements.toml 中使用 [features],通过与 config.toml 所用相同的 规范键固定运行时功能标志。要求还可以包含不属于 config.toml 的、已有文档说明的 仅限应用的键。未指定的键不受 约束。

某些托管要求会强制执行精确的配置值,而不是 允许列表。用户无法覆盖强制执行的路径、更新偏好设置、登录 shell 策略、反馈设置或 Windows 私有桌面设置。

托管权限配置文件允许列表要求 Codex 0.138.0 或更高版本。Codex 0.137.0 及更早版本会忽略 allowed_permission_profiles 和托管的 default_permissions

allowed_sandbox_modessandbox_mode 搭配使用。对于权限配置文件 部署,请将 allowed_permission_profiles 与托管的 default_permissions 搭配使用。

[models.new_thread] 表提供托管默认值,而非强制执行值。 通过专用 CLI 标志或 --config 覆盖显式指定的启动选项具有更高 优先级。显式的模型或推理强度覆盖会跳过两个托管 模型字段;service_tier 与它们相互独立。

<ConfigTable options={[ { key: "sqlite_home", type: "string (path)", description: "强制指定 Codex 存储 SQLite 后端运行时状态的目录。", }, { key: "log_dir", type: "string (path)", description: "强制指定 Codex 写入本地日志文件的目录。", }, { key: "model_catalog_json", type: "string (path)", description: "强制指定 Codex 启动时使用的 JSON 模型目录。", }, { key: "check_for_update_on_startup", type: "boolean", description: "强制指定 Codex 启动时是否检查更新。", }, { key: "allow_login_shell", type: "boolean", description: "强制指定 shell 工具是否可以启动登录 shell。", }, { key: "feedback", type: "table", description: "托管反馈设置。", }, { key: "feedback.enabled", type: "boolean", description: "强制指定用户能否在各 Codex 客户端中提交反馈。", }, { key: "allowed_approval_policies", type: "array", description: "approval_policy 的允许值(例如 untrustedon-requestnevergranular)。", }, { key: "allowed_approvals_reviewers", type: "array", description: "approvals_reviewer 的允许值,例如 userauto_review。", }, { key: "guardian_policy_config", type: "string", description: "用于自动审查的托管 Markdown 策略说明。其优先级高于本地 [auto_review].policy。空值会被忽略。", }, { key: "allowed_permission_profiles", type: "table", description: "允许的权限配置文件完整列表。设为 true 的配置文件会被允许。省略或设为 false 的配置文件会被拒绝,包括未来版本中新增的配置文件。组合多个要求来源时,条目按配置文件名称匹配。", }, { key: "allowed_permission_profiles.", type: "boolean", description: "允许或拒绝已加载配置或要求来源中定义的内置或自定义权限配置文件。优先级更高的后续要求来源可以使用 false,关闭优先级较低的先前来源所允许的配置文件。", }, { key: "default_permissions", type: "string", description: "托管的默认权限配置文件。该配置文件必须由 allowed_permission_profiles 允许。请显式设置此项以确保行为可预测;如果省略,只有在 :workspace:read-only 均被显式允许时,Codex 才会默认为 :workspace。", }, { key: "enforce_residency", type: "string", description: "要求 Codex 服务流量使用受支持的数据驻留区域。目前接受 us。", }, { key: "models", type: "table", description: "新线程的托管模型默认值。这些值的优先级高于用户和项目默认值,但新线程的显式选择可以覆盖它们。", }, { key: "models.new_thread", type: "table", description: "启动新的本地线程时应用的默认值。每项模型设置均为可选。", }, { key: "models.new_thread.model", type: "string", description: "新线程的默认模型。显式的 --model 或模型/推理 --config 覆盖具有更高优先级。", }, { key: "models.new_thread.model_reasoning_effort", type: "string", description: "新线程的默认推理强度。显式的模型或推理强度覆盖会跳过两个托管模型字段。", }, { key: "models.new_thread.service_tier", type: "string", description: "新线程的默认服务层级。显式的服务层级覆盖具有更高优先级,并且独立于模型字段。", }, { key: "permissions", type: "table", description: "由管理员定义并以配置文件名称为键的权限配置文件。使用与 config.toml 相同的配置文件字段。", }, { key: "permissions.", type: "table", description: "管理员定义的权限配置文件。名称不能以 : 开头、使用保留名称 filesystem,也不能与已加载配置中的配置文件重名。使用与 config.toml 相同的配置文件字段;完整的配置文件架构请参阅权限指南。", }, { key: "allowed_sandbox_modes", type: "array", description: "sandbox_mode 的允许值。", }, { key: "windows", type: "table", description: "原生 Windows 沙箱要求。", }, { key: "windows.allowed_sandbox_implementations", type: "array", description: "windows.sandbox 的允许原生 Windows 沙箱实现(elevatedunelevated)。列表不得为空。如果两者均被允许且未选择模式,Codex 会优先使用 elevated。", }, { key: "windows.sandbox_private_desktop", type: "boolean", description: "强制指定原生 Windows 沙箱是否在私有桌面上启动其子进程。", }, { key: "remote_sandbox_config", type: "array

", description: "特定于主机的沙箱要求。第一个 hostname_patterns 与解析后的主机名匹配的条目,会覆盖该要求来源的顶层 allowed_sandbox_modes。特定于主机的条目目前仅覆盖沙箱模式。", }, { key: "remote_sandbox_config[].hostname_patterns", type: "array", description: "不区分大小写的主机名模式。支持使用 * 匹配任意字符序列,并使用 ? 匹配单个字符。", }, { key: "remote_sandbox_config[].allowed_sandbox_modes", type: "array", description: "此特定于主机的条目匹配时要应用的允许沙箱模式。", }, { key: "allowed_web_search_modes", type: "array", description: "web_search 的允许值(disabledcachedindexedlive)。disabled 始终被允许;空列表实际上只允许 disabled。", }, { key: "allow_managed_hooks_only", type: "boolean", description: "设为 true 时,Codex 会跳过用户、项目、会话和插件钩子,同时仍允许来自 requirements.toml 及其他托管配置层的托管钩子。", }, { key: "allow_appshots", type: "boolean", description: "设为 false 可为托管用户禁用 Appshots。如果省略,Appshots 不受要求约束,并遵循正常的产品可用性。", }, { key: "allow_remote_control", type: "boolean", description: "设为 false 可为托管用户禁用设备远程控制。如果省略,设备远程控制不受要求约束,并遵循正常的产品可用性。", }, { key: "features.plugin_sharing", type: "boolean", description: "在云端托管的 requirements.toml 中设为 false,可禁止在工作区中共享本地构建的插件。", }, { key: "features", type: "table", description: "固定的功能值。运行时功能应使用 config.toml 中的规范名称;此处也支持已有文档说明的仅限应用的要求键。", }, { key: "features.", type: "boolean", description: "要求已有文档说明的运行时或应用功能保持启用或禁用。", }, { key: "features.apps", type: "boolean", description: "为托管用户固定 Apps 集成的可用状态。", }, { key: "features.in_app_updates", type: "boolean", description: "在 requirements.toml 中设为 false 可禁用应用内更新。如果省略此要求,更新默认保持启用。", }, { key: "features.in_app_browser", type: "boolean", description: "在 requirements.toml 中设为 false 可禁用内置浏览器窗格。", }, { key: "features.browser_use", type: "boolean", description: "在 requirements.toml 中设为 false 可禁用浏览器中的 Computer Use 以及 Browser Agent 可用性。", }, { key: "features.browser_use_external", type: "boolean", description: "在 requirements.toml 中设为 false 可禁用外部浏览器中的 Computer Use。", }, { key: "features.browser_use_full_cdp_access", type: "boolean", description: "在 requirements.toml 中设为 false,可禁用本地运行时中的完整 Chrome DevTools Protocol 访问权限(包括 Browser Developer 模式),并阻止 ChatGPT 桌面应用启用相应设置。如果省略,则遵循正常的产品可用性。", }, { key: "features.fast_mode", type: "boolean", description: "为托管用户固定规范 fast_mode 功能的开关状态。", }, { key: "features.guardian_approval", type: "boolean", description: "为托管用户固定 Guardian 审批的可用状态。", }, { key: "features.memories", type: "boolean", description: "为托管用户固定 Memories 的可用状态。", }, { key: "features.multi_agent", type: "boolean", description: "为托管用户固定多智能体功能的可用状态。", }, { key: "features.plugins", type: "boolean", description: "为托管用户固定插件的可用状态。", }, { key: "features.remote_plugin", type: "boolean", description: "为托管用户固定远程插件目录的可用状态。", }, { key: "features.computer_use", type: "boolean", description: "在 requirements.toml 中设为 false,可禁用 Computer Use、Record & Replay 及相关的安装或启用流程。", }, { key: "features.workspace_dependencies", type: "boolean", description: "为托管用户固定内置工作区依赖项运行时的可用状态。", }, { key: "computer_use", type: "table", description: "通过 requirements.toml 强制执行的 Computer Use 要求。", }, { key: "computer_use.allow_locked_computer_use", type: "boolean", description: "设为 false 可阻止 Computer Use 在托管 macOS 设备锁定后继续操作。如果省略,锁定后的使用不受要求约束。", }, { key: "experimental_network", type: "table", description: "由管理员管理、针对沙箱内本地命令的网络要求,通过 requirements.toml 强制执行。启用后,这些要求无需 features.network_proxy 即可启动命令网络代理。它们不控制网页搜索、应用、MCP 服务器、浏览器或 Codex 云端网络。", }, { key: "experimental_network.enabled", type: "boolean", description: "启用沙箱网络要求。如果活动沙箱仍关闭命令网络,此设置不会授予网络访问权限。", }, { key: "experimental_network.http_port", type: "integer", description: "用于 [experimental_network] 要求的环回 HTTP 监听端口。", }, { key: "experimental_network.socks_port", type: "integer", description: "用于 [experimental_network] 要求的环回 SOCKS5 监听端口。", }, { key: "experimental_network.allow_upstream_proxy", type: "boolean", description: "允许沙箱网络通过环境中的上游代理进行链式连接。", }, { key: "experimental_network.dangerously_allow_non_loopback_proxy", type: "boolean", description: "允许 [experimental_network] 要求使用非环回监听地址。启用此项可能会将监听器暴露到 localhost 之外。", }, { key: "experimental_network.dangerously_allow_all_unix_sockets", type: "boolean", description: "允许访问任意 Unix 套接字目标,而不再仅限允许列表。仅在严格受控的环境中使用。", }, { key: "experimental_network.domains", type: "map<string, allow | deny>", description: "用于沙箱网络的映射形式管理员域名策略。支持精确主机、仅匹配子域名的 *.example.com、匹配根域名及子域名的 **.example.com,以及全局 * 允许规则;请优先使用范围明确的规则,因为 * 会广泛开放公共出站访问。发生冲突时 deny 优先。请勿与 experimental_network.allowed_domainsexperimental_network.denied_domains 组合使用。", }, { key: "experimental_network.allowed_domains", type: "array", description: "托管网络代理启用时,针对沙箱命令网络的管理员允许规则。这些规则不适用于网页搜索、应用或 MCP 服务器。请勿与 experimental_network.domains 组合使用。", }, { key: "experimental_network.denied_domains", type: "array", description: "用于沙箱网络的列表形式管理员拒绝规则。请勿与 experimental_network.domains 组合使用。", }, { key: "experimental_network.managed_allowed_domains_only", type: "boolean", description: "设为 true 时,在沙箱网络要求生效期间,只有管理员管理的允许规则有效;用户添加的允许列表条目会被忽略。如果没有托管允许规则,用户添加的域名允许规则也不会继续生效。", }, { key: "experimental_network.unix_sockets", type: "map<string, allow | deny>", description: "由管理员管理、用于沙箱网络的 Unix 套接字策略。", }, { key: "experimental_network.allow_local_binding", type: "boolean", description: "允许沙箱网络更广泛地访问本地/专用网络。即使此项保持为 false,精确的本地 IP 字面量或 localhost 允许规则仍可允许访问特定本地目标。", }, { key: "hooks", type: "table", description: "由管理员强制执行的托管生命周期钩子。需要托管钩子目录,并使用与 config.toml 中内联 [hooks] 相同的事件架构。", }, { key: "hooks.managed_dir", type: "string (absolute path)", description: "macOS 和 Linux 上包含托管钩子脚本的目录。Codex 会在加载托管钩子前验证该路径是绝对路径且确实存在。", }, { key: "hooks.windows_managed_dir", type: "string (absolute path)", description: "Windows 上包含托管钩子脚本的目录。Codex 会在加载托管钩子前验证该路径是绝对路径且确实存在。", }, { key: "hooks.", type: "array
", description: "钩子事件的匹配器组,例如 PreToolUsePermissionRequestPostToolUsePreCompactPostCompactSessionStartSessionEndSubagentStartSubagentStopUserPromptSubmitStop。", }, { key: "hooks.[].hooks", type: "array
", description: "匹配器组的钩子处理程序。目前支持命令钩子;提示和智能体钩子处理程序会被解析,但会跳过执行。", }, { key: "hooks.[].hooks[].async", type: "boolean", description: "在后台运行命令钩子,不延迟触发该钩子的操作。默认为 falseSessionEnd 始终同步运行。请参阅在后台运行钩子。", }, { key: "hooks.[].hooks[].commandWindows", type: "string", description: "仅适用于 Windows 的命令钩子命令覆盖。也接受 TOML 别名 command_windows。", }, { key: "permissions.filesystem.deny_read", type: "array", description: "由管理员强制执行的文件系统读取拒绝规则。条目可以是路径或 glob 模式,用户无法通过本地配置削弱这些规则。", }, { key: "mcp_servers", type: "table", description: "可启用的 MCP 服务器允许列表。必须同时匹配服务器名称(<id>)及其身份,才能启用 MCP 服务器。任何不在允许列表中(或身份不匹配)的已配置 MCP 服务器都会被禁用。", }, { key: "mcp_servers..identity", type: "table", description: "单个 MCP 服务器的身份规则。设置 command(stdio)或 url(可流式传输的 HTTP)之一。", }, { key: "mcp_servers..identity.command", type: "string | table", description: "通过精确的命令字符串允许 MCP stdio 服务器,或使用匹配器表要求可执行文件完全匹配且参数匹配器顺序一致。字符串形式不检查参数、cwdenvenv_vars。", }, { key: "mcp_servers..identity.command.executable", type: "string", description: "stdio 服务器所配置的 command 必须精确匹配的可执行文件。", }, { key: "mcp_servers..identity.command.args", type: "array
", description: "stdio 服务器的有序参数匹配器。配置的参数列表必须长度相同,并且每个位置都必须匹配。命令匹配器不检查 cwdenvenv_vars。", }, { key: "mcp_servers..identity.command.args[].match", type: "exact | prefix | regex", description: "此参数位置的匹配操作。", }, { key: "mcp_servers..identity.command.args[].value", type: "string", description: "exactprefix 参数匹配器使用的值。", }, { key: "mcp_servers..identity.command.args[].expression", type: "string", description: "regex 参数匹配器使用的正则表达式。该表达式必须有效,并与完整的参数值匹配。", }, { key: "mcp_servers..identity.url", type: "string | table", description: "通过精确的 URL 字符串允许可流式传输的 HTTP MCP 服务器,或使用 exactprefixregex 值匹配器表。", }, { key: "mcp_servers..identity.url.match", type: "exact | prefix | regex", description: "已配置 MCP 服务器 URL 的匹配操作。", }, { key: "mcp_servers..identity.url.value", type: "string", description: "exactprefix URL 匹配器使用的值。", }, { key: "mcp_servers..identity.url.expression", type: "string", description: "regex URL 匹配器使用的正则表达式。该表达式必须有效,并与完整的 URL 值匹配。", }, { key: "plugins", type: "table", description: "以插件标识符为键的插件专用 MCP 服务器允许列表。存在此表时,没有匹配插件和服务器条目的插件内置服务器会被禁用。", }, { key: "plugins..mcp_servers", type: "table", description: "一个插件内置 MCP 服务器的允许列表。插件服务器要求使用与顶层 mcp_servers 要求相同的精确身份和匹配器形式。", }, { key: "plugins..mcp_servers..identity", type: "table", description: "一个插件内置 MCP 服务器的身份规则。设置 command(stdio)或 url(可流式传输的 HTTP)之一。", }, { key: "plugins..mcp_servers..identity.command", type: "string | table", description: "通过精确的命令字符串允许插件的 stdio MCP 服务器,或使用匹配器表要求可执行文件完全匹配且参数匹配器顺序一致。", }, { key: "plugins..mcp_servers..identity.command.executable", type: "string", description: "插件内置 stdio 服务器所配置的命令必须精确匹配的可执行文件。", }, { key: "plugins..mcp_servers..identity.command.args", type: "array
", description: "插件内置 stdio 服务器的有序参数匹配器。配置的参数列表必须长度相同,并且每个位置都必须匹配。", }, { key: "plugins..mcp_servers..identity.command.args[].match", type: "exact | prefix | regex", description: "此参数位置的匹配操作。", }, { key: "plugins..mcp_servers..identity.command.args[].value", type: "string", description: "exactprefix 参数匹配器使用的值。", }, { key: "plugins..mcp_servers..identity.command.args[].expression", type: "string", description: "regex 参数匹配器使用的正则表达式。该表达式必须与完整的参数值匹配。", }, { key: "plugins..mcp_servers..identity.url", type: "string | table", description: "通过精确的 URL 字符串允许插件的可流式传输 HTTP MCP 服务器,或使用 exactprefixregex 值匹配器表。", }, { key: "plugins..mcp_servers..identity.url.match", type: "exact | prefix | regex", description: "插件内置 MCP 服务器 URL 的匹配操作。", }, { key: "plugins..mcp_servers..identity.url.value", type: "string", description: "exactprefix URL 匹配器使用的值。", }, { key: "plugins..mcp_servers..identity.url.expression", type: "string", description: "regex URL 匹配器使用的正则表达式。该表达式必须与完整的 URL 值匹配。", }, { key: "marketplaces", type: "table", description: "插件市场来源的管理员要求。当 restrict_to_allowed_sourcestrue 时,规则生效。", }, { key: "marketplaces.restrict_to_allowed_sources", type: "boolean", description: "设为 true 时,要求用户配置的市场来源在添加市场、安装插件以及刷新已配置 Git 市场时与 allowed_sources 匹配。当 Codex 管理的 OpenAI 市场与其保留来源和名称匹配时,仍会被允许。此设置不会在运行时筛选已配置的用户市场。", }, { key: "marketplaces.allowed_sources", type: "table", description: "以管理员选定的规则名称为键的允许市场来源。不同名称的规则会跨要求层累积;同一名称下的字段采用正常的层优先级。", }, { key: "marketplaces.allowed_sources.", type: "table", description: "一条允许来源规则。要求合并后的最终 source 值决定 Codex 如何解释同级字段。", }, { key: "marketplaces.allowed_sources..source", type: "git | host_pattern | local", description: "市场来源匹配器类型。使用 git 匹配一个仓库,使用 host_pattern 匹配正则表达式指定的 Git 主机,或使用 local 匹配一个目录。", }, { key: "marketplaces.allowed_sources..url", type: "string", description: '使用 source = "git" 时必须提供 Git 仓库 URL。Codex 会先规范化配置的 URL 和允许的 URL,再要求仓库精确匹配。', }, { key: "marketplaces.allowed_sources..ref", type: "string", description: "git 规则可选的精确 Git ref。省略时,该规则允许匹配仓库的任意 ref。", }, { key: "marketplaces.allowed_sources..host_pattern", type: "string", description: '使用 source = "host_pattern" 时必须提供正则表达式。Codex 会将其与从 HTTPS、SSH 或 SCP 样式 Git 来源解析出的全小写主机名进行匹配。使用 ^$ 可要求匹配完整主机名。', }, { key: "marketplaces.allowed_sources..path", type: "string (absolute path)", description: '使用 source = "local" 时必须提供本地市场目录。Codex 要求使用绝对路径,并在规范化后比较路径。', }, { key: "apps", type: "table", description: "以应用标识符为键的托管应用要求。要求可以禁用应用,也可以约束各工具的审批行为。", }, { key: "apps..enabled", type: "boolean", description: "设为 false 可禁用应用。合并多个要求来源时,禁用要求仍保持限制作用。", }, { key: "apps..tools..approval_mode", type: "auto | prompt | writes | approve", description: "设置一个应用工具的托管审批模式。", }, { key: "rules", type: "table", description: "与 .rules 文件合并的管理员强制执行命令规则。要求规则必须具有限制性。", }, { key: "rules.prefix_rules", type: "array
", description: "强制执行的前缀规则列表。每条规则都必须包含 patterndecision。", }, { key: "rules.prefix_rules[].pattern", type: "array
", description: "以模式标记表示的命令前缀。每个标记设置 tokenany_of 之一。", }, { key: "rules.prefix_rules[].pattern[].token", type: "string", description: "此位置的单个字面标记。", }, { key: "rules.prefix_rules[].pattern[].any_of", type: "array", description: "此位置允许的备选标记列表。", }, { key: "rules.prefix_rules[].decision", type: "prompt | forbidden", description: "必填。要求规则只能提示或禁止(不能允许)。", }, { key: "rules.prefix_rules[].justification", type: "string", description: "可选的非空理由,会显示在审批提示或拒绝消息中。", }, ]} client:load />