zoumutou/dsh-cost-balance
DeepSeek Harness 插件:输入框下方 iOS 风格统计条——会话花费、账户余额、缓存命中、Token 用量一键展开
Project Overview项目介绍
This is a native Web UI plugin built exclusively for DeepSeek Harness (DSH). After installation, it adds an interactive control below the DSH conversation input box. By default, it folds into a small black bar similar to the iOS home indicator, and clicking it expands a semi-transparent frosted glass panel that displays various statistics for the current conversation. You can install it with one command using the official DSH CLI, which pulls the published package from the npm registry and adds it to your profile's bundle layer automatically. After installation, you just need to refresh or restart the DSH Web UI to start using the plugin.
The plugin displays conversation stats including turn count, LLM inference time, average first token latency, cache hit rate, input and output token usage, current session cost, and real-time balance of your DeepSeek account. The balance automatically refreshes every 60 seconds by calling DeepSeek's official API using your stored API key, so you don't have to open a separate browser tab to check your account status. This plugin is especially useful for DSH users who frequently call the DeepSeek API and need to keep a close eye on their usage cost to avoid unexpected overage charges.
The plugin comes with DeepSeek's latest official model pricing built in, and supports custom price overrides. If DeepSeek adjusts its pricing or introduces new billing rules like peak/off-peak pricing, you can update the pricing directly in your DSH profile's configuration file, no need to wait for a plugin update. The entire plugin is open source under the permissive MIT license, and can be installed either from the npm public registry or directly from source code for development purposes. If your API key is not configured or the balance fetch fails, the plugin will simply show a placeholder for the balance field.
这是一个专为 DeepSeek Harness (DSH) 开发的原生 Web UI 插件,安装后会在 DSH 对话输入框下方新增一个可交互控件,默认折叠为类似 iOS 底部横条的小黑条,点击即可展开半透明毛玻璃面板,展示当前会话的各类统计数据。统计内容包含对话轮次步数、LLM 耗时、首 token 平均延迟、缓存命中率、Token 输入输出用量、本会话花费以及 DeepSeek 账户实时余额。可通过 DSH 官方 CLI 命令一键安装,安装后刷新 Web UI 即可使用,卸载也仅需一条 CLI 命令。
DSH 用户可以在每次对话过程中实时查看当前会话的花费情况和账户剩余余额,不用手动跳转到 DeepSeek 官方后台查询,也能直观看到缓存命中率和 Token 吞吐等性能数据,帮助用户更好地控制 API 调用成本。对于需要频繁使用 DeepSeek API 进行开发的 DSH 用户,这个插件可以随时提醒当前的花费进度,避免因忘记关注用量导致意外超支,也方便用户调整对话策略来控制 API 使用成本。
插件内置 DeepSeek 官方最新的模型定价表,支持自定义修改定价,用户可以在自己的 profile 配置文件中覆盖内置价格,适配 DeepSeek 未来的价格调整或峰谷计费规则,不需要等待插件更新。插件代码基于 MIT 许可证开源,支持从 npm 官方源或源码两种方式安装,余额读取自用户自己的 API Key 账户,未配置 API Key 时会显示占位内容。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-cost-balance(zoumutou/dsh-cost-balance)
仓库:https://github.com/zoumutou/dsh-cost-balance
本站详情页:https://www.yhbd.top/plugins/zoumutou-dsh-cost-balance/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-08-14 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【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 更稳。
- Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
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 dsh-cost-balance
把 zoumutou/dsh-cost-balance 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-cost-balance
DeepSeek Harness(DSH)Web UI 插件:在输入框下方显示一条 iOS 风格的小黑条,点击展开轻盈的半透明多行面板,查看会话花费、账户余额、缓存命中、Token 用量等统计。
默认折叠为一条居中的小黑条(类似 iOS 底部横条),点击展开毛玻璃面板:
| 行 | 内容 |
|---|---|
| 轮次 · 步数 | 3 轮 · 12 步 |
| LLM 耗时 / 工具调用 | 45.2s / 12.3s |
| 首 token 平均 / 吞吐 | 1.4s / 25.4 tok/s |
| 缓存命中 | 87% |
| Token | 输入 12.2K · 输出 517 |
| 花费 | $0.0123(本会话,按官方定价) |
| 余额 | ¥9.00(DeepSeek 账户实时余额,60s 自动刷新) |
安装(npm 发布版)
dsh plugin --profile web add dsh-cost-balance
该命令从 npm registry 拉取已发布的 dsh-cost-balance(dsh.bundle),自动加入 profile 的 bundle 层。
然后重启(或刷新)DSH Web UI。卸载:dsh plugin --profile web remove dsh-cost-balance。
工作原理
- Client 半(
lib/client.js):注册在conversation.composer.dock槽位(接管 shipped 的stats单元格,与产品自带统计行同源同数据),展示折叠/展开 UI;通过同源GET /api/cost-balance读取数据,每 60 秒自动刷新,token 用量变化时即时重算。 - Host 半(
lib/index.js):经webServer注册/api/cost-balance路由——花费按会话累计 token(未命中输入 / 缓存命中 / 缓存写入 / 输出)× 模型单价计算;余额经credentials服务解析DEEPSEEK_API_KEY后调用 DeepSeek 官方GET /user/balance(60s 缓存、失败 30s 抑制)。
余额取自用户自己的 API Key 账户,无需任何配置;未配置或抓取失败时面板显示 余额 --。
定价与覆盖
内置 DeepSeek 官方定价(USD / 1M tokens):
| 模型 | 缓存命中 | 缓存未命中 | 输出 |
|---|---|---|---|
| deepseek-v4-flash | $0.0028 | $0.14 | $0.28 |
| deepseek-v4-pro | $0.003625 | $0.435 | $0.87 |
DeepSeek 将于 2026-08-16 16:00 UTC 起切换峰谷计费(off-peak 为 peak 的一半)。价格变更时无需等插件更新——在 profile 的
cordis.patch.yml里覆盖即可:
# ~/.dsh/profiles/<你的profile>/cordis.patch.yml
- id: cost-balance
config:
prices:
deepseek-v4-flash:
cacheHit: 0.014
cacheMiss: 0.44
output: 1.32
(覆盖是整行替换,务必保留 id: cost-balance。)
从源码安装(开发)
git clone https://github.com/zoumutou/dsh-cost-balance.git
cd dsh-cost-balance
dsh plugin --profile web add .
发布新版本:修改 package.json 的 version 后 npm publish(账号需 2FA 绕过 token,见 npm 文档)。
许可
MIT
feiyang-dev/dsh-usage-plugin
nonewind/dsh-spend
raphael-y7/dsh-desktop-statusbar
MeteorNOX/DeepSeek-Balance-Whale-Widget
wssfk12138/dsh-damage-pulse
Ychris12138/dsh-usage-stats
JingbiaoMei/Tokdash
yxxbc/dsh-balance-plugin