dsh-balance-pill
Manifest validDeepSeek Harness 常驻余额胶囊:右下角一眼看到 DeepSeek 账户余额,不碰凭据、不需要 API Key。A tiny resident balance pill for the DSH Web UI.
dsh-balance-pill
DeepSeek Harness 常驻余额胶囊 —— 右下角一眼看到你的 DeepSeek 账户余额,不用再点开设置。
A tiny resident balance pill for the DeepSeek Harness Web UI. ~12 KB of plain JavaScript, no HTTP endpoints of its own, no credentials touched, no API key needed.
它长什么样
界面右下角一个圆角小胶囊:
● 余额 ¥12.34
- 鼠标悬停 → 显示赠送额度、更新时间、刷新说明
- 点击 → 立刻刷新
- 每 60 秒自动刷新,只在页面可见时计时;切回页面或窗口重新获得焦点时立刻补一次
- 亮/暗主题自动跟随,中英文跟随界面语言
| 状态 | 外观 | 含义 |
|---|---|---|
| 正常 | 绿点 + 余额 ¥12.34 | 读到充值钱包余额 |
| 加载中 | 灰点 + 余额 -- | 正在读取 |
| 未登录 | 灰点 + 余额 -- | 当前用 API Key,没有平台账户凭据 |
| 读取失败 | 橙点 + 余额 -- | 平台请求失败;悬停显示原因 |
| 异常 | 红点 + 余额 -- | 调用本身出错;悬停显示错误信息 |
快速开始
官方桌面端 —— 侧栏 → Plugins(插件) → 安装 → 填:
github:fdghdfghdfghd/dsh-balance-pill
装完如果没出现,完全退出客户端(含托盘)再打开。
dsh web / 其他 profile:
dsh plugin --profile web add github:fdghdfghdfghd/dsh-balance-pill
装完重启 dsh web,浏览器 Ctrl+F5。
安装细节
官方桌面端(Electron 客户端)
桌面端读的是 desktop profile,而 dsh plugin --profile desktop … 这条命令按设计会被 CLI 拒绝——它归应用的插件管理器管。所以只能走应用内的 Plugins 页面,不能照抄下面的 --profile web 命令。
本地开发
git clone https://github.com/fdghdfghdfghd/dsh-balance-pill.git
dsh plugin --profile web add link:D:\path\to\dsh-balance-pill
link: 是软链安装,改源码立即生效(前端改动刷新页面即可);之后不要移动该目录,移动了要重新 add 一次。
卸载
dsh plugin --profile web remove dsh-balance-pill
桌面端在 Plugins 页面里点卸载。
它是怎么工作的
余额不是自己去请求平台接口,而是复用宿主已经挂载的 account Remote 命名空间:
ctx.remote.account.getBalance({ version, locale, timezoneOffsetSeconds })
这和「设置 → 账户 → 余额」卡片调用的是同一个宿主方法。因此:
- 浏览器永远拿不到 token —— 凭据、平台地址、请求头、超时、失效处理全部留在宿主侧;
- 插件不碰账号逻辑,也不需要你配置任何 API Key;
- 未登录(只用 API Key)时该方法返回
null,胶囊显示为「未登录」。
金额格式与官方账户卡片对齐:两位小数、千位分组、正的次分金额显示为 <¥0.01。
结构
| 文件 | 作用 |
|---|---|
package.json | dsh.bundle.patch 指向补丁;dsh.client 声明浏览器半边 |
cordis.patch.yml | 只插入一行宿主条目 |
index.js | 宿主半边,空实现 —— 它的唯一作用是让 Loader 有一行条目,浏览器模块系统据此发现 dsh.client 声明 |
client.js | 浏览器半边:注册进 shell.overlay 浮层并渲染胶囊 |
界面文案走 Client locale 服务(命名空间 dsh-balance-pill,zh / en);配色只使用宿主主题令牌(--dsw-alias-*),因此亮暗主题自动跟随;控件自己打开 pointer-events,浮层其余部分保持点击穿透。
常见问题
装完右下角什么都没有?
依次查三处:① 装到了哪个 profile —— 桌面端必须是 desktop,用 --profile web 装的东西桌面端读不到;② dsh.profile.bundles 里有没有 dsh-balance-pill;③ 完全退出客户端再打开(热加载对首次安装不总是够)。
一直显示「未登录」? 说明宿主里没有平台账户凭据。去「设置 → 账号」登录 DeepSeek 账号;只用 API Key 是不会走到账户余额接口的。
和别的挂件打架?
它固定占据右下角 16px 处。先看看有没有其他插件(比如桌宠类)也占这块;要挪位置就改 client.js 里按钮的 right / bottom。
刷新太频繁 / 太懒?
改 client.js 里的 REFRESH_INTERVAL_MS(默认 60000 毫秒)。
会消耗我的 API 额度吗?
不会。它读的是账户余额,一次 GET 快照,不发起任何模型请求。
兼容性
- 在 DSH 0.2.0-rc.2(Windows 桌面端) 上实测可用;
- 只在浏览器半边生效(
dsh.client.platform = web),需要宿主挂载了accountRemote(桌面端 / 登录了 DeepSeek 账号的 Web 端)。没有该命名空间时插件会安静地不激活,不会报错。
已知限制
- 只显示余额,不做记账、不算每轮消耗。想要「今天花了多少 / 每轮花了多少 / 多厂商额度」,用 dsh-whale-widget 这类完整桌宠记账插件更合适 —— 这个胶囊解决的是「一眼看到」。
- 位置固定在右下角,没有设置界面(改常量即可)。
- 没有单元测试。验证方式见下 —— 是「宿主是否真的把这个 bundle 编进了启动图」,而不是「代码看着没问题」。
开发与验证
改刷新间隔:client.js 里的 REFRESH_INTERVAL_MS。
改文案:同文件的 COPY。
验证插件真的被宿主加载了(而不是只躺在 node_modules 里):DSH 的 /plugins 路由只按精确的 id + rev 响应,rev 由 bundle 的 mtimeMs/ctimeMs/size 派生:
curl "http://127.0.0.1:<port>/plugins/??dsh-balance-pill/client.js&rev=<rev>"
返回 200 且响应体含 __ModuleLoader__ 即说明:Loader 条目已启用、dsh.client 声明合法、bundle 已编入启动图。错 rev 或错 id 必须 404 —— 拿这个做反向对照,否则容易把「服务器对什么都答 200」误判成成功。
变更记录
见 CHANGELOG.md。
License
MIT —— 见 LICENSE。图标由脚本生成,随项目一并按 MIT 发布。
English
A ~12 KB resident widget for the DeepSeek Harness Web GUI that shows your DeepSeek account balance in the bottom-right corner.
- Registers a React component into the
shell.overlayslot; follows theme tokens and the client locale service. - Reads the balance through the host's existing
accountRemote (getBalance) — the browser never receives a token, and no API key is required. - Refreshes every 60 s while the page is visible, on click, and when the window regains focus.
- Install:
dsh plugin --profile web add github:fdghdfghdfghd/dsh-balance-pill(on the official desktop app, use the in-app Plugins page instead — thedesktopprofile belongs to the app's plugin manager).
MIT licensed. It only displays the balance; for per-turn cost accounting and multi-vendor quotas, use a full desktop-pet accounting plugin instead.
Comments
Loading…
Similar plugins
by zhangjianyu1006156
DeepSeek API 余额显示插件:左下角余额胶囊、低余额预警、余额趋势、一键充值。密钥不出主机端。
★ 3
↓ 134/wk
MIT
JavaScript
Oct 4, 2026
dsh plugin --profile web add dsh-balance-displayby wangxiang0605qvq
DSH 侧边栏实时 DeepSeek 账户余额插件(走账号登录,无需 API Key) | Live DeepSeek account balance in the DSH sidebar
★ 0
MIT
JavaScript
Sep 29, 2026
dsh plugin --profile web add @deepseek-ai/dsh-deepseek-balanceby hnmrxz
在 DeepSeek Harness (dsh) 底部状态栏实时显示 DeepSeek 账户余额。
★ 4
MIT
JavaScript
Aug 15, 2026
dsh plugin --profile web add dsh-plugin-deepseek-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-balanceby zlZayn
DSH 插件:在左侧栏底部显示 DeepSeek 账户余额(原生 UI),设置页提供连接、展示币种、预警阈值与刷新节奏的配置卡片。(原生嵌入“设置-插件-插件配置”)
★ 2
↓ 417/wk
MIT
TypeScript
Sep 19, 2026
dsh plugin --profile web add dsh-ds-balanceby lijunyu726
DSH Web GUI 会话页头部余额芯片:经宿主侧 Remote 用你的 API Key 查询 DeepSeek 账户余额,点击跳转充值,悬停可见赠送/充值拆分。API Key 不进浏览器。
★ 1
↓ 44/wk
MIT
JavaScript
Sep 14, 2026
dsh plugin --profile web add dsh-header-balance