stevenx65/dsh-balance-plugin
Project Overview项目介绍
This is a native DSH plugin that runs as a Cordis plugin inside the DSH process, built exclusively for the DSH web platform, designed to display DeepSeek official API account balance and aggregated token usage directly in the DSH web sidebar. It automatically pulls balance data by calling DeepSeek’s official GET /user/balance endpoint, and reuses the DSH credentials stored locally at ~/.dsh/.credentials.yaml so users do not need to re-enter their API key. It also aggregates token usage data from DSH’s compressed session logs, and includes a toggle to switch between viewing today’s (Beijing time) or all-time usage statistics, filtered only to the deepseek-official provider.
The simplest way to install the plugin is via the DSH plugin market using the command line: run dsh plugin --profile web add dsh-balance-plugin, then restart the dsh web process and refresh your browser. Once installed, a new balance button will automatically appear at the bottom of the DSH web sidebar, ready for immediate use. For users who prefer manual installation, you can copy the plugin files to your DSH web profile’s node_modules directory and add an entry to the cordis.patch.yml configuration file before restarting DSH, which is useful if you want to modify the source first.
On the Node side, the plugin only uses Node built-in modules, but relies on the zstd CLI tool to decompress DSH’s session logs stored in ~/.dsh/sessions/. It pulls cached input, cache read, output token counts, and model call counts from the session logs to generate accurate usage totals. On the browser side, it relies on the @deepseek-ai/dsh-client-ui-primitives package, which is a peer dependency included by default in DSH 0.1.0-rc.6 and newer, so no extra installation is needed for most users. The plugin automatically adapts to the active DSH light or dark theme, and is released as open source under the permissive MIT license.
这是一款专为DeepSeek Harness(DSH)打造的原生插件,仅面向DSH网页端开发,用于在DSH网页侧边栏(3080端口)底部显示DeepSeek官方API的账号余额和已使用token统计,只统计deepseek-official官方供应商的调用数据。它复用DSH已保存在~/.dsh/.credentials.yaml中的凭证,用户无需手动输入API密钥,支持按当日(北京时间)和全部历史两个维度切换统计。
该插件可以通过DSH内置插件市场直接安装,用户只需执行dsh plugin --profile web add dsh-balance-plugin命令,完成后重启DSH网页服务并刷新浏览器页面,即可在侧边栏底部看到余额按钮。用户也可以手动安装,将项目文件复制到DSH网页配置文件目录后修改对应配置项即可完成安装,操作步骤清晰简单。
Node端依赖zstd命令行工具来解压DSH的会话日志,浏览器端所需的Peer依赖@deepseek-ai/dsh-client-ui-primitives已随DSH 0.1.0-rc.6及以上版本内置,无需额外安装。该插件基于MIT许可证开源,可自动适配DSH的浅色/深色主题,仅统计DeepSeek官方供应商的调用数据。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-balance-plugin(stevenx65/dsh-balance-plugin)
仓库:https://github.com/stevenx65/dsh-balance-plugin
本站详情页:https://www.yhbd.top/plugins/stevenx65-dsh-balance-plugin/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 6 · 最近提交 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 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
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-balance-plugin
把 stevenx65/dsh-balance-plugin 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-balance-plugin
A DeepSeek Harness (dsh) web plugin: shows DeepSeek API balance and token usage at the bottom of the web sidebar (port 3080), with a Today / All-time toggle, filtered by provider (only deepseek-official, ignoring other vendors).
Features
- 💰 Balance: calls DeepSeek's official
GET /user/balance, reusing dsh's credentials (~/.dsh/.credentials.yaml) — no manual key entry - 📊 Token usage: reads dsh session logs (
session.jsonl.zstd), aggregates by provider- Uncached input / cache read / output / model call count
- 🔄 Today / All-time toggle: today (Beijing time) or full history
- 🎨 Auto-adapts to light/dark theme
Screenshot

Install (from the plugin market)
dsh plugin --profile web add dsh-balance-plugin
Restart dsh web, then refresh the page — a balance button appears at the bottom of the sidebar.
Architecture
Browser (3080 page)
client.js ──fetch──▶ /dsh-balance/data?scope=today|all
│
node side (index.js, inside the dsh process)
├── credentials.resolve("DEEPSEEK_API_KEY") ← reuses dsh's key
├── fetch(https://api.deepseek.com/user/balance)
└── decompress ~/.dsh/sessions/*/*/session.jsonl.zstd
filter assistant/message rows + provider=deepseek-official
index.js: node-side cordis plugin, registers HTTP route/dsh-balance/dataclient.js: browser-side plugin, injects intosidebar.footer.action(sidebar bottom button + floating panel)package.json:dsh.bundle+dsh.client.platform: "web"+exports["./client"]cordis.patch.yml: bundle patch registering the node entry
Manual install
mkdir -p ~/.dsh/profiles/web/node_modules/dsh-balance-plugin
cp index.js client.js cordis.patch.yml package.json ~/.dsh/profiles/web/node_modules/dsh-balance-plugin/
Then add to ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
- id: dsh-balance
name: dsh-balance-plugin
Restart dsh web and refresh the browser.
Dependencies
- node side: Node built-ins only (
node:fs,node:child_process,node:path); requires thezstdCLI for decompressing session logs - browser side:
@deepseek-ai/dsh-client-ui-primitives(peer dep, ships with dsh 0.1.0-rc.6)
Data source
Session logs at ~/.dsh/sessions/<scope>/<session-id>/session.jsonl.zstd. Each assistant/message row:
{
"type": "assistant/message",
"time": 1786635270943,
"data": {
"message": { "source": { "kind": "model", "provider": "deepseek-official", "model": "deepseek-v4-pro" } },
"usage": { "inputTokens": 8702, "outputTokens": 298, "cacheReadTokens": 0 }
}
}
Pack
npm pack # produces dsh-balance-plugin-0.1.0.tgz
License
MIT
MeteorNOX/DeepSeek-Balance-Whale-Widget
edison7009/EchoBird
Han-1413141/dsh-cost-meter
wssfk12138/dsh-damage-pulse
zh667/TokenLedger
edonadei/caliper
Ychris12138/dsh-usage-stats
Aisland-SJL/dsh-usage