LaoYueHanNi/dsh-token-usage
贴近 DSH 原生设计风格的 token 用量统计插件:实时记录每次请求的用量与费用,在 Web UI 中提供趋势图表、按模型定价明细和供应商配额显示。
Project Overview项目介绍
This is a native plugin built exclusively for DeepSeek Harness (DSH) that displays token usage and cost statistics for LLM calls directly in DSH's web UI. To install the latest version, you run the command dsh plugin --profile web add @laoyuehanni/dsh-token-usage via DSH's CLI, as direct GitHub installs are no longer supported. After installation, you can access the Token Usage page via DSH's Settings, which offers filterable views of summary cost cards, daily total token line charts, per-model and per-session breakdowns, and per-model pricing dialogs, all filterable by date range and model.
The plugin records live every model call’s token count, cost, model identifier, and session data, including context compaction calls that are often skipped by other similar tools. It adds a dedicated Usage tab next to Chat and Trajectory in the conversation pane, where users can view six detailed stat cards for the active session, an hourly trend chart, and a per-model breakdown, with full support for toggling between main session and subagent usage scopes. It is designed for DSH users who need to track LLM usage costs and audit token consumption across different work scenarios and sessions.
This plugin is released under the permissive MIT open source license. Pricing data is automatically synced from a cloud mirror, and users can switch between Gitee (domestic China) and GitHub (overseas) mirrors to get faster speeds, which also sets the display currency to RMB or USD respectively. When upgrading from versions 0.4.1 or earlier to 0.4.2+, the first open of the stats page triggers a one-time full rebuild of historical usage data, and larger histories take longer to process, which is expected behavior. When you remove the plugin, all existing data is retained in the default ~/.dsh/token-usage/ directory, and you have to delete it manually if you no longer need it.
这是一个专为 DeepSeek Harness (DSH) 开发的原生插件,用于在 DSH 的网页端界面展示大模型调用的 Token 使用量与费用统计。安装完成后,用户可以在侧边栏齿轮图标打开的设置页找到 Token 使用统计页面,支持按日期范围、模型筛选查看汇总费用卡片、日 Token 总量折线图、按模型/会话拆分的使用明细,以及各模型的定价弹窗。当前版本不再支持 GitHub 直接安装,需要通过 DSH 的命令行工具从 npm 拉取安装。
该插件会实时记录所有模型调用的 Token 数量、费用、模型、会话信息,包括上下文压缩调用也不会遗漏。用户可以在会话面板的新增「使用」标签页查看当前会话的六大统计卡片(成功请求、费用、缓存命中率、首token平均耗时、生成吞吐量、总 Token 数)、每小时趋势图和模型明细,还支持切换查看主会话和子代理的使用数据。它适合需要管控大模型调用成本、统计各场景使用量的 DSH 用户日常使用。
该插件采用 MIT 许可证开源,定价数据从云端镜像自动同步,支持用户切换国内 Gitee 镜像或海外 GitHub 镜像,对应显示人民币或美元计价。首次启动会自动回填安装前的历史请求数据,从 0.4.1 及更早版本升级到 0.4.2+ 后,首次打开统计页会触发一次全量历史重建,历史数据越多耗时越长,属于正常现象。移除插件后数据会保留在默认的 ~/.dsh/token-usage/ 目录,需要手动删除。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-token-usage(LaoYueHanNi/dsh-token-usage)
仓库:https://github.com/LaoYueHanNi/dsh-token-usage
本站详情页:https://www.yhbd.top/plugins/laoyuehanni-dsh-token-usage/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 13 · 最近提交 2026-09-29 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- 13 stars - an early-stage project星标 13,属于早期项目
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add @laoyuehanni/dsh-token-usage
把 LaoYueHanNi/dsh-token-usage 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-token-usage

简体中文 | English
A dsh usage plugin that displays model token usage right in the Web UI. After installation, open Settings (the gear icon in the sidebar) and you'll find the Token Usage page — summary cards (with cost), a daily total-token line chart, a per-model / per-session breakdown, and per-model pricing dialogs, all filterable by date range and model, exactly as shown in the screenshot above.
Repo: https://github.com/LaoYueHanNi/dsh-token-usage
[!IMPORTANT] GitHub direct installs have ended — the repository no longer carries prebuilt output. Install from npm instead:
dsh plugin --profile web add @laoyuehanni/dsh-token-usageUpgrading from a legacy
github:install (≤ 0.3.7, package namedsh-token-usage)? An in-placeupdatefails to load — remove the old name first, then add again. Usage data under$DSH_HOME/token-usage/carries over untouched.
Features
- Live recording: every provider-billed model call is recorded as it happens — tokens, cost, model, session — context-compaction calls included.
- Web stats page: filters (date range + model +
1d/7d/30dshortcuts), summary cards, daily trend chart (hover a day for its total), per-model table. The table block toggles between per-model / per-session: the session table groups by working directory (switchable to a flat list), sorts by total tokens / cost / recent activity on header click, and Ctrl+click on a session row jumps straight to that session's usage tab. - Session usage tab: the conversation pane gains a Usage view tab (beside Chat / Trajectory) with the active session's dashboard — six stat cards (successful requests with a failure pill, cost, cache hit rate, average time-to-first-token, generation throughput, total tokens), a 4-bucket token strip, an hourly trend chart, and a per-model table. A scope switch toggles Session / With subagents, and the subagent table drills into each child and back. Hovering the failure pill breaks failures down per class (rate limited, server error, context exceeded, …).
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
wssfk12138/dsh-damage-pulse
Ychris12138/dsh-usage-stats
JingbiaoMei/Tokdash
yxxbc/dsh-balance-plugin
feiyang-dev/dsh-usage-plugin
lanlandeli/dsh-usage-stats
Shiye-10Pages/dsh-whale-meter
OK-wx/dsh-ocgo-lite