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

@qzsy/dsh-plugin-usage-billing

v1.3.4

Published

计费显示:从既有会话日志聚合真实 token 用量,按事件时刻价格写时锁定费用;侧栏 / 输入框下方入口 + 点击弹层 + 设置页用量视图。

Readme

@qzsy/dsh-plugin-usage-billing

Fork of @zzerx/dsh-plugin-usage-billing by 0x7A7A (MIT). See NOTICE for changes; runtime behavior is preserved.

Install

dsh plugin add @qzsy/dsh-plugin-usage-billing

Upstream README

@zzerx/dsh-plugin-usage-billing

从既有会话日志聚合真实 token 用量,按事件发生时刻的价格写时锁定费用。入口可以放在侧栏底部或输入框下方,点开就能看到本月花了多少、离预算还有多远。不伪造样本:没有数据就显示空快照,未收录的模型绝不静默计 0。

安装

dsh plugin --profile <你的 profile 名> add @zzerx/dsh-plugin-usage-billing

用量视图在设置 → 计费里。

怎么用

  • 两个计费入口,各自开关(设置 → 计费 →「计费入口位置」):侧栏底部是一张卡,显示本月 / 今日金额与预算进度,卡的左侧并着一条 75×35 的 mini 峰谷图(只在侧栏宽态画);输入框下方是一粒小胶囊,显示当前会话金额与预算饼图。两处都关掉也能从设置页看用量。
  • 点入口弹出详情:本月已用 / 预算、累计(会话 / 项目)、今日消耗分布(本项目 / 其他项目),以及未收录模型的提示。点面板外或按 Esc 关闭。面板顶部的峰谷时段图与侧栏卡左侧的 mini 图可以在设置里一起关掉(设置 → 计费 →「显示峰谷时段图」,默认开)。
  • 设置里的用量视图分三页:概览(累计与今日的 Token 和金额、活跃度热力图、分模型消耗)、趋势、明细(逐日 / 按模型 / 生效价目三张表,可过滤、排序、分页)。
  • 月度预算:设置里填金额(默认 ¥100),跨 50% / 80% / 100% 各提醒一次,进度条 ≥80% 转琥珀、超支转红。
  • 峰谷分时:北京工作日 09:00–12:00 与 14:00–18:00 按高峰价,其余时段(含周末与法定节假日全天)按空闲价 = 高峰价 × 0.5。判档按事件发生时刻定,写进账本后不再随改价变动。
  • 价表:内置表 + models.dev 联网投影(联网优先、内置兜底),汇率取 open.er-api.com,默认每 6 小时后台刷新,也可在设置里手动刷新。联网失败会降级为内置价并标明,不假装是实时价。
  • 自定义单价与别名:可以给某个 provider / model(也支持 <provider>/*、*/*)配自定义价;未收录或已改名的模型可以手工绑到标准模型上,只在同一个 provider 内合并展示,不改动账本。

计费口径

  • 写时锁定:每条助手回复的 token 用量按该事件发生时刻的价格计价并写入账本,之后改价不影响历史。只有「未计价」的行可以按当前价表重算。
  • 为什么会显示「—」:价表里没有这个模型,或命中了美元价但当时没有可用汇率 —— 这两种情况都不写金额,宁可标成不可计价,也不猜一个 0 记进账本。
  • 安装前的历史:插件装上之前的记录没有真实价格,按安装时的价表估算,并在三处标明是估算(设置页顶部提示条、概览 / 趋势 / 明细里的「估算」角标、常驻的口径说明)。
  • 统计维度:provider / 模型 / 天 / 会话 / 工作区,按本机时区归天。子代理会话默认计入,可在设置里筛选。
  • 不占用模型额度:本插件不注册任何模型工具,也不注入系统提示段。

已知边界

  • 目录刷新(含它的网络请求)期间会占用写锁,此时改自定义价要等它结束。
  • 改了刷新间隔要等当前缓存过期才生效。
  • 会话维度的数据由「按工作区」的分组结果带回,在明细页展开工作区时才看得到。
  • 热力图的单格明细只在悬停 / 触摸提示里;键盘用户读到的是上方的活跃天数与区间合计。

开发

pnpm --filter @zzerx/dsh-plugin-usage-billing build       # lib/index.js + lib/client.js + lib/types
pnpm --filter @zzerx/dsh-plugin-usage-billing typecheck

License

MIT