Skip to content

配置到 Codex CLI 中

Updated: 2026-06-11

本文说明如何将 Codex CLI 接入 Cubicspaces 的 OpenAI Responses 兼容接口。

开始前请先在 Cubicspaces 控制台获取:

  • API Key
  • API 端点

Codex 的 base_url 默认可使用:

text
https://cubicspaces.cloud/v1

如果控制台的 Use Key / 导出配置弹窗展示了专用 API 端点,请以弹窗展示为准。


配置文件

Codex 需要两个配置文件:

  • config.toml
  • auth.json

macOS / Linux / WSL 路径:

text
~/.codex/config.toml
~/.codex/auth.json

Windows 路径:

text
%USERPROFILE%\.codex\config.toml
%USERPROFILE%\.codex\auth.json

macOS / Linux 可先执行 mkdir -p ~/.codex 创建目录。Windows 可按 Win+R 输入 %USERPROFILE%\.codex 打开配置目录,如果不存在则先创建。


config.toml

toml
model_provider = "OpenAI"
model = "gpt-5.5"
review_model = "gpt-5.5"
model_reasoning_effort = "high"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://cubicspaces.cloud/v1"
wire_api = "responses"
requires_openai_auth = true

modelreview_model 请替换为你的账户可用且适合代码任务的模型。


auth.json

json
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}

检查项

  • 确认 auth.json 中填写的是 Cubicspaces API Key。
  • 确认 base_url 填的是 API 端点,不是控制台页面地址。
  • Codex 使用 OpenAI 兼容接口时,base_url 通常需要包含 /v1
  • 修改配置后重启终端会话。
  • 如果本机存在旧环境变量,可能会覆盖 auth.json