# 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.

Many provider keys, with failover

**Slug**: `claude-code-multiple-keys`  
**URL**: https://anyrouter.dev/use-cases/claude-code-multiple-keys  
**Markdown**: https://anyrouter.dev/use-cases/claude-code-multiple-keys.md  
**Short link**: https://anyrouter.dev/u/claude-code-multiple-keys  
**Other short links**: https://anyrouter.dev/u/keys  

## Why use this

One revoked, paused or capped key stops Claude Code mid-task. Swapping keys in your shell by hand loses the session.

## Set it up

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.

## Code

### anyr CLI

```bash
curl -fsSL https://anyr.dev/cli.sh | bash
anyr claude --model anyrouter/coding
```

## Limits

- 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.

## Related

- [byok-anthropic](https://anyrouter.dev/use-cases/byok-anthropic)
- [claude-code](https://anyrouter.dev/use-cases/claude-code)
- [gemini-in-claude-code](https://anyrouter.dev/use-cases/gemini-in-claude-code)
