Evidence snapshot reviewed Sep 10, 2026GitHub checked Aug 21, 2026
Evidence-verifiedPlugin BundleSearch, Vision & DataWeb Profile

DSH Usage Statistics Panel

A DSH web Settings panel for exploring token usage, cache-hit rates, activity, and model/provider breakdowns.

At a glance

What it does

A DSH web Settings panel for exploring token usage, cache-hit rates, activity, and model/provider breakdowns.

Use cases
Search, Vision & DataDataVisualizationConfiguration
Works with
Deepseek HarnessReact
Compatibility

Web Profile
>=0.1.2-rc.1

Trust & status

Evidence-verified
Checked Sep 10, 2026, 2:03 PM UTC

Code-evidenced contributions

What it adds to DSH

Web UIUsage Statistics Panel

Adds a Settings page with token-usage cards, an activity heatmap, trends, and model/provider breakdowns.

Mechanism evidence

Before you choose it

This plugin adds a Usage Statistics page to the DSH web Settings UI. It visualizes daily token trends, a 26-week activity heatmap, cache-hit rate, and usage by model or provider; it also offers optional session-footer detail displays.

Best for

DeepSeek Harness users who want to inspect their own session token consumption and usage patterns in the web UI.

Common tasks

  • Compare token usage across recent 7-, 14-, 30-, or 90-day periods or a custom date range.
  • Identify active days and daily token trends with the heatmap and stacked trend chart.
  • Review usage attributed to models and providers, including detailed entries grouped under Other.
  • Enable more precise cache-hit-rate and session-token details in the session footer.

Permissions and data

The plugin observes DSH session events and historical session logs to build local usage statistics.

Permissions
  • Reads session event data and historical session logs for token and attribution information.
  • Adds a Usage Statistics page and a same-origin `/usage/api` route.
Data handling
  • Stores usage history locally at `$DSH_HOME/storages/usage_history.json`.
  • The supplied README states that storage is local and has no external dependency.

Limitations

  • Statistics begin when the plugin is enabled, including its documented historical replay; older logs without provider-reported usage cannot be reconstructed.
  • A subagent's first request can be attributed to an `(unknown)` bucket when its routing event arrives later.
  • The documented reset operation clears local statistics before replaying session logs.
  • The package has a prepare lifecycle script, and installation was not executed in the supplied evidence.

What DSHub checked

  • The package manifest, bundle patch, immutable Git source, npm registry identity, MIT license, Node >=20 engine, and declared peer dependencies were captured.
  • The README documents the panel's features, local storage location, data-source behavior, and DSH CLI installation command.

What DSHub did not check

  • Installation, boot, UI rendering, historical replay, reset behavior, and runtime compatibility were not executed or independently tested from the supplied evidence.
  • Published npm package contents were not audited.

Pinned install

Install DSH Usage Statistics Panel

This plugin bundle does not have a DSH Plugin install action. Use its source documentation for the delivery method.

Visit the source project

Maintainer source

Project README

View at commit 9b0e776
Maintainer-authored contentCaptured from README.md on Sep 10, 2026. The text and repository-relative media are fixed to commit 9b0e77673a6d with content hash 974bdd6c4343; provider-hosted badges may update independently. README commands are upstream documentation; the DSHub copy action above is the verified, version-pinned install.

DSH Usage Statistics Panel

English | 中文

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="docs/banner-zh-dark.svg"> <img src="docs/banner-zh.svg" alt="DSH Usage Statistics Panel" width="720"> </picture> </p>

npm version npm downloads License TypeScript dsh-plugin Awesome DSH Plugin Commit activity Last commit

DSH web 插件的用量统计面板:按天 Token 趋势、GitHub 风格活跃热力图、缓存命中率曲线、按模型与按供应商两种用量拆分(堆叠柱状图 + 明细列表),在设置页新增一个"使用统计"页面。

所有图表均为手绘 SVG,不依赖图表库;配色使用 GitHub Primer 的 data-viz 双套色板(模型前 10 名、供应商前 5 名各取一个等级色,其余归入灰色 "Other" 桶),并随 DSH 主题自适应。

<p align="center"> <img src="docs/demo-zh.svg" alt="demo:安装后设置页出现「使用统计」入口,进入面板后卡片、热力图、趋势与柱状图依次点亮" width="720"> </p>

预览

<p align="center"> <img src="docs/images/panel-overview.png" alt="面板概览:汇总卡片、活跃热力图与按天 Token 趋势" width="720"> </p><p align="center"> <img src="docs/images/model-usage.png" alt="模型用量与各供应商用量:堆叠柱状图与明细列表" width="720"> </p><p align="center"> <img src="docs/images/provider-usage.png" alt="各供应商用量与面板设置项:柱状图、明细列表与三个开关" width="720"> </p>

功能

  • 时间范围:最近 7 / 14 / 30 / 90 天,或自定义起止日期
  • 汇总卡片:Token 用量、会话数量(完成的 turn)、请求数量、活跃天数、平均缓存命中率、最常用模型
  • 26 周活跃热力图:每日 token 用量的 GitHub 风格色阶,悬停查看当天明细
  • 按天 Token 趋势:堆叠柱状图叠加平滑的缓存命中率曲线(Catmull-Rom 样条),悬停查看各模型拆分
  • 模型用量:堆叠柱状图 + 明细列表,前 10 名模型分色,其余折叠为可展开的 "Other" 明细;柱状图滚入视野时自基部升起
  • 供应商用量:同一结构上移一层——前 5 名供应商分色(独立色板),其余归入灰色 "Other";悬停任一侧联动另一侧,柱状图悬停显示该供应商的全部模型用量;每行可展开该供应商的模型明细,"Other" 展开被折叠的供应商、其下再展开各自的模型(展开不影响柱状图高度)
  • 底部信息栏增强:设置页可开启"精确缓存命中率"(会话底部信息栏的缓存命中率以两位小数显示,如 85.25%)与"会话 Token 明细"(底部信息栏显示总 Token、输入、输入(命中缓存)、输入(未命中缓存)与输出 Token,替代默认的"输入/输出"两项);开关位于"使用统计"面板底部,与"侧边栏快捷入口"同款样式,切换即时生效
  • 历史回扫:首次启用时枚举并回放既有会话日志;对挂载后才首次观测到的活跃会话,其挂载前的历史会在下一次启动时按事件序号边界回放补全,从安装日起尽量还原历史用量
  • 本地持久化:数据写入 $DSH_HOME/storages/usage_history.json(storage-domain),纯本地、无外部依赖

安装

dsh plugin --profile <name> add dsh-usage-statistics-panel@latest

装完硬刷新浏览器(Cmd/Ctrl+Shift+R):client 半的改动 DSH 会热加载,无需重启;仅 host 半(采集/存储/路由)更新时需要重启 DSH。

插件挂载后,在 Web UI 的设置页左侧导航会出现"使用统计"页面。

兼容性:本插件支持 DeepSeek Harness >= 0.1.2-rc.1(peer 声明不变),历史回扫双路径:0.1.2-rc.1list+inspect0.1.3-alpha.* 及以后版本走 list+open+分页 read+closeinspect 在新版宿主已移除)。开发依赖与核验目标对齐宿主 0.1.5-rc.1,V3 日志兼容由单测覆盖。

旧版本用户:使用 DeepSeek Harness 0.1.1-rc.20.1.2-alpha.* 的用户,请安装本插件的旧版本(0.1.9 及之前)。0.1.10 仅支持 >= 0.1.2-rc.1;自 0.1.11 起同一版本双路径支持 0.1.2-rc.10.1.3-alpha.*

数据来源

面板的数据采集是观测式的:插件订阅会话事件流(session/event)中的 assistant/messageassistant/chunk,提取 provider 上报的 token 用量(输入 / 输出 / 缓存读 / 缓存写),在单个会话内(turn, step) 去重(同一调用只计一次、保留先到的样本——两个官方适配器对流式采样与最终上报的数值完全一致;并发会话各自独立计数、互不吞样本)。模型归因优先取消息自带的 source(每次调用各自标注),缺失时回退到会话的路由折叠(request/context 事件或会话的 requestContext()),宿主重启后也不会落入 "(unknown)" 桶。首次启用时还会回扫既有会话日志补齐历史。

提示:Token 用量从插件启用(含回扫)之日起累计;更早的会话日志若无 provider 上报的用量数据,则无法回溯。

子代理会话:子代理是独立会话,其 token、请求与完成的轮次与顶层会话一并统计(实时采集覆盖全部会话事件流,重启后回扫同样覆盖子代理会话日志);父会话仅收到子代理结果摘要,不会重复计入。子代理会话早期的请求标记(step/start)先于其路由事件写入日志,首个请求可能统计在 "(unknown)" 桶——请求总数不受影响。

Token 口径:汇总卡片与趋势图的 Token 总量为服务商总口径——未缓存输入 + 输出 + 缓存读 + 缓存写,与服务商账单面板一致(DeepSeek 会把 prompt 拆成输入/缓存读两个不相交的桶,简单相加会漏掉占大头的缓存部分)。平均缓存命中率以输入侧(命中 + 未命中)为分母,其中未命中 = 未缓存输入 + 缓存写入——与会话底部信息栏(官方 StatsLine 口径)完全一致,两处读数不会出现分歧;命中率卡片下方同时展示缓存命中的绝对 token 量。

重建统计POST /usage/api/reset(与面板同源信任围栏保护)清空本地统计并按当前归因规则全量重放会话日志——用于历史数据损坏或归因规则升级后的重建。仍在进行中的会话以其重置时刻的日志长度为界:界内由重放重建、界外继续由实时采集,恰好各计一次。

开发

pnpm install
pnpm typecheck   # tsc --noEmit
pnpm test        # vitest
pnpm build       # tsc declarations + tsdown (host ESM + 双通道 client bundle)

设计与实现

  • Host 半src/):collector(事件订阅 + 回扫折叠)、storeusage_history storage-domain)、query(范围聚合,翻译自 reasonix 的 query.go)、routes/usage/api fenced JSON 路由,信任围栏与 /api 网关一致)
  • Client 半src/client/):UsageStatsPanel.tsx(手绘 SVG 图表,移植自 reasonix 面板 + Primer 配色)、locales(en / zh / zh-TW)、api/usage/api fetch 封装)
  • 双通道打包lib/client.js(官方 profile 通道,bundle id = 包名)与 lib/client-registry.js(插件注册表通道,bundle id = manifest id)。harness 0.1.x 官方加载链只消费前者;后者为外部 registry 通道预留,当前无消费者
  • 详细设计见 docs/design.md

致谢

本面板是对 reasonix 用量统计功能的复刻移植:作者曾为 DeepSeek-Reasonix 实现并贡献了该功能(PR #7238#7503),本插件按 DSH 的插件规范将其移植到 DeepSeek Harness,前端图表大比例复用原实现,数据层则基于 DSH 的会话日志与 storage-domain 重新实现。

Activity

HaoyueQin/dsh-usage-statistics-panel GitStock K-Line Chart

License

MIT

Operate deliberately

Install and manage

Prerequisites and target Profile

Target Web Profile

Delivery Dsh Bundle Git — HaoyueQin/dsh-usage-statistics-panel#9b0e77673a6d8679afcf65a452d4129bf3eaa6fe

Verify, update, and remove

Show lifecycle commands
Verify
dsh plugin --profile web list

Compatibility and access

DeepSeek Harness >=0.1.2 Rc.1; Node >=20 >=0.1.2-rc.1

Review compatibility evidence

Risk facts

Local Data Reset

The documented reset API clears local statistics and rebuilds them from session logs.

Evidence
Local Session Usage Storage

Usage history is stored locally in DSH storage.

Evidence
Evidence and editorial reviewManifest, Bundle patch, distribution and freshness

Immutable evidence

Review status and source activity

AI reviewed

Use the pinned source to inspect the reviewed bundle. Avoid double-mounting it alongside a bundle that already includes this package, as documented by the bundle patch.

AI reviewed Sep 10, 2026, 2:04 PM UTCGitHub facts last checked Sep 10, 2026, 2:04 PM UTC

No material source change has been recorded since this evidence baseline.

Next step

Follow the Plugin installation workflow

Subscribe to material changes for DSH Usage Statistics Panel