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-quotadsh-plugin-account-balancedsh-balance-plugindsh-usage-plugin

License

MIT