02Muller25/dsh-api-balance
实时显示 DeepSeek API 账户余额的 DeepSeek Harness(dsh web)插件。 Real-time DeepSeek API account balance readout for the DeepSeek Harness web GUI.
catalog descriptioncatalog 简介 / catalog description:安装在deepseek的插件,能够实时显示当前api的余额,30秒自动刷新一次
Project Overview项目介绍
This is a native plugin built exclusively for the DeepSeek Harness (DSH) web client, designed to show real-time DeepSeek API account balance directly in the DSH GUI. The balance display is placed in the dock area below the conversation composer input box, which matches the existing DSH web interface layout. By default, it refreshes the balance automatically every 30 seconds, and it fetches the latest balance immediately once the plugin is first mounted to the interface. It also supports multiple configurable refresh modes including manual refresh, fixed intervals from 10 seconds to 5 minutes, and a fully custom interval between 5 and 3600 seconds.
It is targeted at DSH web users who call DeepSeek API directly through their own DSH deployment, helping them keep track of their balance to avoid unexpected request failures from running out of credit. The plugin uses DSH’s built-in credentials service to retrieve the DEEPSEEK_API_KEY, so the API key never leaves the host process, which keeps your sensitive authentication key secure. If a refresh request fails, it keeps the last valid balance reading and shows a yellow warning, and it displays a clear red message if the balance is completely unavailable. Custom refresh preferences are saved to the browser’s localStorage, so they persist across page reloads and DSH restarts.
The plugin is released under the permissive open source MIT license. You can install it directly with the DSH CLI command dsh plugin --profile web add github:02Muller25/dsh-api-balance, which is the recommended installation method for most users. It can also be installed manually by placing the package files into your DSH profile’s node_modules directory, adding an insert entry to your cordis.patch.yml file, and restarting the DSH web service. It relies on standard DSH host services like webServer, credentials, and shell, and the client side only depends on DSH’s built-in React and slots modules. If you installed it manually, running pnpm install on your DSH profile may remove the package, so you will need to reinstall it afterward.
这是一款专为 DeepSeek Harness(DSH)网页端开发的原生插件,核心功能是实时显示用户的 DeepSeek API 账户余额。插件会将余额信息展示在 DSH 网页端会话输入框下方的 Dock 栏中,默认每 30 秒自动刷新一次,挂载插件时会立即查询一次余额。它支持多种刷新模式,包括手动刷新、10秒/30秒/1分钟/5分钟间隔刷新,还允许用户自定义 5 到 3600 秒之间的刷新间隔。
这款插件面向使用 DSH 网页端调用 DeepSeek API 的开发者,帮助他们实时掌握账户余额变动,避免因余额不足导致 API 请求意外中断。用户的 API 密钥通过 DSH 自带的凭据服务解析,不会流出宿主进程,有效保障了密钥的访问安全。刷新失败时会保留上次的有效余额数据并提示错误,余额不可用时也会给出明确提示,自定义的刷新偏好会保存在浏览器 localStorage 中,刷新页面后不会丢失。
插件遵循 MIT 开源许可证,可通过 DSH 的 GitHub 依赖安装命令一键安装,也支持手动将包放入配置目录后修改补丁配置完成启用。它依赖 DSH 标准的 webServer、凭据、shell 等宿主服务,客户端侧仅依赖 DSH 自带的 React 模块和插槽服务,无需额外安装第三方依赖。如果是手动安装的包,对 profile 执行 pnpm install 时可能会被清理,需要重新放置或改用官方依赖安装方式。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-api-balance(02Muller25/dsh-api-balance)
仓库:https://github.com/02Muller25/dsh-api-balance
本站详情页:https://www.yhbd.top/plugins/02muller25-dsh-api-balance/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 11 · 最近提交 2026-08-15 · 主语言 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 更稳。
- 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 github:02Muller25/dsh-api-balance
把 02Muller25/dsh-api-balance 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
api-balance
实时显示 DeepSeek API 账户余额的 DeepSeek Harness(dsh web)插件。 Real-time DeepSeek API account balance readout for the DeepSeek Harness web GUI.
在会话输入框下方的读数带(conversation.composer.dock)显示:
API 余额 CNY 18.22 · 可用 · 14:32:05 更新
- 每 30 秒自动刷新(挂载时立即查询一次)
- 刷新模式可选:手动刷新 / 每 10 秒 / 每 30 秒 / 每 1 分钟 / 每 5 分钟 / 自定义间隔;选择「自定义…」会弹出输入窗口(范围 5–3600 秒,含校验与错误提示),偏好保存在浏览器 localStorage,刷新页面后仍保留
- 手动模式下点击「刷新」按钮即时刷新;自定义间隔确认后即时生效
- 刷新失败时保留上次数据并显示黄色「刷新失败」,悬停可见具体原因,下一次自动轮询自动恢复
- 余额不可用时显示红色「不可用」
- API 密钥通过 dsh 的 credentials 服务按需解析(
DEEPSEEK_API_KEY),不出宿主进程
架构
| 文件 | 平台 | 作用 |
|---|---|---|
lib/index.js |
Host | 注册精确路由 GET /api/abal-balance;每次请求实时解析凭证并 curl https://api.deepseek.com/user/balance |
lib/client.js |
Client (web) | 手工编写的 window.__ModuleLoader__.load 格式 bundle(dsh web 的标准客户端包格式,无需构建管线);在输入框读数带渲染余额,每 30s fetch 刷新 |
lib/client.d.ts |
— | 客户端类型占位 |
依赖的宿主服务:webServer、credentials、shell、sandboxPolicy(均为 dsh 标准服务)。
客户端侧仅依赖 react(种子模块)与 slots 服务。
说明:curl 调用以
danger-full-access策略运行 —— 它是只读网络请求、无文件副作用,绕过平台沙箱 runner 是刻意的(在 Windows ACL 受限令牌下该请求已验证会失败)。
安装(在目标 dsh web 部署上)
本仓库声明了 dsh.bundle manifest,可直接用 GitHub 依赖安装(推荐):
dsh plugin --profile web add github:02Muller25/dsh-api-balance
或手动放置:
- 将本包放入 profile 的 node_modules:
$DSH_HOME/profiles/node_modules/api-balance/(完整目录,含package.json、cordis.patch.yml与lib/)。 - 在 profile 的
cordis.patch.yml追加(必须是insert块 —— 补丁语义只允许新增行,普通条目只能覆盖已有行;仓库根目录已附一份可直接参考):
- insert:
- id: api-balance
name: 'api-balance'
- 重启 dsh web 服务(组合只在启动时读取)。
启用 / 禁用 / 卸载
- 禁用:补丁条目加
disabled: true,重启 - 卸载:删除补丁条目 + 删除
profiles/node_modules/api-balance/,重启 - 设置 → 插件市场中的列表是只读的(对官方插件同样如此),启停均通过补丁 + 重启完成
自定义
- 刷新模式与间隔:读数带右侧的下拉框(手动 / 10s / 30s / 1min / 5min / 自定义…),「自定义…」弹出输入窗口,范围 5–3600 秒;偏好持久化在
localStorage(键dsh.api-balance.refresh) - 读取的凭证:
lib/index.js中credentials.resolve('DEEPSEEK_API_KEY') - 余额接口:
lib/index.js中BALANCE_URL
已知限制
- 若对 profile 执行
pnpm install,手动放入node_modules的包可能被清理,需重新放置或改为正式依赖安装。
更新日志
v0.2.1 — DeepSeek Harness 插件:API 余额实时显示(手动 / 自定义刷新)
- 刷新模式可选:手动 / 每 10 秒 / 每 30 秒 / 每 1 分钟 / 每 5 分钟 / 自定义间隔(5–3600 秒)
- 「自定义…」弹出输入窗口,显示范围并校验(越界/非数字禁用确定,回车确认,Esc/遮罩取消)
- 偏好持久化在
localStorage;手动模式点击「刷新」即时刷新
v0.2.0
- 首次引入刷新模式控制与 MIT 许可证、效果示意图
v0.1.0
- 首个版本:实时显示 DeepSeek API 余额(每 30 秒固定刷新)
许可证
MIT © 2026 02Muller25
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