display-api-balance
Manifest valid★ 1一款用于显示API余额的DSH桌面版插件
display-api-balance
English | 中文
Shows the DeepSeek API balance as an ambient stat under the DeepSeek Harness composer and refreshes it every 60 seconds. Click the balance to set a local low-balance threshold; the amount turns red once it reaches the threshold.
Features
- Renders in the composer's stat row below the input, after the shipped "turns · steps · tok/s" and token-usage stats, sharing their font size, color and icon style — no separate floating layer.
- Refreshes every 60 seconds; also refreshes immediately when the window or tab regains focus.
- Click the balance to open a small panel and set a low-balance threshold (default ¥20). At or below it the amount turns red and bold; leave the field empty to disable the alert.
- The threshold is a local preference stored in the browser
localStorage(display-api-balance:threshold); it is never uploaded or sent over the network. - Clear states for a missing
DEEPSEEK_API_KEY, a failed request, or a signed-out account — no wrong number is displayed. - Theme aware: every color comes from DSH's
--dsw-alias-*semantic tokens.
Install
DSH bundles are installed into a profile. From the desktop Plugins page or the CLI:
# From GitHub (source is the artifact: no build step, no allowBuilds approval)
dsh plugin --profile <profile> add github:river291/display-api-balance
Then confirm display-api-balance is enabled on the Plugins page.
The plugin is distributed from GitHub; there is no npm release yet, so install
with the GitHub spec above. If it is published to npm later,
dsh plugin add display-api-balance will work as well. The published package's
repository field points back at this repository, so marketplaces can map npm
data to it.
Requirements
- The host's credential service must resolve
DEEPSEEK_API_KEY: fill in a DeepSeek API key under DSH Settings → Models, or export the variable in the environment that launches DSH. - DSH version: developed and verified on
0.2.1-rc.5(desktop). The host half only useswebServerandcredentials; the client half only usesslotsandlocale.
How it works
- Host half (
index.js) registersGET /api/balance. Each request re-resolves theDEEPSEEK_API_KEYcredential (rotating the key needs no restart), callshttps://api.deepseek.com/user/balancewithAuthorization: Bearer, applies a 15-second timeout, and returns the upstream JSON. The key stays inside the host process and is never handed to the browser. - Client half (
client.js) registers the balance as one text stat in theconversation.composer.dockslot (order: 2, after the context-occupancy meter). A relativefetch('/api/balance')reaches the host route above through thedsh-app://protocol in the desktop app, and as a same-origin request in the web build. - For plain-HTTP web deployments: like any other host route,
/api/balanceis meant to be bound to the loopback address only.
Difference from the old web approach
The web version used webServer.tapIndex to inject a DOM script into
index.html. The desktop (Electron) window loads the page from the packaged
dsh-web-frontend/dist and never runs the host's renderIndex, so injected
scripts do not execute there. This plugin renders through a client slot with
React instead, so both the desktop and web builds work.
Uninstall
dsh plugin --profile <profile> remove display-api-balance
License
MIT
Comments
Loading…
Similar plugins
by etony668
DeepSeek API 余额常驻显示(侧边栏「设置」旁)· DeepSeek API balance badge beside Settings in the DSH sidebar
★ 0
MIT
JavaScript
Oct 17, 2026
dsh plugin --profile web add @etony668/dsh-balanceby 02Muller25
安装在deepseek的插件,能够实时显示当前api的余额,30秒自动刷新一次
★ 12
MIT
JavaScript
Aug 15, 2026
dsh plugin --profile web add api-balanceby AKUSH99
Live DeepSeek API balance in the sidebar footer plus an always-visible bottom-right pill: status dot and amount, refreshed every 60 seconds, the API key is read from the local credential store and nev
★ 0
MIT
JavaScript
Aug 26, 2026
dsh plugin --profile web add dsh-balance-chipby zhangjianyu1006156
DeepSeek API 余额显示插件:左下角余额胶囊、低余额预警、余额趋势、一键充值。密钥不出主机端。
★ 3
↓ 149/wk
MIT
JavaScript
Oct 4, 2026
dsh plugin --profile web add dsh-balance-displayby Anyway-one
Multi-provider balance monitor with low-balance alerts and trend history for the dsh web GUI
★ 0
JavaScript
Aug 26, 2026
dsh plugin --profile web add dsh-balanceby zlZayn
DSH 插件:在左侧栏底部显示 DeepSeek 账户余额(原生 UI),设置页提供连接、展示币种、预警阈值与刷新节奏的配置卡片。(原生嵌入“设置-插件-插件配置”)
★ 2
↓ 362/wk
MIT
TypeScript
Sep 19, 2026
dsh plugin --profile web add dsh-ds-balance