Cấu Hình Claude Code
Trỏ ANTHROPIC_BASE_URL về Kandes — script tự ghi ~/.claude/settings.json cho bạn.
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 ~/.claude/settings.json với base URL trỏ về Kandes.
curl -fsSL https://kandes.shop/install/claude/claude-config-kandes.sh | bash
irm https://kandes.shop/install/claude/claude-config-kandes.ps1 | iex
curl -fsSL https://kandes.shop/install/claude/claude-config-kandes.bat -o "%TEMP%\kandes-claude.bat" && "%TEMP%\kandes-claude.bat"
1Thiết Lập Biến Môi Trường (Environment)
# Windows PowerShell (Lưu vĩnh viễn): setx ANTHROPIC_BASE_URL "https://api.kandes.shop" setx ANTHROPIC_AUTH_TOKEN "<kandes-key>" # Hoặc áp dụng cho session hiện tại: $env:ANTHROPIC_BASE_URL = "https://api.kandes.shop" $env:ANTHROPIC_AUTH_TOKEN = "<kandes-key>"
2Kiểm Tra Phiên Bản
claude --version
Nếu lệnh trả về phiên bản Claude Code thành công, hệ thống đã nhận đúng biến môi trường. Bạn có thể gõ claude để bắt đầu code.
3Test Thử Request API (Anthropic Messages API)
curl -X POST "https://api.kandes.shop/v1/messages" \
-H "x-api-key: <kandes-key>" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "hello"}]
}'4Hỗ Trợ Streaming (SSE)
Claude Code 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/messages" \
-H "x-api-key: <kandes-key>" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{ "model": "claude-3-5-sonnet-20241022", "max_tokens": 1024, "messages": [{"role": "user", "content": "hello"}], "stream": true }'Các Model Hỗ Trợ Trực Tiếp
Kandes proxy Anthropic-compatible API, hỗ trợ đầy đủ các model chính (tự động mapping sang upstream provider):
Cũng dùng Codex CLI?
Nếu bạn dùng cả Claude Code lẫn Codex CLI, hãy chạy installer Codex để cấu hình cả hai cùng lúc (chọn option 3. Both Codex and Claude Code).