| 项目 | 配置值 |
|---|---|
| 更新时间 | 2026-06-04 |
| 推荐调用模式 | Responses API |
| 配置目录 | ~/.codex 或 C:\Users\用户名.codex |
| 唯元智创平台接口 | https://token.wy.cn/v1 |
| 默认模型 | gpt-5.2 |
| 重要说明 本文档不包含真实 token。请从唯元智创平台控制台或管理员处获取 AI 网关 token,并将 {AIGateway_Token} 替换为实际凭据。 |
|---|
npm i -g @openai/codex
codex --version| 项目 | 配置值 |
|---|---|
| macOS / Linux | |
| Windows | C:\Users\用户名.codex\auth.json;C:\Users\用户名.codex\config.toml |
{
"OPENAI_API_KEY": "{AIGateway_Token}"
}model_provider = "weiyuan"
model = "gpt-5.2"
[model_providers.weiyuan]
name = "weiyuan"
wire_api = "responses"
requires_openai_auth = true
base_url = "https://token.wy.cn/v1"mkdir -p ~/.codex
cat > ~/.codex/auth.json <<'JSON'
{
"OPENAI_API_KEY": "{AIGateway_Token}"
}
JSON
cat > ~/.codex/config.toml <<'TOML'
model_provider = "weiyuan"
model = "gpt-5.2"
[model_providers.weiyuan]
name = "weiyuan"
wire_api = "responses"
requires_openai_auth = true
base_url = "https://token.wy.cn/v1"
TOML
chmod 600 ~/.codex/auth.json ~/.codex/config.toml$CodexDir = Join-Path $HOME ".codex"
New-Item -ItemType Directory -Force -Path $CodexDir | Out-Null
@'
{
"OPENAI_API_KEY": "{AIGateway_Token}"
}
'@ | Set-Content -Encoding UTF8 (Join-Path $CodexDir "auth.json")
@'
model_provider = "weiyuan"
model = "gpt-5.2"
[model_providers.weiyuan]
name = "weiyuan"
wire_api = "responses"
requires_openai_auth = true
base_url = "https://token.wy.cn/v1"
'@ | Set-Content -Encoding UTF8 (Join-Path $CodexDir "config.toml")cd 你的工作目录路径
codex
# 非交互验证
codex exec "Reply with OK only."OKcode --install-extension openai.chatgpt --force
# Cursor 可在扩展市场搜索 OpenAI / Codex 并安装| 测试场景 | 测试方式 | 验证能力 | 唯元智创平台 |
|---|---|---|---|
| 启动连接 | 配置 API 后启动 Codex | API 认证、基础连通 | YES |
| 基础对话 | 发送“你好”或简单问题 | 流式响应、SSE 格式 | YES |
| 阅读文件 | 读取某个代码文件 | Tool Use 单工具调用 | YES |
| 执行命令 | 执行 shell 命令 | Bash 工具调用 | YES |
| 复杂任务 | 读取、分析、修改多步骤任务 | 多工具连续调用、长上下文 | YES |
| 思考内容输出 | 问题咨询 | Responses 推理/思考内容 | YES |