Permanent composer-dock balance card: real-time DeepSeek API account balance with 5-minute auto-refresh, a manual refresh button, and low-balance color warnings.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:ibka512/dsh-ibka-balance
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
一个为 DeepSeek Harness (dsh) Web 界面编写的常驻余额监测插件: 在聊天输入框下方的统计栏里实时显示 DeepSeek API 账户余额,每 5 分钟自动刷新,余额过低时变色提醒。
本插件最初由一轮 AI 辅助开发会话产出,随后打包为常驻插件并发布到社区。Architecture: Host 端通过
credentials服务取 API Key,经subprocess+curl请求https://api.deepseek.com/user/balance,注册 HTTP 路由/api/ibka-balance;Client 端用浏览器原生window.fetch轮询并渲染在conversation.composer.dock插槽。
功能
- 🟢 实时显示总余额(
total_balance,多币种求和) - 🔄 每 5 分钟自动刷新 + 手动 ⟳ 刷新按钮
- 🟠 < ¥10 变橙色 · 🔴 < ¥5 变红色 · 账户不可用变红
- ℹ️ 悬停显示充值余额 / 赠金余额明细
- 🔒 API Key 只在 Host 端,绝不出进程、不进浏览器
安装(手动)
将本仓库的
dsh-ibka-balance目录复制到你的 profile 的 node_modules 下:~/.dsh/profiles/web/node_modules/dsh-ibka-balance/在
~/.dsh/profiles/web/cordis.patch.yml末尾追加:- insert: - id: ibka-balance name: 'dsh-ibka-balance'重启 DeepSeek Harness App(web 模式暂不热更新配置),必要时刷新浏览器页面。
依赖:curl(macOS 自带)、DEEPSEEK_API_KEY 凭据(已存在于 ~/.dsh/.credentials.yaml 或环境变量)。
卸载
删除 cordis.patch.yml 中对应的 insert 行,并删除 node_modules/dsh-ibka-balance 目录,重启即可。
原理
| 层 | 职责 |
|---|---|
| Host | inject: ['webServer', 'credentials'] 等待服务就绪;webServer.register 两个精确路由:GET /api/ibka-balance(余额)、POST /api/ibka-balance/log(客户端自诊断上报,写入工作区 balance-card-report.txt) |
| Client | window.__ModuleLoader__.load 打包的浏览器模块;注册 conversation.composer.dock 插槽条目(防重复注册),window.fetch 轮询,window.setInterval 定时 |
许可证
MIT © phonejoy
Links
More in this category
bowenliang123/dsh-context★ 1556
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 344
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 214
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 202
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 168
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 120
Personal center for DeepSeek Harness: cross-session usage statistics, per-model cost estimation, global custom instructions, a global font-size adjuster, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.