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

dsh-usage-dashboard

v0.1.0

Published

DeepSeek Harness (dsh) web plugin: API balance + today's spend widget in the sidebar footer. /api/dsh-usage route + React client bundle, no build step required.

Readme

dsh-usage-dashboard

DeepSeek Harness (dsh) 的 Web 插件:在侧边栏底部显示 API 余额今日花费

  • 余额:通过 DeepSeek API GET /user/balance 实时获取(带缓存,默认 60s)
  • 今日花费:扫描 $DSH_HOME/sessions 的会话日志(zstd 多帧解码),汇总今日 token 用量 × 官方定价估算
  • 支持 DeepSeek 2026-08-17 起的峰谷定价(高峰 9-12 / 14-18 点,空闲半价),按每条请求的发生时间自动选用费率

界面

侧边栏底部小部件:

  • 展开时显示 余额 ¥xx.xx今日花费 ¥xx.xx,点击展开详情卡(余额构成、调用次数、Token 用量、按模型明细、计价方式)
  • 收起时显示 ¥ 图标按钮,悬停提示
  • 每 60 秒自动刷新,可手动点击刷新

安装

前提:已安装 dshdsh web 可正常运行)。

方式一:npm 安装(发布后)

dsh plugin add dsh-usage-dashboard --profile web

方式二:本地目录

# 把本仓库克隆/复制到 profile 的 node_modules 下
mkdir -p ~/.dsh/profiles/web/node_modules/dsh-usage-dashboard
cp -r lib package.json ~/.dsh/profiles/web/node_modules/dsh-usage-dashboard/

然后在 ~/.dsh/profiles/web/cordis.patch.yml 追加:

- insert:
    - id: usage-dashboard
      name: 'dsh-usage-dashboard'
      config:
        apiKeyRef: DEEPSEEK_API_KEY

重启 dsh web 生效。

配置

| 字段 | 说明 | 默认 | |---|---|---| | apiKeyRef | DeepSeek API Key 的凭证引用 | DEEPSEEK_API_KEY | | baseURL | 余额接口地址;留空则用 $DEEPSEEK_BASE_URL,再回退 https://api.deepseek.com | "" | | prices | 按模型单价覆盖(元 / 百万 tokens:{ input, cacheRead, output }) | 官方现行价 | | priceSchedule | 日期生效的峰谷定价表 { from, peak, idle } | 2026-08-17 起峰谷定价 | | balanceCacheMs | 余额缓存毫秒数 | 60000 | | sessionsRoot | 会话日志目录覆盖 | <dsh home>/sessions | | scanWindowMs | 只扫描此时间窗口内修改的日志 | 48h |

默认价格(官方现行价,2026-08-17 前)

| 模型 | 缓存命中 | 缓存未命中 | 输出 | |---|---|---|---| | deepseek-v4-flash | ¥0.02/M | ¥1/M | ¥2/M | | deepseek-v4-pro | ¥0.025/M | ¥3/M | ¥6/M |

2026-08-17 起峰谷定价(已内置,无需配置)

| 模型 | 时段 | 缓存命中 | 未命中 | 输出 | |---|---|---|---|---| | flash | 高峰 | ¥0.10 | ¥3.0 | ¥9.0 | | flash | 空闲 | ¥0.05 | ¥1.5 | ¥4.5 | | pro | 高峰 | ¥0.30 | ¥9.0 | ¥27.0 | | pro | 空闲 | ¥0.15 | ¥4.5 | ¥13.5 |

价格有变动时在 cordis.patch.ymlprices / priceSchedule 里覆盖即可。

说明

  • 花费为估算:按 token 用量 × 官方单价计算;不含联网搜索、标题生成等日志中未记录 token 用量的调用
  • 余额数字来自官方接口,为准确值
  • 接口 GET /api/dsh-usage 只在本机 127.0.0.1 上服务,API Key 不离开服务端

开发与测试

npm test          # 运行 host 逻辑 + 客户端 bundle 物化 + SSR 渲染测试

License

MIT