Codex 配置
将 API 密钥配置到 Codex。默认模型为 gpt-5.6-sol,代码审查模型为 codex-auto-review。
配置文件路径
Section titled “配置文件路径”| 系统 | config.toml 路径 |
|---|---|
| macOS / Linux | ~/.codex/config.toml |
| Windows | %USERPROFILE%\.codex\config.toml |
如果文件中已有这些字段,请谨慎合并,避免覆盖其他自定义配置。
config.toml
Section titled “config.toml”model_provider = "newapi"model = "gpt-5.6-sol"review_model = "codex-auto-review"model_reasoning_effort = "xhigh"disable_response_storage = truewindows_wsl_setup_acknowledged = true
[model_providers.newapi]name = "New API"base_url = "https://ai.j1ao.vip/v1"wire_api = "responses"requires_openai_auth = true
[sandbox_workspace_write]network_access = true
[features]goals = trueAPI 密钥
Section titled “API 密钥”如果 auth.json 不存在,请创建该文件并妥善保管。
| 系统 | auth.json 路径 |
|---|---|
| macOS / Linux | ~/.codex/auth.json |
| Windows | %USERPROFILE%\.codex\auth.json |
{ "OPENAI_API_KEY": "sk-your-rex-key"}model_providers属于用户级配置,请写入用户目录下的config.toml,不要写入项目内的.codex/config.toml。base_url必须包含/v1,wire_api使用responses。- 不要将
auth.json或真实 API Key 提交到 Git 仓库。

