jkStars/dsh-token-usage-stats
DSH Web 插件:跨会话的 Token 用量、请求次数与可选成本统计(ctx.tokenUsageStats),自带独立仪表盘页面(/token-usage-stats,JSON 数据源 /api/token-usage-stats)以及侧边栏底部入口(页内模态框打开仪表盘)。
catalog descriptioncatalog 简介 / catalog description:DSH plugin: cross-session token usage analytics with a web dashboard (ctx.tokenUsageStats)
Project Overview项目介绍
This is a native web plugin built exclusively for DeepSeek Harness (DSH), designed to track cross-session token consumption, API request counts, and calculate optional usage costs for DeepSeek API calls. It ships with a standalone statistics dashboard accessible at the /token-usage-stats endpoint, a JSON data API at /api/token-usage-stats, and adds a quick access entry at the bottom of DSH’s sidebar that opens the dashboard in an in-page modal. To install the plugin, you can run the DSH CLI command dsh plugin --profile web add dsh-token-usage-stats@latest, then restart the DSH host or refresh the GUI to activate it.
After installation, you can open the dashboard either by clicking the "Usage Stats" entry in the sidebar or navigating directly to the dashboard URL in your browser. By default, the dashboard displays hourly stats for the current day, but you can switch between five time ranges: today, last 3 days, last 7 days, last 30 days, and all time. The dashboard automatically adjusts grouping granularity based on the selected range to keep charts clear and uncluttered, and it auto-refreshes every 10 seconds to pull the latest usage data. This tool is ideal for DSH users who want to track their DeepSeek API spending and avoid unexpected charges.
Currently, the plugin only supports tracking usage and costs for DeepSeek’s official API, pulling all usage data from local DSH session logs; it does not support tracking API usage from third-party providers or other channels. Users can configure their preferred display currency and custom pricing per million tokens for any model, with built-in support for peak and off-peak pricing tiers based on Beijing time. Default pricing for DeepSeek’s official models is already included, and the plugin is open source under the permissive MIT license, free for anyone to use and modify.
这是一款专为 DeepSeek Harness 开发的原生网页插件,用于统计跨会话的 Token 用量、API 请求次数,并支持可选的成本计算。插件自带独立的统计仪表盘页面(路径 /token-usage-stats),提供 JSON 格式数据源接口(/api/token-usage-stats),还在 DSH 侧边栏底部添加了入口,点击可通过页内模态框打开仪表盘。用户可通过 DSH 自带的插件命令直接在线安装,安装后重启宿主或刷新 GUI 即可使用。
安装完成后,用户可以点击侧边栏底部的「用量统计」入口打开仪表盘,也可以直接访问对应路径打开统计页面。仪表盘默认展示当日按小时分组的统计数据,支持切换今日、近3天、近7天、近30天、全部范围五种统计区间,不同区间会自动适配合适的时间分组粒度,保证图表清晰不拥挤。这款插件适合需要监控自己 DeepSeek API 用量、控制 API 调用成本的 DSH 用户使用。
目前该插件仅支持统计 DeepSeek 官方 API 的用量和成本,数据基于本地 Harness 会话日志回放生成,不支持统计其他渠道或第三方提供商的 API 费用。用户可自行配置显示货币和各模型的百万 Token 定价,支持区分高峰闲时段不同计价,插件已内置 DeepSeek 官方模型的默认定价。该插件采用 MIT 许可开源,免费供用户使用和修改。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-token-usage-stats(jkStars/dsh-token-usage-stats)
仓库:https://github.com/jkStars/dsh-token-usage-stats
本站详情页:https://www.yhbd.top/plugins/jkstars-dsh-token-usage-stats/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 3 · 最近提交 2026-09-26 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add dsh-token-usage-stats@0.3.14
把 jkStars/dsh-token-usage-stats 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-token-usage-stats
DSH Web 插件:跨会话的 Token 用量、请求次数与可选成本统计(ctx.tokenUsageStats),自带独立仪表盘页面(/token-usage-stats,JSON 数据源 /api/token-usage-stats)以及侧边栏底部入口(页内模态框打开仪表盘)。
截图
侧边栏底部入口 — 点击「用量统计」打开仪表盘

仪表盘 - 今天视图(成本堆叠、token 趋势、构成占比、按模型与 TOP 对话表)

构成明细悬浮提示(悬停柱子查看分类明细)

全部范围 - 按天视图

说明:目前仅统计 DeepSeek 官方 API 的费用(token 用量、请求次数与成本基于本地 Harness 会话日志回放),不包含其它提供商/渠道的 API 费用。
安装
dsh plugin --profile web add dsh-token-usage-stats@0.3.14
插件的 cordis.patch.yml 会插入插件行;浏览器半区通过 dsh.client 清单自动加载。安装后重启宿主(或刷新 GUI)。
更新到新版本:
dsh plugin --profile web add dsh-token-usage-stats@latest
使用
从侧边栏底部入口打开仪表盘,或直接访问 http://<host>:<port>/token-usage-stats。
页面默认显示「今天」的按小时视图,可切换 今天 / 近 3 天 / 近 7 天 / 近 30 天 / 全部 范围,其中「近 7 天」、「近 30 天」和「全部」显示按天视图(「全部」在跨度较长时会自动按自然周或自然月折叠展示,确保图表清晰不拥挤)。每 10 秒自动刷新一次。仅当配置了模型定价时才显示成本金额。
配置
插入行支持 config.currency(成本显示货币)与 config.pricing(各模型每百万 token 的价格)。成本按高峰/闲时两档计价:高峰为北京时间 09:00-12:00、14:00-18:00,其余北京时段为闲时;周末(北京时间周六/周日)全天按闲时。用 peak/offpeak 两档的模型按使用时间取对应档位;只用四个平档键(uncachedInputPerMillion / cacheReadPerMillion / cacheWritePerMillion / outputPerMillion)的模型任意时段同价。默认行带 currency: CNY,以及 deepseek-flash 与 deepseek-v4-pro 的官方高峰/闲时定价(自动兼容 deepseek-v4-flash* 历史模型别名)。
在 profile 自己的 cordis.patch.yml 中覆盖示例:
- patch:
- id: token-usage-stats
config:
currency: USD
pricing:
deepseek-flash:
peak:
uncachedInputPerMillion: 2.0
cacheReadPerMillion: 0.04
cacheWritePerMillion: 0
outputPerMillion: 8.0
offpeak:
uncachedInputPerMillion: 1.0
cacheReadPerMillion: 0.02
cacheWritePerMillion: 0
outputPerMillion: 4.0
开发
pnpm install # devDependencies 通过 link: 指向本地 deepseek-harness checkout
pnpm run build # tsc -> lib/types, tsdown -> lib/index.js + lib/client.js
devDependencies 通过 link: 条目解析 @deepseek-ai/dsh-* 的类型,要求 harness checkout 位于本包上一级目录 ../deepseek-harness。运行时 peer 依赖由 dsh 宿主提供,不从 npm 安装。
发布
npm run build
npm publish # 自动执行 prepublishOnly(npm run build)
仓库与反馈
- npm:https://www.npmjs.com/package/dsh-token-usage-stats
- 源码:https://github.com/jkStars/dsh-token-usage-stats
欢迎提 Issue 或 PR。
wssfk12138/dsh-damage-pulse
OK-wx/dsh-ocgo-lite
falling-ts/dsh-force-compact
AlexPeng07/dsh-custom-plugin
Andrew111888/dsh-plugin-balance
1514100951/dsh-usage-footer
AnnanRen/dsh-usage-suite