← All applications · Connect apps section on /docs
Claude Code
Also known as: Claude CLI · claude
Claude Code: hướng dẫn cấu hình khóa API, model và nhà cung cấp trong terminal.
Published instructions · Checked version: 2.1.220 · Checked on:
The real application was run against a local mock API to check connection settings, authentication and streaming responses. Production, all features, plugins and operating systems have not been verified.
Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely
Base URL to paste
OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.
https://apistack.vnPrerequisites
- Đã cài lệnh `claude` (Claude Code)
- API key sk-stk-…
- Nếu từng login Anthropic: chạy `/logout` trong Claude Code trước
Recommended model: claude-fable-5
Quick way — command / config
npm install -g API CLI@latest
api-cli configure claude -m claude-fable-5
API Stack doctorWhere to place file / fill Settings
Tạo/sửa file JSON như tab settings.json. Backup trước khi sửa tay. Ưu tiên `api-cli configure claude` (có backup timestamp).
Kiểm tra base URL và model, không in API key: `node -e 'const fs=require("node:fs"),os=require("node:os"); const s=JSON.parse(fs.readFileSync(os.homedir()+"/.claude/settings.json","utf8")); console.log({baseURL:s.env?.ANTHROPIC_BASE_URL,model:s.env?.ANTHROPIC_MODEL})'`.PowerShell: `notepad $env:USERPROFILE\.claude\settings.json`. Dùng ANTHROPIC_AUTH_TOKEN (không phải ANTHROPIC_API_KEY).
Chỉ áp dụng một dự án. Đưa vào .gitignore nếu chứa key.
Verify connection
- `claude` mở được; gửi “ping”.
- `echo $ANTHROPIC_BASE_URL` (Unix) phải là https://apistack.vn
- Dashboard → Sử dụng có request mới.
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| Cứ đòi đăng nhập Anthropic | Còn session OAuth cũ. | Trong Claude Code chạy `/logout`, đặt lại ANTHROPIC_AUTH_TOKEN, mở terminal mới. |
| 404 | BASE_URL có thừa /v1. | Phải là https://apistack.vn (không /v1). |
| 401 | Dùng nhầm ANTHROPIC_API_KEY hoặc key sai. | Dùng ANTHROPIC_AUTH_TOKEN=sk-stk-… |
Notes
- Khuyến nghị một key riêng cho máy Claude Code.
- API CLI merge env an toàn hơn sửa tay cả file.