Skip to content

Codex CLI 接入

Codex 通过 ~/.codex/config.toml 指定模型服务商指向 NoCannoBB 中转站。

最省事的方式

登录 hub.nocannobb.comAPI 密钥 → 点击密钥右侧 使用,控制台会生成已填好你密钥的完整配置。以下为手动配置说明。

前提

  • 已安装 Codex CLI。
  • 已在中转站创建绑定 GPT/Codex 分组的 API Key(sk- 开头)。

配置文件

编辑 ~/.codex/config.toml(Windows 为 %userprofile%\.codex\config.toml):

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

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://hub.nocannobb.com"
wire_api = "responses"
requires_openai_auth = true

[features]
goals = true

编辑 ~/.codex/auth.json

json
{
  "OPENAI_API_KEY": "sk-你的密钥"
}

WebSocket 模式(可选)

如需更低延迟的流式体验,在 [model_providers.OpenAI] 段加一行、[features] 段加一行:

toml
[model_providers.OpenAI]
# ...同上...
supports_websockets = true

[features]
responses_websockets_v2 = true
goals = true

验证

运行 codex,随便下达一个任务,能正常响应即接入成功。用量可在中转站 仪表盘 查看。

常见问题

  • 401 / 鉴权失败:确认 auth.json 里的密钥完整,且绑定了 GPT/Codex 对应分组。
  • 提示不支持生图:Codex 的图片生成桥接由平台按账号配置管理,如有需要请联系客服开通。
  • 更多见 FAQ