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

# Codex

> 为 Codex CLI 添加自定义 Responses 提供商

## 配置

在 `~/.codex/config.toml` 添加：

```toml theme={null}
model = "your-model"
model_provider = "bianxieai"

[model_providers.bianxieai]
name = "Bianxie AI"
base_url = "https://api.bianxie.ai/v1"
env_key = "BIANXIE_API_KEY"
wire_api = "responses"
```

设置环境变量后启动 Codex：

<CodeGroup>
  ```bash macOS / Linux theme={null}
  export BIANXIE_API_KEY="API_KEY"
  codex
  ```

  ```powershell Windows PowerShell theme={null}
  $env:BIANXIE_API_KEY="API_KEY"
  codex
  ```
</CodeGroup>

## 验证与排查

先用 `/status` 确认 provider 和模型，再要求 Codex“说明当前目录，不修改文件”。所选模型必须兼容 Responses API 和工具调用。

* 启动时找不到 Key：确认 `env_key` 与环境变量名称完全一致。
* `404`：Base URL 必须包含 `/v1`。
* 请求格式错误：确认 `wire_api = "responses"`，不要改成 Chat Completions。
* 工具调用不稳定：更换支持 Responses tools 的模型并新建会话。
