# Codex 接入指南

## 基础信息

- 接入地址：`https://api.apiverse.ai/v1/support/codex`
- API Key：控制台「API 密钥」页面创建，需开通「大模型」能力
- 可用模型：GPT 系列中标注「支持 Codex」的型号，见「GPT 系列 API 对接文档」

## 配置步骤

编辑 `~/.codex/config.toml`（Windows：`C:\Users\<用户名>\.codex\config.toml`），把以下内容放在文件最顶端：

```toml
model = "gpt-5.5"
model_provider = "fcgw"
model_reasoning_effort = "medium"

[model_providers.fcgw]
name = "FC Gateway"
base_url = "https://api.apiverse.ai/v1/support/codex"
env_key = "V_API_KEY"

wire_api = "responses"
request_max_retries = 3
stream_max_retries = 3
```

再在 shell 环境中导出 API Key，macOS / Linux 编辑 `~/.zshrc`（或 `~/.bashrc`）：

```bash
export V_API_KEY="<API_KEY>"
```

Windows 用户请在「编辑系统环境变量」中添加 `V_API_KEY`。使用 Codex 桌面版时需长期设置该环境变量。

## 常见问题

| 现象 | 排查方向 |
| ---- | -------- |
| 返回 403 未开通 LLM 能力 | 在控制台重新创建并开通「大模型」能力的 API Key |
| 模型返回 503 / 排队 | 换用 GPT 系列同档位其他型号 |
| 返回 666 | 复制响应体 `code_reason` 联系技术支持 |