Source: https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/
Canonical: https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/
Language: zh-hant-tw

[終端機代理](https://ailoot.ai/docs/zh-hant-tw/integrations/#agents) 

# OpenAI Codex CLI

[Markdown](https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/index.md)

終端機代理 · OpenAI Responses

| 格式 | 設定位置 |
| --- | --- |
| OpenAI Responses | ~/.codex/config.toml (僅限使用者檔案，專案 .codex/config.toml 中的 model\_provider/model\_providers 鍵會被忽略)；金鑰取自 env\_key 指定的環境變數 |

## [](https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/#setup)設定

複製設定，並將`sk-...`替換為您的 Ailoot 控制台金鑰。若應用程式支援，最好將金鑰存放在環境變數`AILOOT_API_KEY`中。

執行前，請使用 Ailoot 金鑰呼叫 GET /v1/models。選擇支援方法包含 POST /v1/responses 的確切模型 ID，並填入設定。使用代理程式時，也請確認工具支援及客戶端版本所需的功能。

`~/.codex/config.toml`

```toml
model = "gpt-6.1-sol"
model_provider = "ailoot"

[model_providers.ailoot]
name = "Ailoot"
base_url = "https://api.ailoot.ai/v1"
env_key = "AILOOT_API_KEY"
wire_api = "responses"
```

```bash
export AILOOT_API_KEY="sk-..."
codex
```

模型範例：`gpt-6.1-sol`。若要使用其他模型，請從此處選取：[目錄](https://ailoot.ai/models/zh-hant-tw/) —請確認模型支援所需格式。

## [](https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/#notes)重要須知

Codex 僅透過 OpenAI Responses API 運作，文件只列出 wire\_api = "responses"，因此需要我們的 /v1/responses。提供者 ID openai、ollama、lmstudio 為保留名稱。另一種方式是在內建 openai 提供者中設定 openai\_base\_url = "https://api.ailoot.ai/v1"。Ailoot 會以 Codex 資訊清單格式傳回模型清單 (GET /v1/models，附帶 client\_version)。請選擇目錄中明確支援 OpenAI Responses 格式的模型。2026-09-30 快照中的 gemini-3.6-flash 支援 OpenAI Chat、Anthropic Messages與Gemini，但不支援 Responses，因此不適用於 Codex。請依模型資訊卡確認支援格式，而非依模型系列名稱判斷。

## [](https://ailoot.ai/docs/zh-hant-tw/integrations/openai-codex-cli/#check)驗證

- OpenAI 格式的位址為`https://api.ailoot.ai/v1` (若應用程式要求完整位址，則使用完整路徑)。
- 提出一個簡短問題。若收到錯誤，請查看代碼與Request ID，並對照此頁面：[錯誤與限制](https://ailoot.ai/docs/zh-hant-tw/errors/)。
- 剛完成設定就遇到 404，幾乎總是位址不正確，可能多加或漏加了`/v1`。
- 402 表示餘額不足以涵蓋保留金額。代理需要保留的金額比聊天更多：[原因](https://ailoot.ai/docs/zh-hant-tw/billing/reserve/)。

應用程式說明文件：[https://learn.chatgpt.com/docs/config-file/config-advanced](https://learn.chatgpt.com/docs/config-file/config-advanced)

還有疑問嗎？請提供 Request ID與問題描述，我們會協助釐清。[聯絡支援](mailto:support@ailoot.ai)

## Ailoot · 公司及其專案組合





Ailoot以累積的營運經驗、廣大的客戶群、穩定的服務及持續的KPI管理為基礎。





公司及其專案組合：數百萬客戶，每月銷售額達數十億。





Ailoot將這些營運經驗用於API存取，讓客戶的產品、代理、應用程式及自動化流程使用AI功能。
