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

@weiyongw/token-rank

v0.1.2

Published

Token Rank usage collector and leaderboard prototype.

Readme

Token Rank

Token Rank 是一个独立的用量采集和排行榜原型。当前版本先把产品闭环跑通:

  • 支持渠道:codexclaudehermes
  • 统一按上海时间统计
  • 本地解析原始日志,不上传 prompt、文件路径、工具输出
  • 上传/入库粒度为小时级聚合快照
  • 覆盖式 upsert,重复同步不会把数据翻倍
  • 设备 token 采用 7 天滑动有效期
  • 本地客户端每天第一次使用时打开排行榜页
  • 云服务器/headless 模式不自动打开网页

运行

token-rank 目录下:

npm run scan
npm start

或者直接:

node ./bin/token-rank.js scan --days 30 --local
node ./bin/token-rank.js serve

看板地址默认是:

http://127.0.0.1:4577

Watch 模式

本地客户端/桌面模式:

node ./bin/token-rank.js watch

云服务器模式:

node ./bin/token-rank.js watch --headless

连接官网

本地桌面用户:

npx -y @weiyongw/token-rank@latest watch --site https://zhenganhuo.com

云服务器:

npx -y @weiyongw/token-rank@latest watch --site https://zhenganhuo.com --headless

面向小白用户/AIAI 的发布命令:

npx -y @weiyongw/token-rank@latest watch --site https://zhenganhuo.com

测试一次同步:

node ./bin/token-rank.js watch --once

数据模型

当前本地模拟云端存储在:

token-rank/data/store.json

核心数据是:

  • hourly_model:用户 + 上海小时 + 渠道 + 模型
  • hourly_tool:用户 + 上海小时 + 渠道 + 模型 + 工具
  • sessions:用户 + 日期 + 渠道 + 会话 hash
  • daily_user:排行榜日汇总

后续替换成云端时,可以把这些对象分别落到 RDS 表:

  • usage_hourly_model
  • usage_hourly_tool
  • usage_sessions
  • usage_daily_user

设备授权

原型已经预留设备码接口:

  • POST /api/devices/start
  • POST /api/devices/confirm
  • POST /api/devices/poll
  • POST /api/ingest/hourly-snapshot

真实接官网时,把这些接口迁到官网服务端即可。CLI 或客户端只需要保存 device_token,每次成功同步刷新 7 天滑动有效期。