All use cases
Keys behind Claude Code
Several provider keys behind Claude Code
Save more than one key, for one provider or for several. Claude Code keeps one URL, and AnyRouter tries the next key when one fails.
What this is for
One revoked, paused or capped key stops Claude Code mid-task. Swapping keys in your shell by hand loses the session.
How the request flows
Claude Code
AnyRouter
Key 1tried first
Key 2if key 1 fails
Steps, then copy
- 1.Add your first key under Dashboard → BYOK, then add a second key on the same provider card, or a key for another provider.
- 2.On the provider card, keep the Fallback strategy and set each key's priority. Round Robin and Weighted spread requests instead.
- 3.Run anyr claude. anyrouter/coding picks from every model your saved keys can reach and moves on if a provider is busy.
anyr CLI
bash
curl -fsSL https://anyrouter.dev/setup.sh | bash
anyr claude --model anyrouter/codingLimits
- Keys from the same provider account share that account's limits. A second key adds redundancy, not capacity.
- Use keys from accounts you own, and follow each provider's terms.
- Fallback moves to the next key on a rate limit or provider error. If every key fails, the provider's error comes back.
- A key that fails repeatedly is marked unhealthy and skipped until it recovers.
Ready to try it
The guide has the full walkthrough. Sign up if you still need a key.
Next playbooks
- Bring your own Anthropic keyAdd your sk-ant key once. Claude models then run on your Anthropic plan and limits, billing stays on your Anthropic account, and one AnyRouter endpoint can fall back to other models.
- Run Claude Code through AnyRouterInstall 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.
- Gemini models in Claude CodeClaude Code talks to the Messages API, and AnyRouter translates it for any catalog model. Save a Google key, then choose a Gemini model with --model.