KandesKandes
Quay lại trang tài liệu API
HƯỚNG DẪN CODEX CLI

Cấu Hình Codex CLI

Sử dụng Codex CLI mượt mà với Kandes API Key — chỉ cần thay đổi Base URL và API Key.

Cài đặt tự động (1 lệnh)

Khuyến nghị

Copy lệnh phù hợp với hệ điều hành của bạn, paste vào terminal/cmd, nhập API key khi được hỏi. Script sẽ tự động ghi config cho Codex CLI và/hoặc Claude Code.

macOS / Linux (bash)
curl -fsSL https://kandes.shop/install/codex/codex-config-kandes.sh | bash
Windows PowerShell
irm https://kandes.shop/install/codex/codex-config-kandes.ps1 | iex
Windows CMD (chỉ Codex)
curl -fsSL https://kandes.shop/install/codex/codex-config-kandes.bat -o "%TEMP%\kandes.bat" && "%TEMP%\kandes.bat"

1Thiết Lập Biến Môi Trường (Environment)

# Windows PowerShell (Lưu vĩnh viễn):
setx OPENAI_BASE_URL "https://api.kandes.shop/v1"
setx OPENAI_API_KEY "<kandes-key>"

# Hoặc áp dụng cho session hiện tại:
$env:OPENAI_BASE_URL = "https://api.kandes.shop/v1"
$env:OPENAI_API_KEY = "<kandes-key>"

2Kiểm Tra Phiên Bản

codex --version

Nếu lệnh trả về phiên bản Codex thành công, hệ thống đã nhận đúng biến môi trường. Bạn có thể gõ codex để lập trình như bình thường.

3Test Thử Request API

curl -X POST "https://api.kandes.shop/v1/responses" \
  -H "Authorization: Bearer <kandes-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "input": [{"role": "user", "content": "hello"}]
  }'

4Hỗ Trợ Streaming (SSE)

Codex CLI tự động sử dụng SSE stream. Kandes API giữ kết nối pass-through trực tiếp với latency thấp nhất mà không buffer dữ liệu.

curl -N -X POST "https://api.kandes.shop/v1/responses" \
  -H "Authorization: Bearer <kandes-key>" \
  -H "Content-Type: application/json" \
  -d '{ "model": "gpt-5.4", "input": [...], "stream": true }'

Các Model Hỗ Trợ Trực Tiếp

Gói Codex hỗ trợ các model chính sau (gửi raw model name trực tiếp):

gpt-5.4
gpt-5.4-mini
gpt-5.5
codex-auto-review