dsh-deepseek-balance
Manifest validShows the DeepSeek API account balance and live round-trip latency to the configured inference provider in one sidebar widget, with a configurable low-balance alert threshold.
余额 + 延迟挂件 · @local/deepseek-balance
在 DeepSeek Harness Web UI 侧边栏底部常驻一个小挂件,同时显示 账户可用余额 和 到模型服务商的实时网络延迟。
● ¥19.21 · 178ms
它做什么
Host 半(index.js),两条同源路由,Key 与探测都留在 Host 进程:
| 路由 | 内容 | 缓存 |
|---|---|---|
GET /deepseek-balance | DEEPSEEK_API_KEY 账户余额(api.deepseek.com/user/balance) | 10s |
GET /deepseek-balance/ping | 对各服务商 origin 的 HEAD 往返耗时 | 2s |
两条路由都接受 ?refresh=1 绕过缓存。延迟探测的目标自动从当前 provider 配置发现:
先读 llm-deepseek 的 baseURL,再读 llm-pi-ai 的 providers.*.baseURL,都没有就退回
https://api.deepseek.com。可用环境变量覆盖:
DSH_BALANCE_PING_URLS=https://a.example,https://b.example
Client 半(client.js)注册到 sidebar.footer.action:
- 余额每 30 秒轮询,延迟每 5 秒轮询;页面重新可见时立即刷新
- 点击挂件 = 强制刷新两者
- 延迟颜色:
≤400ms常规、>400ms警告、>900ms或不可达 报错红 - 悬停可见:总余额 / 充值 / 赠金 / 各目标 host 的延迟 / 更新时间
- 延迟路由尚未就绪时(例如 Host 还没重启),挂件自动只显示余额,不显示红杠
显示规则
| 情况 | 挂件 |
|---|---|
| 正常 | ● ¥19.21 · 178ms |
| 余额读取中 | ● ··· · 178ms(黄点) |
| 缺少 API Key | ● 未配置 DEEPSEEK_API_KEY · 178ms(红点) |
| 余额失败 / Key 无效 | ● — · 178ms(红点) |
| 服务商不可达 | ● ¥19.21 · —(延迟变红) |
| 侧边栏收起 | 只显示 ¥19.21(56px 窄栏放不下延迟) |
配置
无需配置项。余额读取使用的环境变量名固定为 DEEPSEEK_API_KEY
(在 ~/.ds-harness-desktop/dsh-home/.credentials.yaml 的 refs 下维护),
每次查询都会重新解析,换 Key 不用重启。
安装
plugin_manager install_bundle target=<本目录绝对路径>
安装后插件行 id 为 deepseek-balance,可在「设置 → 插件」中启用/停用。
回归测试
test-host.mjs 用一个替身 ctx 真跑一遍 apply(),验证两条路由、余额、延迟探测和缓存:
$env:TEST_KEY = "<DEEPSEEK_API_KEY>"
node test-host.mjs
Comments
Loading…
Similar plugins
Shows DeepSeek API balance and tells whether the current moment is peak or off-peak pricing time, with a live countdown to the next switch.
★ 0
dsh plugin --profile web add dsh-balanceby 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 novaschai7
DeepSeek account balance, today's token usage and estimated spend in the dsh Web client sidebar. · 在 dsh 侧边栏显示 DeepSeek 余额、今日 token 用量与花费估算。
★ 0
MIT
JavaScript
Sep 30, 2026
dsh plugin --profile web add dsh-plugin-balance-uiReal-time DeepSeek API usage: account balance with low-balance alerts (browser notification on threshold crossing), token & request stats (total/today/last-60s windows, per-model and per-session), est
★ 0
↓ 177/wk
dsh plugin --profile web add dsh-deepseek-usageby dsh-plugin-lab
DSH plugin: shows your DeepSeek account balance at the bottom of the left sidebar (native UI)
★ 4
↓ 511/wk
MIT
TypeScript
Oct 20, 2026
dsh plugin --profile web add dsh-ds-balanceby etony668
DeepSeek API 余额常驻显示(侧边栏「设置」旁)· DeepSeek API balance badge beside Settings in the DSH sidebar
★ 0
MIT
JavaScript
Sep 29, 2026
dsh plugin --profile web add @etony668/dsh-balance