用量统计面板:静默按模型采集 token、活跃热力图、趋势图、费用估算与每日超限守卫。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-usage-guard
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:hb-degithub/dsh-usage-guard
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
English | 中文
Usage statistics panel for DeepSeek Harness (DSH) Web GUI — silent background collection, per-model analytics, cost estimation and a daily-limit guard.
Features
- Silent collection — hooks session events, folds every assistant message's token usage into daily buckets per provider × model; survives restarts, backfills from session logs on first run
- Dashboard in Settings → Usage: six stat cards (tokens, sessions, messages, active days, current streak, top model), a GitHub-style activity heatmap (continuous year view, weekday/month labels, hover detail card per day), a multi-series line/area trend chart (input / output / cache hit / cache write / cost, dual axes, 7d/30d switch) and a model-usage donut
- Cost estimation — configurable per-model prices (input / output / cache read / cache write per 1M tokens); built-in DeepSeek list prices; models without a price are excluded from cost instead of guessed
- Daily-limit guard — optional daily token / cost caps;
warnmode shows a global banner,blockmode aborts over-limit LLM requests before they hit the network - Bilingual (zh/en), follows the DSH theme tokens, zero external runtime dependencies
Install
From the DSH plugin market (Settings → 插件市场), or:
dsh plugin --profile web add dsh-usage-guard # npm
dsh plugin --profile web add <github-url> # or from GitHub
Restart dsh web, then open Settings → 使用统计.
Develop
pnpm install
pnpm build # tsdown + wrap-client → dist/client.js (host loads host/, browser loads dist/)
pnpm test # vitest, incl. an SSR smoke test that renders all charts from real data
License
MIT
中文
DeepSeek Harness(DSH)Web GUI 的用量统计面板——后台静默采集、按模型分析、费用估算、每日超限守卫。
功能
- 静默采集——挂钩会话事件,把每条助手消息的 token 用量折叠进 天 × 提供商 × 模型 桶;重启不丢,首次运行自动从会话日志回填
- 仪表盘(设置 → 使用统计):六张统计卡(tokens、会话数、消息数、活跃天数、连续天数、最常用模型)、GitHub 风格活跃热力图(连续年度视图、星期/月份标注、逐日悬浮详情卡)、多序列折线/面积趋势图(输入/输出/缓存命中/缓存创建/成本,双轴,7/30 天切换)、模型用量环形图
- 费用估算——按模型配置价格(每 1M tokens 的 输入/输出/缓存读/缓存写);内置 DeepSeek 刊例价;未配置价格的模型不计费而不是瞎猜
- 每日超限守卫——可选每日 token / 费用上限;
warn模式全局横幅提醒,block模式在请求发出前直接拦截 - 中英双语,跟随 DSH 主题令牌,零外部运行时依赖
安装
插件市场(设置 → 插件市场)一键安装,或:
dsh plugin --profile web add dsh-usage-guard # npm
dsh plugin --profile web add <github 地址> # 或从 GitHub
重启 dsh web,打开 设置 → 使用统计。
许可
MIT
链接
同类插件
bowenliang123/dsh-context★ 1847
DSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
Han-1413141/dsh-cost-meter★ 373
会话与当日 API 费用统计、预算图框(已用%)、官方余额、历史看板,支持峰谷计价与官方价格一键同步。
wssfk12138/dsh-damage-pulse★ 239
在 DSH Web 界面追踪 DeepSeek Token 用量、单次与会话费用及账户余额,并显示缓存感知的扣费动画。
zh667/TokenLedger★ 203
侧边栏用量面板:把 Token 归属到实际服务该请求的中转站,站点从已有的 provider 配置中读出,无需额外配置;含今日/本月/累计三窗口、按站点与模型下钻、一年活跃度热力图,以及 New API / Sub2API / DeepSeek 余额。
Ychris12138/dsh-usage-stats★ 169
多供应商用量看板:按供应商/模型统计 Token 与日期下钻,统一展示账户余额,并追踪 OpenCode Go / Z.ai 订阅额度。
PolinniZhong/dsh-personal-center★ 118
DeepSeek Harness 个人中心:跨会话用量统计、按模型成本估算、全局自定义指令、外观全局字号、数据驱动的桌面宠物(位图/矢量皮肤)与会话状态概览,纯本地离线运行。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。