All use cases
Keys behind Claude Code
Several provider keys behind Claude Code
Save keys for more than one provider. Claude Code keeps one URL, and AnyRouter tries the next provider 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
Anthropic keytried first
OpenRouter keyif the first fails
Steps, then copy
- 1.Add a key for one provider under Dashboard → BYOK, then add a key for a second provider, such as OpenRouter.
- 2.On each provider card, keep the Fallback strategy. Round Robin and Weighted spread requests across a provider's keys 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 for one provider should come from one account you own. A second key there is redundancy against a revoked key, not more rate limit.
- 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.