Skip to content
GuidesAugust 5, 2026

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.

Wrapper script (ar_claude)

One command downloads the wrapper, installs it to ~/.local/bin/ar_claude, marks it executable, and runs 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"

Scripts: Unix at /ar_claude.sh, Windows at

View PowerShell script

After install, pick any catalog model. Opus, Sonnet, and Haiku aliases all point at that same 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"
ar_claude wrapper script running in a terminal
Running ar_claude in the terminal — every Claude Code request routes through AnyRouter.

CLI launcher

Alternatively, the CLI handles login and config in one command:

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

Full reference at docs.anyrouter.dev/cli/claude-code.

Where to go from here

The same patterns work for Codex, Cursor, and every OpenAI-compatible agent. One key covers every tool you run.

More at docs.anyrouter.dev.

Route your first request in 2 minutes

Start free with your own keys, or top up and pay per token. Get $4/mo in credits and free models on Go — $2/mo, or free when you donate a provider key.

Start free