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

# Codex CLI

> 把 Codex CLI 配置为使用 XMAI 的 OpenAI 兼容 Responses 入口。

Codex 使用 OpenAI-compatible Responses 流量。把 XMAI 配成自定义 provider，然后在启动 Codex 的 shell 里设置 API key。

## 配置

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

```toml theme={null} theme={null}
model = "gpt-5.5"
model_provider = "XMAI"

[model_providers.XMAI]
name = "XMAI"
wire_api = "responses"
env_key = "XMAI_API_KEY"
base_url = "https://xmapi.site/v1"
```

然后运行：

```bash theme={null} theme={null}
export XMAI_API_KEY="your-XMAI-api-key"
codex
```

## 模型

推荐使用 `gpt-5.5`，或 [支持模型](/cn/models) 中任何 OpenAI 兼容模型。
