dsh-plugin-balance
August 16, 2026 · View on GitHub
DeepSeek API 余额徽章插件,为 DeepSeek Harness (DSH) Web 界面在右下角显示当前 DeepSeek API 账户余额,每 10 分钟自动刷新。
A DeepSeek API balance badge plugin for the DeepSeek Harness (DSH) web GUI: a floating bottom-right badge showing the remaining DeepSeek API balance, auto-refreshing every 10 minutes.
功能 / Features
- 右下角悬浮余额徽章(
DeepSeek ¥31.84),不遮挡内容、不影响布局(挂载在shell.overlay页面级浮层) - 每 10 分钟自动刷新,也可点
↻手动立即刷新 - 悬停显示详情:总余额 / 充值余额 / 赠送余额 / 更新时间
- 状态圆点:绿色正常、黄色余额偏低(< 10)、红色获取失败或账户不可用
- 跟随主题变量(浅色/深色模式自适应)
安装 / Install
把本仓库放进 DSH profile 可解析的 node_modules(例如 $DSH_HOME/profiles/node_modules/),然后在 profile 的 cordis.patch.yml 里加一行:
- insert:
- id: balance
name: dsh-plugin-balance
重启 dsh 并刷新页面即可。要求:
- 已通过 DSH 凭据服务配置
DEEPSEEK_API_KEY(Web 的 Models 设置页可配置) - 系统有
curl(macOS / Linux 自带) - 如需自定义,可在
llm-deepseek设置里改apiKeyEnv/baseURL,插件自动跟随
工作原理 / How it works
- Host 端(
lib/index.js):组合中的固定插件行,通过webServer注册GET /ds-balance精确路由;用credentials服务解析 API Key,shell执行curl请求https://api.deepseek.com/user/balance - 浏览器端(
lib/client.js):按 DSH 客户端模块格式(window.__ModuleLoader__.load+dsh.client清单)打包,注册到shell.overlay槽位;fetch('/ds-balance')+setInterval实现 10 分钟刷新
类似项目 / Alternatives
同思路的社区插件:dsh-deepseek-quota、dsh-plugin-account-balance、dsh-balance-plugin、dsh-usage-plugin。
License
MIT