Bạn cần gì
API AnyRouter chỉ là HTTPS. Môi trường chạy được curl hoặc script Python/Node.js là dùng được — không client đặc biệt, không binary theo OS, không cần root.
Bạn cần:
- Tài khoản AnyRouter và API key (tạo miễn phí tại anyrouter.dev)
- curl, Python, Node.js, hoặc bất kỳ HTTP client nào
- HTTPS ra ngoài tới anyrouter.dev
Thử nhanh từ terminal
Kiểm tra kết nối bằng một lệnh curl:
curl -s https://anyrouter.dev/api/v1/chat/completions \
-H "Authorization: Bearer sk-ar-v1-placeholder" \
-H "Content-Type: application/json" \
-d '{"model":"anyrouter/free","messages":[{"role":"user","content":"Say hi"}]}'Nếu nhận JSON có choices thì đã nối. 401 nghĩa là key sai; timeout mạng nghĩa là HTTPS ra ngoài bị chặn.
Cạm bẫy môi trường thường gặp
- HTTPS proxy — sau proxy công ty, set HTTPS_PROXY để curl và SDK tới được anyrouter.dev.
- Firewall — xác nhận cổng 443 ra ngoài mở trên server headless và CI runner.
- Chứng chỉ TLS — một số image Docker tối giản không có CA. Cài ca-certificates nếu thấy lỗi SSL.
- Lệch đồng hồ — lệch quá vài phút thì TLS handshake có thể fail. Đồng bộ NTP.
Dùng trong script và CI
Giữ key trong biến môi trường. Đừng hardcode vào script sẽ vào git:
export ANYROUTER_API_KEY="sk-ar-v1-..."
# Then in Python:
# base_url="https://anyrouter.dev/api/v1"
# Or Node.js:
# baseURL: "https://anyrouter.dev/api/v1"Nền tảng CI (GitHub Actions, GitLab CI, v.v.) đều hỗ trợ secret mã hóa — lưu key ở đó và tham chiếu như env trong workflow.
Trạng thái và độ tin cậy AnyRouter
Trạng thái hiện tại của anyrouter.dev: trang system status hoặc health endpoint. Thấy lỗi lúc được lúc không thì routing failover thường xử lý mà không cần sửa code.
Theo dõi sức khỏe từng request, latency, và tỷ lệ lỗi theo model tại chmonitor.dev.
Chạy từ Linux, WSL, CI, hoặc mọi môi trường HTTPS. Đăng ký miễn phí.
Bắt đầuBài liên quan
Free LLM API access for students and side projects
You don't need a company card to build with real models. Between a no-spend free tier, a $2/mo plan if you outgrow it, and routing on free-tier keys you may already have from providers like Google AI Studio, there's a durable way to stay at $0 while a class project or side hustle is still finding its shape.
Run Claude Code on AnyRouter — wrapper script or CLI
Route Claude Code through AnyRouter in two ways: a wrapper that installs itself and maps Opus, Sonnet, and Haiku to one catalog model (override with --model), or the anyr CLI launcher. One key, unified billing, audit logs.