Skip to content
编程工具

Codex CLI ​

在 ~/.codex/config.toml 中把 ThetaIO 配置为自定义模型提供方。适用于 OpenAI 与 Grok 分组,其他分组经协议转换同样可用。

1. 设置 Key ​

Key 放在环境变量里,配置文件只写变量名:

bash
export THETAIO_API_KEY="sk-..."
powershell
$env:THETAIO_API_KEY="sk-..."

2. 写入 config.toml ​

路径为 ~/.codex/config.toml(Windows 为 %USERPROFILE%\.codex\config.toml)。Base URL 带 /v1。

toml
model_provider = "thetaio"
model = "gpt-5.5"
review_model = "gpt-5.5"
disable_response_storage = true

[model_providers.thetaio]
name = "ThetaIO"
base_url = "https://api.thetaio.tech/v1"
env_key = "THETAIO_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false
字段说明
env_key读取 Key 的环境变量名,不是 Key 本身。
wire_api固定为 responses。
requires_openai_auth设为 false,不需要 ChatGPT 登录。
supports_websockets设为 false,使用 HTTP/SSE 传输。

3. 切换模型 ​

把 model 改成分组内可用的模型 ID,例如 gpt-5.3-codex 或 grok-4.5。可用列表见 Models。

验证 ​

bash
codex exec "回复 ok"

不要把 Key 写进配置文件

experimental_bearer_token 可以直接写 Key,但会把密钥明文留在磁盘上,且不要与 env_key 同时使用。