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-dscost-tide

v1.1.2

Published

DeepSeek peak/valley indicator in the DSH sidebar footer: phase at a glance, account balance, and a click-through dashboard with balance plus time-dimensioned token, cache-hit, cost and request statistics

Readme

dsh-dscost-tide

在 DeepSeek Harness 侧边栏底部看一眼就知道:现在是高峰还是低谷、账户还有多少钱、这些钱花在哪些 token 上。

一个 DSH 组合包(Cordis 插件)插件,占用侧边栏底部的 sidebar.footer.action 座位,排在官方余额插件之后。

长什么样

侧边栏底部是一张两行卡片,高峰染红、低谷染绿:

● 高峰期   距入谷 2 小时 30 分
¥余额                      14:32

鼠标移上去,先在卡片旁边弹出一个小窗,只报今日的三个数:

今日用量                 09:30:00
消耗 token      1258 万
缓存命中率      98.00%
消耗金额        ¥0.0842

点一下卡片,详情窗口弹在卡片正上方(底边离卡片顶边 8 px,左边框与卡片左边框对齐,宽 440 px,四个区);再点一下卡片或点空白处关闭:

现在 高峰期
高峰按时段价,低谷五折              ← Hero 胶囊

计费时段
倒计时        距入谷 2 小时 30 分
下次切换      今天 12:00(入谷)
[ 24 格峰谷条:凌晨 / 上午 / 午后 / 晚间 ]

账户余额
总余额        ¥余额
更新时间      09:30:00

用量统计                [今天][近 7 天][近 30 天][全部]
消耗 token    12,580,245      缓存命中率   98.00%
消耗金额      ¥1.2345         API 请求次数  128
提示词        12,345,678(命中 12,098,764 · 未命中 246,914)
输出          234,567
模型调用      128 次 · ¥1.1945
联网搜索      2 次 · ¥0.0400
统计天数      7 天 · 日均 ¥0.1764
统计区间      2026-01-01 至 2026-01-07

上图所有数字均为示意值,与任何真实账户无关。

功能

  • 峰谷一眼可见:按官方峰谷时段(北京时间工作日 09:00–12:00、14:00–18:00 为高峰,其余为低谷;2026-08-23 起周末全天低谷)给卡片染色,并显示距下次切换的倒计时。
  • 账户余额:优先读取 Host 已授权的 DeepSeek 账户余额(只显示总余额一行与取数时间),读不到时回退到 DEEPSEEK_API_KEY 查询 api.deepseek.com/user/balance。
  • 悬浮速览:鼠标停在卡片上(或键盘聚焦)先出一个小窗,只显示今日的消耗 token、缓存命中率与消耗金额,加载中/失败时给出状态行;点击才展开完整详情,再点一次关闭。
  • 用量统计(按时间维度):今天 / 近 7 天 / 近 30 天 / 全部 四档,给出消耗 token、缓存命中率、消耗金额、API 请求次数,以及提示词命中/未命中、输出、模型调用、联网搜索、日均与统计区间。
  • 真实计价:token 不估算,逐个 assistant/message 事件按它自己的时间戳套用当时生效的峰谷价(含 2026-09-10 12:00 的 Flash 调价),联网搜索按 ¥0.02/次计。
  • 不打扰:只在弹窗打开时拉取用量;折叠结果按会话日志版本号缓存,刷新只重读变化的日志。

安装

方式一:作为组合包安装(推荐)

发布到 npm 之后,在 DSH 的 插件 页直接安装并启用:

npm install -g dsh   # 已有 DSH 可跳过
dsh plugin add dsh-dscost-tide

或在「插件 → 已安装」里打开本插件。装好后完全退出并重启 DeepSeek Harness(客户端 bundle 在启动时预载,热更新拿不到新的 UI 代码)。

方式二:从本地源码 link: 安装

适合改代码调试。编辑 ~/.dsh/profiles/<profile>/package.json:

{
  "dependencies": {
    "dsh-dscost-tide": "link:E:/path/to/dsh-dscost-tide"
  },
  "dsh": {
    "profile": {
      "bundles": ["...", "dsh-dscost-tide"]
    }
  }
}

然后在 profile 目录执行一次 pnpm install,再完全重启 DSH。源码改动同样需要重启才能生效。

卸载

在插件页关闭或移除即可;手动安装的话,删掉 dependencies 与 dsh.profile.bundles 里的条目,重启。

计费口径

| 模型族 | 低谷 · 输入 | 低谷 · 缓存命中 | 低谷 · 输出 | 高峰 | | --- | ---: | ---: | ---: | ---: | | Flash(deepseek-v4-flash / deepseek-flash) | ¥1 / 1M | ¥0.02 / 1M | ¥4 / 1M | ×2 | | Flash(2026-09-10 12:00 之前) | ¥1.5 / 1M | ¥0.05 / 1M | ¥4.5 / 1M | ×2 | | Pro(deepseek-v4-pro) | ¥4.5 / 1M | ¥0.15 / 1M | ¥13.5 / 1M | ×2 |

  • 高峰窗口:北京时间 工作日 09:00–12:00、14:00–18:00;低谷 = 其余时间(2026-08-23 起含周末全天)。
  • 峰谷价自 2026-08-17 起生效;更早的会话按低谷价计。
  • 一次调用的花费 = 未命中 token × 输入价 + 命中 token × 缓存价 + 输出 token × 输出价;联网搜索另计 ¥0.02/次。
  • 金额单位 CNY。价格随官方调整而变化,若与账单有出入,以 DeepSeek 官方定价 为准。

数据来源与隐私

  • 峰谷:纯本地时钟计算,不联网。
  • 余额:Host 侧账户授权(或你配置的 DEEPSEEK_API_KEY)向 DeepSeek 查询,只走本机回环路由 /dsh-dscost-tide/api/balance。
  • 用量:只读本机 ~/.dsh/sessions/** 会话日志,不读取、不外发任何消息内容;fork/子代理会话按 inheritedEventCount 跳过继承的父前缀,避免重复计数。
  • 两条路由都只服务本机回环请求:校验 Host 必须是回环或受信主机,拒绝跨站请求与不匹配的 Origin。

兼容性

  • 需要 DeepSeek Harness 0.2.x(engines.dsh: >=0.2.0-rc.1 <0.3.0-0),在 0.2.1-rc.5(Windows 桌面端)上验证。
  • 浏览器端需要 @deepseek-ai/dsh-client-ui-primitives(存在时使用其 Modal,缺失时自动回退到自带遮罩层)。
  • Node.js ≥ 22(仅开发/测试需要)。

开发

node --test test/plugin.test.mjs  # 纯函数级离线测试,不需要 DSH 运行时
node scripts/check-publish.mjs     # 发布前自检(清单字段 / 文件 / 占位符)
node scripts/prepare-publish.mjs   # 生成可发布副本并打包,打印 tarball 内容

prepare-publish 会把可发布的文件复制到 _intermediate/publish/,并改写仓库地址。本地工作树里的 name 保持 dsh-dscost-tide 不动(它是 profile dependencies / dsh.profile.bundles 里的安装键),npm 上的包名也沿用同一个,发布前跑一次:

node scripts/prepare-publish.mjs --repo yuchilling/dsh-dscost-tide
cd _intermediate/publish && npm publish --access public

npm 会先在建包时写一个 0.0.0-stage 占位版本再上传正式版本,这是 npm 对 bypass-2FA token 的新策略,属正常现象。发布只需要一次 npm publish,无需再批准。

许可

MIT