npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-api-proxy

v0.1.0

Published

CLI proxy for Claude Code that rotates Anthropic API keys automatically on quota exhaustion

Readme


claude-api-proxy setup      # add your API keys
claude-api-proxy            # start proxy + launch Claude Code
claude-api-proxy status     # see which key is active

How it works

claude-api-proxy runs a local HTTP proxy on port 3131. It starts Claude Code as a child process with ANTHROPIC_BASE_URL pointing at the proxy. Every API request is forwarded to api.anthropic.com with the currently active key injected.

When a quota or credit exhaustion error is detected (402, 429, 529 / credit_balance_too_low, rate_limit_error, overloaded_error), the proxy silently rotates to the next configured key and retries — without interrupting your Claude Code session.

[claude-api-proxy] ⚡ KEY ROTATED: work → personal

If all keys are exhausted, the original error is passed back to Claude Code unchanged.


Requirements


Install

npm install -g claude-api-proxy

Quick start

1. Add your API keys:

claude-api-proxy setup
[claude-api-proxy] Setup — Add your Anthropic API keys
Keys are stored in ~/.claude-api-proxy.json

Key label (e.g. "work", "personal") [leave blank to finish]: work
API key for "work" (sk-ant-...): sk-ant-api03-...
  ✓  Added key "work"

Add another key? (y/N): y
Key label (e.g. "work", "personal") [leave blank to finish]: personal
API key for "personal" (sk-ant-...): sk-ant-api03-...
  ✓  Added key "personal"

Add another key? (y/N): n

✓ Saved 2 key(s) to ~/.claude-api-proxy.json

2. Start the proxy and Claude Code:

claude-api-proxy

That's it. Claude Code launches automatically with the proxy configured. When the first key hits its quota, the proxy rotates to the next key transparently.


Commands

claude-api-proxy setup

Interactive wizard to add API keys. Stores them in ~/.claude-api-proxy.json.

claude-api-proxy status

List all configured keys with their labels and which one is currently active.

[claude-api-proxy] Configured API keys:

  [1] work                 sk-ant-api03...xxxx ← active
  [2] personal             sk-ant-api03...yyyy

claude-api-proxy

Start the proxy on port 3131 and launch claude with the correct environment variables injected (ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY).

claude-api-proxy --no-launch

Start the proxy only. Useful if you want to launch Claude Code manually or connect another tool.

claude-api-proxy --no-launch
# Proxy running. Launch claude manually:
#   ANTHROPIC_BASE_URL=http://127.0.0.1:3131 ANTHROPIC_API_KEY=proxy claude

claude-api-proxy --port <n>

Use a custom port instead of the default 3131.

claude-api-proxy --port 8080

claude-api-proxy --verbose / -v

Log each forwarded request and which key is being used to stderr.

[claude-api-proxy] → POST /v1/messages (key: work)

Key storage

Keys are stored in ~/.claude-api-proxy.json:

{
  "keys": [
    { "label": "work",     "key": "sk-ant-...", "active": true },
    { "label": "personal", "key": "sk-ant-...", "active": true }
  ],
  "currentIndex": 0
}

The proxy rotates currentIndex forward on exhaustion. After cycling through all keys, it resets. The file is updated on disk after each rotation so the active key persists across restarts.


Platform support

| Platform | Status | |---|---| | Linux | ✅ Supported | | macOS | ✅ Supported | | Windows | ✅ Supported |


Contributing

See CONTRIBUTING.md for local dev setup, architecture notes, and the release process.


License

MIT — see LICENSE.