Multi-account Claude OAuth rotating proxy — never hit a rate limit again
Log in to several Claude subscriptions · point Claude Code at the proxy · it rotates accounts automatically when one is rate-limited
clauden is a tiny, single-binary proxy that sits between Claude Code (or any
Anthropic-compatible client) and api.anthropic.com. You log in to multiple
Claude subscription accounts via OAuth; the proxy forwards requests using
the active account's token and transparently switches accounts the moment
one returns a rate-limit (429), credit (402), or overloaded (529) error.
- OAuth subscriptions — stacks your Claude Max/Pro logins (no per-token API billing)
- Automatic rotation — cools down a limited account and retries on the next, mid-request
- Proactive quota awareness — reads Anthropic's
anthropic-ratelimit-unified-*headers and switches away from an account at ≥95% utilization before it 429s - Load-balancing strategies —
round-robin,least-used, orsession-sticky(pins a conversation to one account to preserve Anthropic's prompt cache → cheaper + faster) - Auto token refresh — refreshes OAuth tokens ~5 min before expiry
- True streaming — SSE responses pipe straight through
- Single static binary — no Node, no runtime, ~3.5 MB, ~10 MB RAM
Claude Code ──▶ clauden (:3131) ──▶ api.anthropic.com
│ picks active account, injects Bearer token
│ on 429/402/529 → cooldown + rotate + retry
▼
~/.claudeN/config.json (accounts + state)
Requires Rust (1.86+).
cargo install --git https://github.com/skishore23/claudenThis builds and installs the clauden binary into ~/.cargo/bin (already on
your PATH if you used rustup).
curl -fsSL https://raw.githubusercontent.com/skishore23/clauden/main/install.sh | bashgit clone https://github.com/skishore23/clauden
cd clauden
cargo build --release
cp target/release/clauden ~/.local/bin/ # or /usr/local/binclauden update # rebuilds + reinstalls the latest from GitHub(Equivalent to cargo install --git https://github.com/skishore23/clauden --force.)
clauden login # browser OAuth — repeat for each account
clauden list # show accounts + status
clauden # run proxy on :3131 and launch Claude CodeIn one-command mode, clauden keeps the terminal clean for Claude Code's UI and
writes its own logs to ~/.claudeN/clauden.log. Watch rotation live with:
tail -f ~/.claudeN/clauden.logOther commands:
| Command | Effect |
|---|---|
clauden run --no-launch |
Proxy only; connect a client manually |
clauden --port 8080 |
Custom port |
clauden --verbose |
Log rotations/errors to stderr |
clauden use <name> |
Manually switch active account (by name or list number) |
clauden remove <name> |
Remove an account |
clauden rename <name> <new> |
Rename an account's display name |
clauden strategy <name> |
Set strategy: round-robin / least-used / session-sticky |
clauden update |
Update to the latest version from GitHub |
To point a client at the proxy manually:
export ANTHROPIC_BASE_URL=http://127.0.0.1:3131
claude- Pick the active account (round-robin pointer), skipping any on cooldown.
- Refresh its OAuth token if it expires within 5 minutes.
- Forward the request with
Authorization: Bearer <token>. - If the upstream returns
429/402/529, cool that account down (honoringretry-afterwhen present), advance to the next account, and retry. - If every account is cooling down, return
429with a try-again hint.
Stored at ~/.claudeN/config.json (created on first login, 0600 perms):
{
"port": 3131,
"current": 0,
"accounts": [
{
"name": "you@example.com",
"tier": "max",
"access_token": "sk-ant-oat01-...",
"refresh_token": "sk-ant-ort01-...",
"expires_at": 1774384968427,
"cooldown_until": null
}
]
}- docs/USAGE.md — full install/login/run walkthrough + troubleshooting
cargo test # unit tests (rotation/quota/strategies) + integration tests
cargo clippy --all-targets
cargo build --releaseTests:
- Unit (
src/) — selection strategies, quota math, session keys, header parsing - Integration (
tests/integration.rs) — a mock Anthropic upstream + the real proxy router, asserting 429 rotation, proactive quota skipping, bearer injection, header passthrough, and session stickiness end-to-end
MIT