A fallback proxy for Claude Code (or any Anthropic API client). When you hit rate limits or API errors, automatically routes to alternative providers. just like vercel and openreouter does
When using Claude Code or other Anthropic API clients, you might encounter:
- Rate limits (429) — Your API quota is exhausted
- Service errors (5xx) — Temporary Anthropic API downtime Instead of manually switching between providers, this proxy automatically fails over to your configured alternatives.
Claude Code ──► Fallback Proxy ──► Anthropic API
│ ✗ 429/403/5xx
│
└──► Provider 1 ──► Provider 2 ──► ...
The proxy intercepts API requests. When the Anthropic API returns an error eligible for fallback (401, 403, 429, or 5xx), requests are forwarded to your configured fallback providers in order until one succeeds.
When a request fails, the proxy:
- Tries Anthropic API first — Your primary requests always go to the official API
- Detects eligible errors — Only fallback on: 401, 403, 429, 5xx (not on 4xx client errors)
- Iterates through providers — Tries each configured provider in order
- Returns first success — Or the last error if all fail
Model Mapping: Configure model name translation (e.g., claude-3-opus-20240229 → anthropic/claude-3-opus) per provider to ensure compatibility.
Use at your own risk. I have not reviewed Anthropic's Terms of Service to confirm whether using a proxy is permitted. There is a possibility that using this proxy could violate their terms and result in account suspension.
Current status: I've been using this proxy personally without issues, but that doesn't guarantee it's safe for all users. Please review Anthropic's Terms of Service yourself before deploying, and use this tool at your own discretion.
Click the button below to deploy your own instance:
During deployment, you'll be prompted to:
- Set ADMIN_TOKEN — Choose a secure token to protect your admin panel
- Create KV namespace — Cloudflare will create this automatically
After deployment, open your admin panel:
https://your-worker.workers.dev/admin?token=YOUR_ADMIN_TOKEN
Click "Add Provider" and configure your fallback:
Required fields:
- Name: Any identifier (e.g., "openrouter", "bedrock")
- Base URL: API endpoint (e.g.,
https://openrouter.ai/api/v1/chat/completions) - API Key: Your authentication credential
Optional fields:
- Auth Header: Header name for the key (default:
x-api-key, useAuthorizationfor Bearer tokens) - Model Mapping: Map model names between providers (JSON format)
Example model mapping:
{
"claude-3-opus-20240229": "anthropic/claude-3-opus",
"claude-3-sonnet-20240229": "anthropic/claude-3-sonnet"
}After configuring providers, click the "Show Environment Config" button in the admin panel:
Add these to your Claude Code settings or environment:
For Claude Code CLI:
export ANTHROPIC_BASE_URL=https://your-worker.workers.dev
export ANTHROPIC_API_KEY=your-original-anthropic-keyFor .env file:
ANTHROPIC_BASE_URL=https://your-worker.workers.dev
ANTHROPIC_API_KEY=your-original-anthropic-keyThat's it! Claude Code will now automatically fallback when needed.
npm install
npm run dev
# Visit http://localhost:8787/admin?token=dev-tokennpm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportnpm run deploy # Deploy to Cloudflare
npm run tail # Stream production logsAnti 996-License

