Skip to content
GuidesAugust 5, 2026

Chạy Claude Code trên AnyRouter — wrapper hoặc CLI

Route Claude Code qua AnyRouter theo hai cách: wrapper tự cài và map Opus, Sonnet, Haiku vào một model catalog (ghi đè bằng --model), hoặc launcher anyr CLI. Một key, billing thống nhất, nhật ký.

Script wrapper (ar_claude)

Một lệnh tải wrapper, cài vào ~/.local/bin/ar_claude, đánh dấu executable, rồi chạy Claude Code:

export ANYROUTER_API_KEY="sk-ar-..."
curl -sL https://anyrouter.dev/ar_claude.sh | bash -s -- "explain this project"
$env:ANYROUTER_API_KEY = "sk-ar-..."
irm https://anyrouter.dev/ar_claude.ps1 -OutFile "$env:USERPROFILE\.local\bin\ar_claude.ps1"
& "$env:USERPROFILE\.local\bin\ar_claude.ps1" "explain this project"

Script: Unix tại /ar_claude.sh, Windows tại

Xem script PowerShell

Sau khi cài, chọn bất kỳ model catalog. Alias Opus, Sonnet, và Haiku đều trỏ cùng id đó:

export ANYROUTER_API_KEY="sk-ar-..."
ar_claude --model poolside/laguna-s-2.1 "Explain the architecture of this project"
ar_claude --model z-ai/glm-4.7 "Review this PR"
script wrapper ar_claude chạy trong terminal
Chạy ar_claude trong terminal — mọi request Claude Code đi qua AnyRouter.

Launcher CLI

Hoặc CLI lo login và config trong một lệnh:

curl -fsSL https://anyrouter.dev/setup.sh | bash
anyr login
anyr claude
anyr claude --model "z-ai/glm-4.7"
anyr claude --dry-run

Tham chiếu đầy đủ tại docs.anyrouter.dev/cli/claude-code.

Đi tiếp từ đây

Cùng pattern cho Codex, Cursor, và mọi agent tương thích OpenAI. Một key phủ mọi tool bạn chạy.

Thêm tại docs.anyrouter.dev.

Gửi request đầu trong hai phút

Bắt đầu miễn phí với key của bạn, hoặc nạp rồi trả theo token. Go: $4 credit/tháng — $2/tháng, hoặc miễn phí khi góp một provider key.

Bắt đầu miễn phí