在 DSH 对话底栏(输入框下方的统计行)显示当前 DeepSeek 账户的剩余余额,定时刷新,并在每轮对话结束后立即更新。
安装
# Release 预构建包
dsh plugin --profile web add "https://github.com/azkbzxf/dsh-account-balance-pill/releases/download/v1.0.0/dsh-account-balance-pill-1.0.0.tgz"
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:azkbzxf/dsh-account-balance-pill
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
A DeepSeek Harness (DSH) plugin that shows the remaining balance of the signed-in DeepSeek account in the composer bottom bar — the stat row under the message box that already carries N turns · M steps, tokens/s, token usage and the context ring.
[welcome icon] 余额 ¥12.34 [stats] 1 轮 160 步 · 254 tok/s [usage] 10.9M tok · 缓存命中 98% (ring) 9%
The pill shows the total spendable balance (topped-up + granted) per currency, e.g. 余额 ¥17.34; hovering it breaks the total down into topped-up and granted amounts, shows when it was last refreshed, and reminds you that a click refreshes it.
- Package name:
dsh-account-balance-pill - Shape: one DSH bundle — a Host row inserted by
dsh.bundle.patchplus a Web Client half; no dependencies, no build step - Rendering: a single entry (id
account-balance) in the slotconversation.composer.dock, next to the shippedactivityandusagepills - Data: the account Remote that ships with DSH (
ctx.get('remote.account').getBalance(...), the same call the Settings → Account panel makes). The plugin stores nothing, reads no credential file, and makes no network request of its own.
Install / 安装
Install from GitHub into the profile you use:
dsh plugin --profile <profile> add github:azkbzxf/dsh-account-balance-pill
A newly added bundle activates on the running instance (the Host row is live immediately and the Client half hot-loads into the open page). Replacing an already-installed copy needs a DSH restart for the fresh client build.
Inside DSH Desktop you can also use the plugin manager:
{ "action": "install_bundle", "target": "D:\\path\\to\\dsh-account-balance-pill" }
Remove:
dsh plugin --profile <profile> remove dsh-account-balance-pill
What it shows / 显示规则
| Account state | Bottom bar |
|---|---|
| Signed in with a balance | Wallet icon + 余额 ¥12.34; tooltip with the topped-up / granted breakdown, last-update time and a click-to-refresh hint |
Signed out, or no account grant (the Remote returns null) |
Nothing — no placeholder, no error |
| Read failure (offline, host refused) | Keeps the last known value, dimmed as stale; stays hidden if no value was ever read |
| Currencies | ¥ for CNY and $ for USD; topped-up + granted are combined per currency, CNY first |
Amounts are formatted by truncating to cents, matching the official Settings page so the pill never shows more money than is actually available; thousands are grouped. 0 shows ¥0.00, anything under one cent shows <¥0.01.
Refresh / 刷新时机
- immediately when the pill mounts;
- every 30 s while the page is visible (skipped while hidden, one catch-up read when it becomes visible again);
- 1.5 s after a turn completes (when the
sessionStatsprojection'sstepschanges); - when the window regains focus or the page becomes visible (only if the data is older than 15 s);
- as soon as a late-loading account Remote appears;
- on click.
One request is in flight at a time, requests are at least 3 s apart, and failures back off exponentially from 4 s up to 60 s before recovering automatically.
Compatibility / 兼容性
- Targets the DSH Web GUI (the browser UI shared by DSH Desktop and
dsh web), verified on DSH Desktop 2.0.18 with client0.2.1-rc.2. - Uses only supported extension points: the list slot
conversation.composer.dockand the shipped account Remote. It never replaces or edits existing UI, never reads another plugin's DOM or styles, never appends todocument.body. - Styles use Harness theme tokens only (
--dsw-*/--dsh-*), so light/dark themes and font-size changes are inherited. All visible text goes through the DSH client locale service (zh/en) and follows the interface language. - Every dependency is optional: no account Remote → the plugin loads and stays hidden; a read failure keeps the last value; a render failure is caught by an error boundary scoped to this one entry, so the rest of the dock is unaffected.
- The account service is read through the service registry (
ctx.get('remote.account')) because thectx.remote.accountproperty chain is only readable from contexts that declare that dependency explicitly. package.jsonexports"./package.json"because DSH's client-module composition locates the package manifest through that export, and thedsh.bundle.patchrownamematches the package name.- The Host half is a no-op: it registers no credential, network client, tool or session resource.
Configuration / 可调参数
The poll interval can be overridden globally (milliseconds, clamped to 5 s – 1 h):
window.__DSH_ACCOUNT_BALANCE__ = { intervalMs: 60000 };
Development / 开发
test/harness.mjs is an offline smoke test: it loads client.js with stub React/document/locale/slots/remote implementations and asserts the slot registration, locale namespace, request metadata, formatting, hidden/stale states and timer counts.
node test/harness.mjs client.js
File map: client.js — Client half (pill, store, formatting, styles); index.js — no-op Host half; cordis.patch.yml — the bundle patch; locale/{en,zh}.json — display metadata for the plugin list; icon.svg — artwork.
Known limitations / 已知限制
- The balance comes from the DeepSeek account platform and is up to a few seconds behind, not ledger-real-time.
- The dock row only renders while a session's composer is visible (existing behaviour of the shipped slot).
- If the platform keeps failing while signed in, the plugin keeps backing off and logs one console warning on the first failure; it never opens a dialog.
License
MIT.
链接
同类插件
zhu1090093659/dsh-web#packages/dsh-task-board★ 10406
侧边栏多列任务看板:卡片交给真实 DSH 智能体会话执行,支持 cron 定时(Host 侧到点执行,关浏览器也生效)。
zhu1090093659/dsh-web#packages/dsh-web-all★ 10406
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
ccch1mneyyy/dsh-TUI★ 7675
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7201
右下角常驻的小鲸鱼挂件:余额、今日已用与每轮对话消耗(含峰谷价),余额预警与今日预算的泡泡内容都可编辑;泡泡点击序列模块化自定义,支持并列加权 A/B、随机台词与随机图片;内置 30+ 厂商模板(OpenAI / OpenRouter / Kimi / 硅基流动 / 方舟 / 智谱 / MiniMax 等),按模型查余额与订阅额度;另有任务结束音效、导入音频、自定义角色与资源管理。数据全在本机,无遥测。
omdsh-dev/DSH-better-sidebar★ 5142
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
Devin-AXIS/deepseek-design#deepseek-idesign★ 1816
可视化设计工作室,支持网站、App 原型、海报、信息卡、报告和杂志的模板创建、元素编辑、选区级 AI 草稿衔接与导出。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。