dsh-plugin-usage
Manifest valid★ 3Token usage statistics plugin for DeepSeek Harness: daily/custom-range views, model filters, call counts & cost, configurable pricing, theme-aware dashboard. Inspired by CC Switch.
dsh-plugin-usage
DeepSeek Harness 的 Token 用量统计插件:按天 / 自定义范围查看 Token、调用次数与成本,支持模型筛选、定价配置和年度热力图。
Token usage statistics for DeepSeek Harness.

功能
- 今日 / 近 7 天 / 近 30 天 / 全部 / 自定义范围(不限跨度),按小时·天聚合
- 模型筛选、按模型明细(请求数、输入/输出、缓存、成本、占比)
- KPI 网格里的「模型占比」卡:按总 Token 显示前 4 个模型与「其它」
- 参考成本可在 ¥ / $ 之间切换(固定汇率 1 USD = 7 CNY,宿主侧折算)
- 可配置的每百万 Token 价格表(内置 DeepSeek 常见模型默认价)
- 年度热力图;深/浅色自适应,只用 DSH 主题变量,无第三方图表库
安装
插件已发布到 npm:dsh-plugin-usage。
- DSH Desktop:设置 → 插件 → 添加插件,输入
dsh-plugin-usage - Web / CLI profile:
dsh plugin --profile <name> add dsh-plugin-usage,重启生效
升级同理(桌面端在插件页点更新,CLI 用 update)。
desktopprofile 由 Electron 应用独占,不能用dsh plugin --profile desktop操作。
配置
设置 → 插件 → dsh-plugin-usage 可改 currency 和 prices(每百万 Token 价格),写入 profile patch,重启保留。
currency 是默认显示币种;仪表盘上参考成本卡里的 ¥ / $ 切换只影响当前界面(同浏览器记住选择)。
价格优先匹配 provider/model,其次裸 model;未配置的模型标为「未定价」,成本记 0。
数据来源与口径
折叠 DSH 会话日志中已持久化的用量事件,不自己记日志:
- 读取走官方接口:活跃会话
snapshotEvents(),历史会话sessionPersistence.open/read,按revision跳过未变日志 - 计费对齐官方
tokenUsage投影:同一(turn, step)替换;llm/retry-started后的重试累加;assistant/attempt的 stream 用量也计入 - fork 会话按
inheritedEventCount跳过父会话前缀,不重复计费 - 费用 = Σ(各 Token 分桶 × 对应单价) / 1e6
- 价目表以美元 / 百万 Token 为基准(与 DeepSeek 官方价一致);显示
¥时按固定 7:1 折算,价目表本身不改写
兼容性
- DSH
>=0.2.0-rc.2 <0.3.0(engines.dsh),Node ≥ 22 - 更早的宿主保留
Session.events/readFrom回退路径
开发
npm install
npm run build # tsc → lib/,再生成 lib/client/index.js
npm test # node --test
CI 跑 install → build → test → bundle id 契约 → tarball 内容检查;推 v* tag 会校验版本、构建测试并创建 GitHub Release。
src/host/ 宿主:scan / fold / query / settings / aggregate / rpc
src/client/ 设置页「用量统计」仪表盘(纯 JS,样式内联)
scripts/ 构建客户端 bundle 入口
开发期也可用
--patch从源码加载:dsh web --patch cordis.yml(路径见cordis.yml)。
License
Compatibility
Versions
| Latest version | Published | Size |
|---|---|---|
| 0.1.0 | — | — |
| 0.1.1 | — | — |
| 0.1.2 | — | — |
| 0.1.3 | — | — |
| 0.1.4 | — | — |
| 0.2.0 | — | — |
| 0.2.2 | — | — |
| 0.3.0 | — | — |
Comments
Loading…
Similar plugins
by xchannel1987
Token usage statistics plugin for DeepSeek Harness - today's token consumption by model, cache hit rate, 7-day trend chart, optional header badge, persistent storage with auto cleanup.
★ 0
↓ 239/wk
MIT
JavaScript
Sep 24, 2026
dsh plugin --profile web add dsh-token-usage-xcby Jun-Jun-Gao
DSH plugin — Token usage panel inside DeepSeek Harness settings: daily heatmap, 30-day trend, per-session breakdown and cost estimate.
★ 0
MIT
JavaScript
Oct 12, 2026
dsh plugin --profile web add dsh-token-usage-panelby skkjkk
DSH (DeepSeek Harness) usage statistics dashboard plugin: token / cost / duration / session aggregation with trend, heatmap and calendar views.
★ 3
Apache-2.0
JavaScript
Oct 15, 2026
dsh plugin --profile web add @skkjkk/dsh-usage-dashboardby BenYuan-Nolove-onani
Token usage statistics plugin for DeepSeek Harness — per-window consumption metrics with an enable/disable switch, right in Settings.----------DeepSeek Harness 的 Token 用量统计插件:按时间窗统计消耗指标,设置页内随时启停。
★ 0
↓ 89/wk
MIT
JavaScript
Aug 15, 2026
dsh plugin --profile web add dsh-token-statsby hugoyee75-cmyk
把经过 DeepSeek Harness 的每一次模型调用记下来,在侧边栏给你一个 Token 用量统计页。按模型/供应商/项目/来源/账号/日期拆分,带缓存命中率、趋势图表与自更新。A Token usage statistics plugin for DeepSeek Harness.
★ 3
MIT
JavaScript
Oct 19, 2026
dsh plugin --profile web add dsh-token-metricsby cute-baobao
DeepSeek Harness usage recorder plugin: per-model hourly token usage (input/output/cache hits) with a stacked bar chart dashboard in the Web GUI.
★ 3
↓ 124/wk
MIT
TypeScript
Aug 14, 2026
dsh plugin --profile web add @dsh-usage-meter/usage