Run Claude Code Against AnyRouter

Point Claude Code at AnyRouter so sessions are billed once, logged, and can use any Messages-compatible model.

Claude Code speaks the Anthropic Messages protocol, and AnyRouter exposes a compatible Messages endpoint. Sessions draw from one balance (or your BYOK accounts), appear in your request logs, and can use any Messages-compatible model, including non-Anthropic ones.

With the CLI

curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr claude --install --ok

The first run asks you to paste an sk-ar- key or log in at anyrouter.dev, then saves your profile to ~/.anyrouter/config.yaml. Pin a model or reasoning depth per session; auto lets your pinned preset choose, and anything after -- goes to Claude Code:

anyr claude --model "anthropic/claude-sonnet-4-6"
anyr claude --model auto --effort high
anyr claude --model auto -- --resume

Without the CLI

Set two environment variables and run claude. For a wrapper that keeps a separate Anthropic key, see the Claude Code guide.

export ANTHROPIC_BASE_URL="https://anyrouter.dev/api"
export ANTHROPIC_AUTH_TOKEN="sk-ar-v1-your-key"
claude

Run non-Anthropic models, for example GLM with your own Z-AI key: anyr claude --model "z-ai/glm-4.7-flash". List Messages-compatible models at /models?endpoint=messages.

AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer