DeepSeek Harness 全量用量看板:按模型、供应商、工作区和时间范围分析 Token、缓存、余额、别名与 CSV 数据。
安装
# Release 预构建包
dsh plugin --profile web add "https://github.com/ParticleLight/dsh-all-usage/releases/download/v1.0.4/dsh-all-usage-1.0.4.tgz"
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:ParticleLight/dsh-all-usage
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
中文
DeepSeek Harness 全量用量看板:按模型、供应商、工作区和时间范围分析 Token、缓存与账户余额。
功能
- 热力图:53 周使用热力图;按工作区筛选并查看每日回合与 Token 明细
- 模型统计:支持混合查看、按模型合并、按供应商汇总三种维度,展示调用次数、各类 Token 与缓存命中率
- 摘要与工作区:Token 用量、缓存命中、账户余额、连续使用、工作区 Token 分布和明细
- 导出:按当前时间范围和模型聚合方式导出 CSV
- 时间范围:今日、近 30 天、近 90 天、全部
- 工作区别名:在侧栏入口打开看板后管理,持久化保存到 $DSH_HOME/storages 的 KV 单元
all-usage-aliases - 界面语言:在看板顶部切换中文与 English;选择会保存到浏览器本地
截图 / Screenshots


安装
本插件是标准的 DSH 社区插件包(声明 dsh.bundle manifest 与 Web Client),数据全部来自持久化会话日志,安装后自动回填历史。
官方插件命令(推荐)
dsh plugin --profile web add github:ParticleLight/dsh-all-usage
安装命令会装配 bundle;随后刷新浏览器页面以加载 Client,无需手动修改 profile。若当前 DSH 版本未动态装配新包,请按 DSH 的提示重载包或重启进程。
手动注册(本地包)
把本目录放入任意位置,并在 $DSH_HOME/profiles/node_modules/ 下创建指向本目录的符号链接(Windows 用 junction):
New-Item -ItemType Junction -Path (Join-Path $env:DSH_HOME 'profiles/node_modules/dsh-all-usage') -Target '<本目录绝对路径>'在 $DSH_HOME/profiles/web/cordis.patch.yml 添加一行:
- insert: - id: all-usage name: dsh-all-usage
用户 patch 层会被热重载:保存后刷新页面即可。
架构
- Host 端(
lib/index.js):扫描持久化会话日志聚合用量(turn/end+assistant/message.usage),监听session/event实时折叠;通过webServer服务注册数据路由:GET /api/all-usage— 统计快照GET /api/all-usage/balance?force=1— 账户余额(复用llm-deepseek的 API Key 配置)POST /api/all-usage/alias— 设置工作区别名
- Client 端(
lib/client.js):window.__ModuleLoader__工厂格式的浏览器 bundle,注册侧边栏「用量统计」入口(sidebar.footer.action槽位)。所有 API 仅接受本机 loopback 请求并拒绝显式跨域请求;余额读取与别名写入还要求插件启动时生成、仅在当前进程有效的令牌(余额 GET 兼容浏览器省略 Origin)。英文模式的日期分桶、范围筛选、连续使用、热力图和导出时间统一按 UTC;中文模式按本地时区。
数据说明
- 使用次数与 Token 全部来自 DSH 持久化会话日志,插件激活时会自动回填全部历史,插件卸载/重启后数据不丢
- 同一会话的同一
turn / step只保留一份最终 usage;重试或替换消息会替换旧贡献,不重复累计 - 看板中的总处理量 = 输入 + 输出 + 缓存读写 + 推理;缓存命中表示复用的上下文 Token,不等于新生成 Token 或实际费用
- 余额查询走 DeepSeek 官方
/user/balance接口;未配置 API Key 时卡片显示引导文案 - 仅统计能归属到已注册工作区(按会话 cwd 匹配)的会话
开发
- 修改
lib/client.js后刷新页面即可;修改lib/index.js后,需由 DSH 重载该包或重启进程,单纯刷新页面不会替换已运行的 Host 代码 - 插件包无第三方依赖:Host 端只使用 Cordis 服务,Client 端只使用 runtime 提供的 React 模块
English
A full usage dashboard for DeepSeek Harness. Analyze tokens, cache behavior, account balance, and activity by model, provider, workspace, and time range.
Features
- Heatmap: a 53-week activity heatmap with workspace filters and daily turn/token details
- Model analytics: mixed view, model-merged view, and provider summary with calls, token categories, and cache hit rate
- Summary and workspaces: processed tokens, cache hits, account balance, usage streaks, workspace distribution, and details
- CSV export: export data using the selected time range and aggregation mode
- Time ranges: today, last 30 days, last 90 days, or all time
- Workspace aliases: manage aliases from the sidebar dashboard; values persist in the $DSH_HOME/storages KV cell
all-usage-aliases - Interface language: switch between Chinese and English from the dashboard header; your choice persists locally in the browser
Installation
This is a standard DSH community bundle. It declares a dsh.bundle manifest and a web client, and backfills its data from persisted session logs after installation.
Official plugin command (recommended)
dsh plugin --profile web add github:ParticleLight/dsh-all-usage
The installation command assembles the bundle. Refresh the browser page to load the client; no manual profile edits are required. If your DSH version does not dynamically assemble newly installed packages, use its supported package reload or restart the process.
Manual local registration
Place this directory anywhere and create a symlink to it under $DSH_HOME/profiles/node_modules/ (use a junction on Windows):
New-Item -ItemType Junction -Path (Join-Path $env:DSH_HOME 'profiles/node_modules/dsh-all-usage') -Target '<absolute plugin path>'Add this entry to $DSH_HOME/profiles/web/cordis.patch.yml:
- insert: - id: all-usage name: dsh-all-usage
The profile patch layer hot-reloads; save the file and refresh the page.
Architecture
- Host (
lib/index.js): aggregates persisted session logs (turn/endandassistant/message.usage), folds livesession/eventupdates, and exposes data routes throughwebServer:GET /api/all-usage— usage snapshotGET /api/all-usage/balance?force=1— account balance using the configuredllm-deepseekAPI keyPOST /api/all-usage/alias— update workspace aliases
- Client (
lib/client.js): awindow.__ModuleLoader__browser bundle that registers the “Usage statistics” sidebar entry through thesidebar.footer.actionslot. All API routes accept loopback requests and reject an explicit cross-origin Origin; balance reads and alias writes also require a process-scoped token generated when the plugin starts (the balance GET tolerates browsers omitting Origin).
Data semantics
- All calls and tokens come from persisted DSH session logs; historical data is backfilled when the plugin activates and survives reloads or uninstall/reinstall cycles
- For each session and logical
turn / step, only the final usage contribution is kept; retries or replaced messages do not double-count - Processed tokens = input + output + cache read/write + reasoning; a cache hit means reused context, not newly generated tokens or actual cost
- Balance data comes from DeepSeek’s official
/user/balanceendpoint; the card shows guidance when no API key is configured - English mode uses UTC for date buckets, range filters, streaks, heatmap dates, and export timestamps; Chinese mode uses local time
- Only sessions that can be mapped to a registered workspace by their working directory are included
Development
- After editing
lib/client.js, refresh the page. After editinglib/index.js, reload the package through DSH or restart the process; a page refresh alone cannot replace running host code - The plugin has no third-party package dependencies: the Host uses Cordis services and the Client uses the runtime-provided React module
License / 许可证
MIT
链接
同类插件
bowenliang123/dsh-context★ 249
DSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
zh667/TokenLedger★ 95
侧边栏用量面板:把 Token 归属到实际服务该请求的中转站,站点从已有的 provider 配置中读出,无需额外配置;含今日/本月/累计三窗口、按站点与模型下钻、一年活跃度热力图,以及 New API / Sub2API / DeepSeek 余额。
Han-1413141/dsh-cost-meter★ 90
会话与当日 API 费用统计、预算图框(已用%)、官方余额、历史看板,支持峰谷计价与官方价格一键同步。
Ychris12138/dsh-usage-stats★ 68
多供应商用量看板:按供应商/模型统计 Token 与日期下钻,统一展示账户余额,并追踪 OpenCode Go / Z.ai 订阅额度。
feibi-mochi/deepseek-harness-control-center★ 31
DeepSeek Harness 监控、提醒、充值与会话控制中心:查看官方余额、本会话花费与 token、第三方 token 合计,提供完成提醒、官方充值、灵活布局及 Agent 辅助的会话控制。
zhu168/dsh-save-money#plugin★ 31
自定义时间窗口自动暂停/恢复任务,高峰时段节省 API 费用;含账户余额显示和 10 分钟粒度的消费柱状图。