Skip to content

Codex CLI

Codex CLI 接到 Trinity:使用 xh-... API Key,模型 ID 取自 模型广场

获取 API Key

  1. 控制台 · API 密钥 创建 Key(xh-...)。
  2. 管理与轮换见 管理 API 密钥

快速配置

bash
npx -y trinity-config@latest --type codex -k xh-你的key --model gpt-5.4

写入 ~/.codex/config.tomlauth.jsonwire_apiresponses;Base URL(含 /v1):

text
https://api.trinitydesk.ai/v1

完成后运行:

bash
codex

手动配置

编辑 ~/.codex/config.toml

toml
model_provider = "trinity"
model = "gpt-5.4"
disable_response_storage = true

[model_providers.trinity]
name = "Trinity"
base_url = "https://api.trinitydesk.ai/v1"
wire_api = "responses"
requires_openai_auth = true

模型 ID 须来自 模型广场

将 Key 写入 ~/.codex/auth.json

json
{
  "OPENAI_API_KEY": "xh-你的key"
}

或导出环境变量:

bash
export OPENAI_API_KEY="xh-你的key"

配置后运行:

bash
codex

故障排查

问题排查
401 Unauthorized确认 API Key 以 xh- 开头且未过期
403 model_not_allowed在控制台确认 Key 有该模型的调用权限
连接超时确认 Base URL 为 https://api.trinitydesk.ai/v1
模型未找到模型广场 核对模型 ID

WARNING

不要将 API Key 提交到 Git 仓库。使用环境变量或配置文件管理 Key,定期轮换。

© Trinity AI