Run Claude Code through AnyRouter
Install the anyr CLI, then anyr claude — it injects the base URL, key, and model. Env vars are the fallback if you already run claude yourself.
The problem
What this is for
Claude Code talks to Anthropic by default. To use other models, share billing across tools, or keep an audit log, you need a custom base URL without rewriting how the CLI works.
What to do
Three steps, then copy
- 1.Install the anyr CLI with the curl | bash one-liner (native binary, no npm).
- 2.Run anyr claude. First run signs you in or pastes an sk-ar- key; later runs reuse ~/.anyrouter/config.yaml.
- 3.Pin a catalog model when you want one (anyr claude --model anyrouter/auto). Env vars remain the manual fallback.
curl -fsSL https://anyrouter.dev/setup.sh | bash
anyr claudeexport ANTHROPIC_BASE_URL="https://anyrouter.dev/api"
export ANTHROPIC_API_KEY="$ANYROUTER_API_KEY"
claudeReady to try it
The guide has the full walkthrough. Sign up if you still need a key.
Related
Next playbooks
Grok Bot + Herdr + Anyr CLI coding loop
A live coding agent on a repo checkout: Grok Bot assigns the goal, Herdr shows the box, and the anyr CLI launches Claude Code through AnyRouter.
OpenRun OpenCode through AnyRouter
One CLI command injects an AnyRouter provider for the session, or add a custom provider in opencode.json — one key, the Chat Completions catalog, and request logs.
OpenRun every coding agent through one URL
Claude Code, Codex, OpenCode, Cursor, and other OpenAI-compatible tools share 209+ models, one balance, and one request log.
Open