Skip to content

Codex Cli 配置教程

一、打开配置目录

Codex 的配置目录为 .codex,位于用户主目录下。请根据你的系统打开它:

text
按下键盘 Win + R,输入以下内容后回车:

%userprofile%\.codex
bash
# 方式一:终端直接打开
open ~/.codex

# 方式二:Finder 中按 Cmd + Shift + G,输入 ~/.codex 回车
bash
# 终端进入配置目录
cd ~/.codex

# 如需图形界面打开(以 GNOME 为例)
xdg-open ~/.codex

打开后可看到目录内容。如果目录中没有 config.toml / auth.json,需要手动创建后打开。

TIP

如果 .codex 目录还不存在,先在终端运行一次 codex 让其自动生成,或手动创建该目录。

二、编辑 config.toml

config.toml 是核心配置文件,用于配置 API 地址、使用的模型,以及推理深度之类的功能。

将以下内容写入 config.toml

toml
model_provider = "cctq_codex"
model = "gpt-5.6-sol"
plan_mode_reasoning_effort = "xhigh"
model_reasoning_effort = "high"
disable_response_storage = true
supports_websockets = false

[model_providers.cctq_codex]
name = "cctq_codex"
base_url = "https://www.cctq.ai/v1"
wire_api = "responses"
requires_openai_auth = true
  • base_url:中转站请求地址,填 https://www.cctq.ai/v1必须以 /v1 结尾)。
  • model:使用的模型,按需填写。

三、编辑 auth.json

auth.json 用于配置你的 API Key。将以下内容写入 auth.json

json
{
  "OPENAI_API_KEY": "sk-***"
}
  • OPENAI_API_KEY:你的令牌,把 sk-*** 换成实际的 Key。

保存后重新打开终端,运行 codex 即可使用。