
jelly-000/dsh-balance-monitor
80Last commit Aug 14, 2026
dsh-balance-monitor DSH plugin
A minimal DeepSeek Harness (DSH) plugin that shows your DeepSeek API balance, a proportional bar, and today's spent amount in the sidebar footer. It uses official design tokens for a clean look. The balance is fetched server-side via the DeepSeek balance API, and the client only sees the numeric value.
How to install the dsh-balance-monitor DSH plugin
dsh plugin --profile web add "github:<you>/dsh-balance-monitor#mainThis source command needs manual review. Copying does not run it.
dsh-balance-monitor DSH plugin data source
dsh-balance-monitor DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-balance-monitor DSH plugin can do
- Real-time balance display via GET https://api.deepseek.com/user/balance
- Today's spending calculation: subtraces current balance from the day's first baseline
- Proportional bar with three color tiers: blue → amber → red
- 60s auto-polling plus refresh on tab visibility change
- Graceful degradation: shows stale data with a dimmed style when upstream fails
- Collapsible round icon with compact amount and tooltip on hover
Where the dsh-balance-monitor DSH plugin fits
- Monitor DeepSeek API balance to avoid unexpected interruption during heavy usage
- Track daily API spending to stay within budget limits
- Quickly check balance without leaving the DSH UI
- Receive visual warning via color-coded progress bar when balance is low
Who the dsh-balance-monitor DSH plugin is for
- Developers using DeepSeek API via DSH
- Teams managing multiple DeepSeek accounts and need balance visibility
- Power users who want a lightweight, non-intrusive balance monitor in their DSH sidebar
dsh-balance-monitor DSH plugin limitations
- Only supports DeepSeek API (not compatible with other providers)
- Requires a valid DeepSeek API key stored in DSH credentials
- Currently only works with the Web UI profile (profile web)
dsh-balance-monitor DSH plugin: from the repository README
Quoted from the jelly-000/dsh-balance-monitor README, the upstream source of the dsh-balance-monitor DSH plugin. Copyright remains with the original authors.
DeepSeek 账户余额,直接显示在 dsh 侧边栏底部。 一个极简的 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) 插件:在侧边栏底部(设置上方)显示你的 DeepSeek API 账户余额、一条细的余额剩余比例条,以及当天已花费的金额。样式完全使用官方设计令牌,克制内敛。 <p align="center"> <img src="docs/preview/balance-wide.png" alt="侧边栏底部余额卡片" width="280"> </p> ## 功能 | 功能 | 实现 | |---|---| | 实时余额 | 服务端调用 `GET https://api.deepseek.com/user/balance`,使用 `$DSH_HOME/.credentials.yaml` 中的 `DEEPSEEK_API_KEY`(环境变量优先) | | 今日花费 | 当天首次成功查询的余额记为基线(持久化在 `$DSH_HOME/storages/balance-monitor.json`);花费 = `max(0, 基线 − 当前)`。充值不会让数字变负 | | 比例条 | 当前余额 ÷ 当日基线,蓝 → 琥珀 → 红 三档渐降 | | 位置 | 注册在官方 `sidebar.footer.action` 槽位 —— 设置上方,零 hack | | 折叠态 | 收起后变为 36px 圆形,显示紧凑金额 + tooltip | | 健壮性 | 60s 轮询 + 切回标签页时刷新;上游失败时保留上次数据(变淡标记 stale),不闪错误 | ## 安装 浏览器端 bundle 是手写的 classic script,**无构建步骤**,git 安装无需 prepare 脚本: ```sh dsh plugin --profile web add "github:<you>/dsh-balance-monitor#main" ``` 或从 npm(发布后): ```sh dsh plugin --profile web add dsh-balance-monitor ``` 然后重启 Web UI(`dsh --profile web`)。卡片出现在展开的侧边栏底部、设置按钮上方。 ## 工作原理 一个插件行同时承担两种角色(`dsh.bundle` patch + `dsh.client` 浏览器注册表声明): - **服务端半**(`lib/index.js`)—— 在 `ctx.connection` 上注册 `/balance` RPC 通道(loopback 信任围栏)。每次调用读取 API key、查询余额
Read the full READMERepository license: MIT
dsh-balance-monitor DSH plugin questions
How do I install this plugin?
Run `dsh plugin --profile web add "github:jelly-000/dsh-balance-monitor#main"` in your terminal. Then restart the DSH Web UI with `dsh --profile web`. The balance card will appear at the bottom of the expanded sidebar, above the settings button.
How do I configure my DeepSeek API key?
The plugin reads the API key from your DSH credentials file at `$DSH_HOME/.credentials.yaml` under the key `DEEPSEEK_API_KEY`. It also supports the `DEEPSEEK_API_KEY` environment variable, which takes precedence. Make sure the key is set before starting DSH.
How often does the balance update?
The plugin polls the DeepSeek balance API every 60 seconds. It also refreshes immediately when you switch back to the DSH browser tab. If the API call fails, the last known data is shown with a dimmed style to indicate staleness.
Is my API key safe?
Yes. The API key never leaves the server side. The browser half only receives the numeric balance through a loopback RPC channel. No telemetry is collected, and the only network request is to the official DeepSeek balance endpoint.
Does this plugin work with other AI models?
No, it is specifically designed for DeepSeek API. It calls the DeepSeek balance endpoint and uses the DeepSeek API key. It will not work with OpenAI, Claude, or other providers.