claude-nonstop

claude-nonstop › Guides

Automatic Anthropic and OpenAI API key failover

claude-nonstop runs a local gateway that sends each request on your first working key. When a key answers credit balance too low, spend limit reached, invalid or not allowed, the gateway sends the same request again on the next key, so a running session never notices.

How it works

Tools talk to the gateway at http://127.0.0.1:43117. Keys next to each other in your order work as a team: when one runs out, the request is retried on the next one mid-request. A used-up key is skipped for 30 minutes before it's tried again, in case you topped it up.

Rate limits (HTTP 429) and outages (5xx) stay on the current key, because keys in one organisation share one rate limit and the tools already retry those.

Add your keys

  1. Install claude-nonstop.
    # macOS and Linux
    curl -fsSL https://raw.githubusercontent.com/umer-jahangier/claude-nonstop/main/install.sh | sh
    
    # Windows (PowerShell)
    irm https://raw.githubusercontent.com/umer-jahangier/claude-nonstop/main/install.ps1 | iex
  2. Click Add API Key… on the web page, or run claude-nonstop keys add, and paste an Anthropic or OpenAI key. Each key is tested as soon as you save it.
  3. Drag keys into the order you want. claude-nonstop keys tests them all.

Security

Keys are encrypted at rest with AES-256-GCM. The encryption key is held by the macOS Keychain, Windows DPAPI or the Linux Secret Service. A key is only ever sent to its own service, and only a masked form is shown after you save it.

Questions

Does a key switch interrupt my session?

No. The gateway retries the same request on the next key, so the session continues without a restart.

Can I mix Anthropic and OpenAI keys?

Yes. Both go in the same order, and requests are translated between Anthropic's and OpenAI's formats when a tool runs on the other service's key.

By , author of claude-nonstop · Updated

More guides