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

@guangnao/claude-hub

v1.0.23

Published

Pool many claude subscription nodes behind one Anthropic-compatible /v1/messages endpoint. Star topology: nodes dial out, the hub load-balances.

Downloads

627

Readme

claude-hub

把多台机器的算力汇成一个标准的 Anthropic /v1/messages

客户端只面对一个地址,请求由 hub 按「最闲的那台」分发;某台限流或掉线时会在流开始前透明换一台,客户端察觉不到。

安装

npm i -g @guangnao/claude-hub

需要 Node 20.12+。

claude-hub start          # 起中心(pm2 托管,崩了自己起来)
claude-hub status         # 看池子,--watch 持续刷新
claude-hub upstream       # 把一个 API 端点当节点接进池子(交互选择)
claude-hub weight=3 [ID]  # 设权重,越大分到的活越多;省 ID 则全池统一
claude-hub rekey          # 换一把新的 API key(重启后生效)
claude-hub stop           # 停

start 不需要任何配置:端口取 8790,API key 没有就现生成一把,连同端点地址一起打给你。

curl http://<hub>:8790/v1/messages -H "x-api-key: <start 打出来的 key>" \
  -H 'content-type: application/json' \
  -d '{"model":"claude-sonnet-4-5","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'

加一台算力机器

hub 自己不产算力 —— 它只负责把请求分给谁。出算力的那一头装 claude-cli:它把那台机器上的 claude 订阅 暴露成一套标准的 /v1/messages,然后向外拨号接进 hub(节点多半蹲在 NAT 后面,没有公网地址, 而向外的一条 443 谁都拨得通)。

# 每台出算力的机器(它得先有可用的 claude 登录)
npm i -g @guangnao/claude-cli
claude-cli hub https://你的hub地址          # 指到这台 hub(只是存下来,不启动)
claude-cli start                           # 启动,接入是启动时自己完成的

(那台机器上如果已经在跑 claude-cli,改完地址要 claude-cli stop && claude-cli start 才生效。)

配了 HUB_NODE_TOKEN 的话,节点那边要在地址后面跟上同一个令牌: claude-cli hub https://你的hub地址 <令牌>。不配就是开放接入 —— 谁拨进来都算一台。

接进来之后 claude-hub status 就能看到它,以及它在途多少、TTFB 多少、累计干了多少。

节点不一定是机器

上面那种节点是一台真机器。但一个「地址 + 一把凭证」同样能当节点 —— 订阅机器管日常、API 额度扛尖峰,两者在同一个池子里按同一套规则调度(负载均衡、限流冷却、流前透明故障转移都一样)。

claude-hub upstream 进交互流程,上下键选、回车确认,再按提示填:

    Anthropic · Claude        api.anthropic.com
    Amazon Bedrock · Claude   bedrock-mantle.<region>.api.aws
  ❯ Custom · Claude           gateway baseURL + key

| kind | 端点 | 凭证 | | --- | --- | --- | | anthropic | api.anthropic.com/v1/messages | API key | | bedrock | bedrock-mantle.{region}.api.aws | AWS 访问密钥(SigV4,长期有效)或 bearer token(12h 上限) | | custom | 你给的网关 baseURL(/v1/messages 缺了自动补) | API key 或自定义鉴权头 |

凭证输入是星号回显,落盘在 <state>/upstreams.json(0600)。改完即刻生效,不用重启 hub;同 id 再加一次就是改(换一把过期的 key 用这个)。

claude-hub upstream ls        # 看已配的(不回显凭证,只报「配没配」)
claude-hub upstream rm <id>   # 摘掉一条

脚本里用非交互形式(非 TTY 时也只认这个):

claude-hub upstream add prod --kind anthropic --key sk-ant-xxx --capacity 8

配置

| 环境变量 | 缺省 | 说明 | | --- | --- | --- | | HUB_PORT / HUB_HOST | 8790 / 0.0.0.0 | 监听地址 | | HUB_API_KEY | 自动生成并存盘 | 客户端 key,认 x-api-keyAuthorization: Bearer | | HUB_NODE_TOKEN | 空 = 开放接入 | 节点接入令牌。比客户端 key 更狠:拿到它就能接成节点,于是读到派给它的请求正文 | | TZ | 系统时区 | status 里「今日 / 昨日」按哪个时区分界。服务器多半跑在 UTC,跨时区看会以为「今日没重置」——设成你自己的(如 Asia/Shanghai)就对齐了 |

MIT