TwotwoPiggy/dsh-balance
dsh余额插件。一个用于实时令牌追踪和高精度会话成本估算的DeepSeek Harness插件,支持动态峰谷定价。
Project Overview项目介绍
This is a native DSH plugin built exclusively for DeepSeek Harness that adds real-time DeepSeek API balance tracking and current session cost calculation to the DSH web user interface. It displays a color-coded balance status indicator and estimated current session cost on the same row as the existing token stats bar directly under the input box. Users can click the status indicator to force a fresh real-time balance query, hover over UI elements to see detailed dual-pane cards with full account and session breakdowns, and it automatically adapts to DeepSeek's official peak and off-peak pricing rules as well as the latest September 2026 price cuts.
This plugin is targeted at developers and general users who call DeepSeek API models through DSH for development work or everyday chat sessions. After installation, it lets users constantly monitor their account balance status to avoid unexpected interruptions to work or conversations when the account balance runs out. It also lets users plan their API calls around official peak and off-peak pricing to reduce overall API usage costs, and it includes a visual web-based configuration panel that lets you change all settings on the fly without needing to restart the dsh web service.
The plugin can be installed automatically with a single command via the DSH CLI, and you can choose between the full version with all features or the lightweight lite version that only includes core balance and cost display. It automatically reuses the DeepSeek API key already stored in your DSH credentials, so you do not need to manually add or reconfigure your API key during setup. To upgrade to the latest version, you first need to clear your local pnpm cache, and uninstallation is also handled with a single DSH CLI command that automatically cleans up all related configuration entries.
dsh-balance 是专为 DeepSeek Harness (DSH) 开发的原生插件,用于在 DSH Web UI 上实时显示 DeepSeek API 账户余额和当前对话的估算消耗。它在输入框下方统计条同行展示带颜色状态提示的余额、本次会话消耗,点击状态圆点可手动强刷查询最新余额,支持悬停查看双栏详情卡片,内置 DeepSeek 峰谷计费规则自动适配与最新降价同步。
该插件适合所有使用 DeepSeek API、依托 DSH 进行开发和对话的开发者,安装后可随时掌握账户余额充足度,避免因余额不足突然中断开发工作或对话会话,还可根据峰谷计费规则合理安排调用计划,帮助降低 API 使用成本。它自带可视化配置面板,支持在网页端直接修改参数,修改后即时生效无需重启服务。
该插件可通过 DSH CLI 一键安装,分为带完整功能的完整版和仅保留核心显示的精简版,两个版本二选一即可,也可以让 AI 助手协助安装,或从本地源码安装。它默认复用 DSH 已存储的 DeepSeek API 密钥,无需用户额外手动配置密钥。升级需要先清除 pnpm 本地缓存,卸载也可通过 DSH CLI 一键完成。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-balance(TwotwoPiggy/dsh-balance)
仓库:https://github.com/TwotwoPiggy/dsh-balance
本站详情页:https://www.yhbd.top/plugins/twotwopiggy-dsh-balance/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证未声明 · ⭐ 11 · 最近提交 2026-09-09 · 主语言 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 更稳。
- No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
- 11 stars - an early-stage project星标 11,属于早期项目
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
把 TwotwoPiggy/dsh-balance 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-balance
DeepSeek 余额实时显示插件: 在 dsh Web UI 输入框下方、命中率/输入输出 token 统计条所在的同一行, 实时显示:
- 账户余额与充足度状态指示灯(如
🟢 余额 ¥97.69, 红/黄/绿三色直观反映余额充裕状况,点击状态圆点可直接手动强刷查询最新余额) - 本次对话的估算消耗(如
本会话约 ¥3.92, 按模型、按 DeepSeek 官方单价估算) ?定价参考图标: 悬停以?为中心优雅浮现 DeepSeek V4 系列专属定价微卡片(全面支持deepseek-v4-flash、deepseek-v4-flash-vision-exp多模态视觉模型与deepseek-v4-pro),点击直达官方定价页 https://api-docs.deepseek.com/zh-cn/quick_start/pricing/
悬停读数可查看左右双栏毛玻璃卡片:
- 左栏【📊 账户余额】:实时大字总额、充足度 Badge、充值与赠送金额构成、5分钟自动刷新时间戳点击指示灯强刷指引以及偏好设置快速入口。
- 右栏【⚡ 本会话消耗】:当前会话预估总花费、按模型细分明细(如
• deepseek-v4-flash: ¥3.92)、换行小字体展示输入/输出与缓存命中统计(如第一行Token: 输入 124M · 输出 301K与第二行命中: 123M (99.3%))。 - 时间感知引擎:内置 DeepSeek 谷峰计费自动切换机制(北京时间周一至周五 09:00
12:00, 14:0018:00 为峰时 2 倍计费 / 其余时段含周末全天享 5 折空闲特惠),并严格对齐 2026-09-10 12:00 起生效的 Flash 最新降价分水岭,全自动无缝同步。

架构
┌─────────────┐ 按 refreshIntervalMs 轮询 ┌──────────────────┐
│ DeepSeek API│◀────────────────────────────│ 服务器插件(host) │
│ /user/balance│ │ · 余额缓存(带陈旧回退)│
│ │ ?force=1 手动强刷路由 │ · /query-balance 路由│
└─────────────┘ │ · queryBalanceCost │
│ 会话花费投影(含V4谷峰)│
└────────┬───────────┘
│ 只读缓存 / 投影推送帧
┌────────▼───────────┐
│ 浏览器插件(client) │
│ · 双栏悬停卡片 │
│ · 点击指示灯手动强刷 │
│ · 单例轮询器(页面隐藏 │
│ 时暂停) │
└────────────────────┘
- 性能: 浏览器只读本地缓存(每
clientPollIntervalMs一次极小 JSON), 不直接访问 DeepSeek; 服务器按refreshIntervalMs拉取并缓存(失败保留上次成功值); 花费由投影折叠计算 (与 dsh-token-meter 相同的 O(1) 状态机, 同引用事件零开销), 随既有session/projection推送帧实时到达客户端, 无额外网络请求。 - 手动强刷: 点击状态指示灯按钮可直接穿透缓存向 DeepSeek 官方发起实时查询,服务端内置 2000ms 冷却防刷保护。
- 密钥: 复用 Harness 的 credentials 能力(
ctx.credentials), 默认引用DEEPSEEK_API_KEY(即$DSH_HOME/.credentials.yaml或进程环境), 无需在配置里写密钥。 - 同行动态布局: 组件全 Flex 居中对齐,与输入框底部统计条完美处于绝对水平中线。
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
Han-1413141/dsh-cost-meter
wssfk12138/dsh-damage-pulse
songoao25/dsh-bottom-info-bar
Phant0Meow/dsh-meow-cachebilling
Rianico/dsh-better-edit
Ghost011118/dsh-balance-meter
ai-shushu/dsh-quota-meter
better-er/dsh-cache-billing