前言¶
在 DSH 的 Web profile 中跑多组 provider、model、workspace 时,用量指标容易分散在 session logs 里。dsh-usage-monitor 是一个客户端插件,把 session 日志里的 token 与 request 用量汇总到 Settings → Usage,方便查看趋势、占比和缓存命中率。
这是什么¶
dsh-usage-monitor 的 owner 为 NOirBRight,定位为 Session-log usage dashboard for DeepSeek Harness。它读取 ctx.sessionQuery 的 live + persisted sessions,并在 Web UI 的 Settings → Usage 展示 tokens、requests、output tokens 与 cache-hit rate。许可证为 MIT。
核心功能¶
- 在
Settings → Usage展示tokens、requests、output tokens与cache-hit rate。 - 提供
stacked chart,可按token/request指标查看,并按provider/model/workspace分组,按day/week聚合。 - 支持
week、month和custom ranges。 - 提供响应式 overview:full-width token summary、compact secondary metrics、stacked chart 和 token-share cards。
- 窄屏时,cards 收拢为单列,chart legend 横向滚动。
安装与启用¶
先确认两个前提:DeepSeek Harness 需要 0.1.0-rc.6 或更高版本;package.json engines 要求 node ^22.19.0 || >=24.0.0。下面使用固定版本 v0.2.9 的 Release 安装命令:
dsh plugin --profile web add --force \
https://github.com/NOirBRight/dsh-usage-monitor/releases/download/v0.2.9/dsh-usage-monitor.tgz
安装后打开 Settings → Usage。如果通过 Settings 的 Web UI 插件 section 或 dsh.profile.bundles entry 配置,需要显式提供 credentials/backend addresses。
安装后可以用以下命令验证:
dsh plugin --profile web list
dsh plugin --profile web doctor
典型用法¶
查看插件加载情况:
dsh plugin --profile web list
dsh plugin --profile web doctor
更新到 latest Release:
dsh plugin --profile web add --force \
https://github.com/NOirBRight/dsh-usage-monitor/releases/latest/download/dsh-usage-monitor.tgz
卸载:
dsh plugin --profile web remove dsh-usage-monitor
回滚到 v0.2.9 时,重新执行 fixed v0.2.9 安装命令,验证 profile list,并重启 Web service once:
dsh plugin --profile web add --force \
https://github.com/NOirBRight/dsh-usage-monitor/releases/download/v0.2.9/dsh-usage-monitor.tgz
dsh plugin --profile web list
适用场景与注意¶
适合需要在 Web UI 中查看 DSH session 用量、按 provider/model/workspace 分析 token 与 request 分布的开发者。注意:
- 插件不获取 Subscription quotas。
- 插件不直接扫描
session.jsonl.zstd,也不读取 leftover community cache files。 - 插件读取
ctx.sessionQuery的 live + persisted sessions。 - v0.2.9 Release 工件面向 DeepSeek Harness 0.1.2-alpha.1,并只包含 built Host/Client files。
- Release 提供 v0.2.9 与 SHA256SUMS 校验链接;安装前建议核对来源、校验信息和许可证。
- 插件以当前
dsh进程权限运行;安装前应检查源码和配置来源。
DSH 社区目录是独立站点,与 DeepSeek / 幻方没有官方从属关系。
链接¶
GitHub 仓库:https://github.com/NOirBRight/dsh-usage-monitor