> ## Documentation Index
> Fetch the complete documentation index at: https://docs.viviai.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Codex 接入 ViVi-API 的配置教程。

准备好 [ViVi-API 控制台](https://api.viviai.cc/dashboard)创建的令牌 Key，并确认分组支持所选模型。已有配置请先备份，再合并所需字段。

## 配置文件位置

| 操作系统 | 默认目录 |
| - | - |
| Windows | `C:\Users\<用户名>\.codex` |
| macOS | `/Users/<用户名>/.codex` |
| Linux | `/home/<用户名>/.codex` |

在此目录中编辑 `config.toml` 和 `auth.json`；文件不存在时再创建。如果设置了 `CODEX_HOME`，请使用其指定目录。

```toml config.toml theme={null}
model = "gpt-6-astra"
model_reasoning_effort = "high"
model_provider = "viviai"
cli_auth_credentials_store = "file"

[model_providers.viviai]
name = "viviai"
base_url = "https://api.viviai.cc/v1"
wire_api = "responses"
requires_openai_auth = true
```

```json auth.json theme={null}
{
  "OPENAI_API_KEY": "sk-your-api-key"
}
```

将模型替换为账号实际可用、支持 Responses 协议的模型。示例中的 `gpt-6-astra` 使用 ViVi-API 平台模型 ID。保存后重新启动 Codex，创建新会话测试。

> [!NOTE]
>
> Codex 使用 Responses 协议，网关需要支持 `/v1/responses`。仅支持 Chat Completions 的模型或渠道不一定能用于 Codex。`auth.json` 含有密钥，不要提交到代码仓库。

本示例使用文件方式保存凭据。已有 ChatGPT 登录或其他供应商配置时，请先备份原配置。客户端配置项以 [Codex 官方配置参考](https://developers.openai.com/codex/config-reference)为准。

更多说明见[接入概览](https://docs.viviai.cc/scenarios.md)与[常见问题](https://docs.viviai.cc/faq.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.