前言¶
在 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