- Home
- Plugins
- UI Enhancements
- dsh-balance-sticker
dsh-balance-sticker
haixiaz/dsh-balance-sticker
Draggable glass sticker for the DSH web GUI that shows DeepSeek account balance, today's spend and the peak/off-peak pricing window, with a sun or moon glyph that follows the real lunar phase.
Install
dsh plugin --profile web add github:haixiaz/dsh-balance-stickerREADME
余额贴纸 · dsh-balance-sticker
给 DeepSeek Harness Web GUI 左下角贴一张可拖动的玻璃卡片:账户余额、今日消耗、谷峰计费窗口,外加一枚按真实月相变化的日月图钉。

截图中的金额一律以
00.00占位,真实余额不会进入文档或发布包。
功能
- 余额:DeepSeek 账户可用余额,优先人民币,赠送金额单独标注。
- 今日:按余额差值估算的今日消耗,按北京时间分日,跨日自动归零。
- 谷峰:状态药丸(
平价/谷/峰)+ 倒计时 + 下一阶段及其时长;底部进度条按当前计费窗口计时,每小时一道刻度,前端是球形游标。 - 日月图钉:白天太阳、夜间月亮;月亮用真实月相与亮面/地平线夹角(天文计算),贴图为真实月面照片。
- 玻璃外观:日间通透、夜间深色,随太阳高度平滑过渡;也可强制白天/夜间。
- 自由摆放:拖动到任意位置、右下角缩放;字号、进度条、内边距随尺寸联动(可选锁定)。
- 零运行时依赖:不 require 任何
@deepseek-ai/dsh-client-*包,纯 React 元素 + 原生fetch。
安装
# 指向本仓库解压后的目录
plugin_manager install_bundle target=<绝对路径>/dsh-balance-sticker
安装后在 GUI 右上角按一次 ⟳(或重启 DSH)即可看到卡片。修改 client.js / index.js 后同样按 ⟳ 生效。
环境:DeepSeek Harness 桌面端 / Web GUI(dsh.client.platform = "web")。已在 Windows + DSH 0.2.x 验证。
数值来源
- 已登录账号:
deepseekAccount服务(getState→getBalance),无需 API Key。 - 未登录或取数失败:回退到凭据
DEEPSEEK_API_KEY调开放平台GET https://api.deepseek.com/user/balance。
余额 25 秒缓存并做请求去重;失败时保留上一次成功数据(卡片半透明表示数据陈旧)。点卡片任意处立即刷新。
今日消耗落在 $DSH_HOME/balance-sticker-usage.json(仅当 Host 侧可写时;桌面端以外壳限制为准)。
计费规则
| 时段 | 价格 |
|---|---|
| 周一至周五 09:00–12:00、14:00–18:00(北京时间) | 高峰(全价) |
| 其余时间:夜间、午休、周末、2026 年法定节假日 | 平价(半价) |
与 DeepSeek 官方定价页一致。插件不臆造第三档费率,低谷 只是“空闲”这一档可切换的显示名与配色。
外观面板
点卡片右下角的日/月图标即可展开(面板贴在卡片侧边,不撑大卡片):
| 项 | 范围 / 说明 |
|---|---|
| 高峰颜色 / 空闲颜色 | 两个强调色,取色器直接改 |
| 空闲显示为 | 平价 / 谷——决定空闲档的徽章文字 |
| 白天透明 / 夜间透明 | 卡片底色不透明度(12–88% / 24–96%) |
| 模糊 | 背景模糊半径 0–30px(0 最省性能) |
| 面板透明 | 面板自身底色不透明度 20–100% |
| 昼夜 | 自动(跟太阳高度)/ 白天 / 夜间 |
| 尺寸 | 自适应(字号随卡片缩放)/ 固定 |
| 纬度 | 自动(按时区查表)或手动 −60…60 |
| 恢复默认位置与大小 | 一键回到左下角 |
所有偏好保存在 localStorage 的 dsh-balance-sticker.prefs.v2,刷新与重启都保留。
文件结构
| 文件 | 作用 |
|---|---|
index.js | Host 半:/dsh-balance-sticker/snapshot.json 路由、余额抓取、谷峰窗口计算、今日消耗账本 |
client.js | Client 半:React 卡片(body 级自建根节点、不占 shell 槽位)、日/月图标、外观面板 |
cordis.patch.yml | Loader 补丁:插入 balance-sticker 行 |
locale/*.json | 插件中心的标题与描述(中/英) |
icon.svg | 插件图标 |
docs/screenshots/ | README 用截图(不参与运行时) |
实现要点
- 卡片挂在自建的
document.body根节点上(position:fixed; z-index:2147483000),因为shell.overlay层的层叠顺序低于侧边栏与对话列,直接注册槽位会出现“透字 + 点不到”。 - Host 侧两条路由都做过
connection.requestRejection校验;余额接口只走服务端,前端拿不到 Key。 - 桌面壳对
dsh-app://的写请求返回 405,因此偏好以localStorage为准,Host 文件写入失败后会自动停止重试。
许可与署名
- 代码:MIT(见
LICENSE)。 - 月面照片:
FullMoon2010.jpg,作者 Gregory H. Revera,许可 CC BY-SA 3.0,来源 Wikimedia Commons。本插件将其缩放到 128×128、提亮后以 base64 内嵌于client.js,仅用于月亮图标的纹理与相位遮罩;该照片及其衍生纹理按 CC BY-SA 3.0 分发。
English
A DeepSeek Harness plugin that pins a draggable glass sticker to the bottom-left of the web GUI, showing account balance, today's spend, and the peak/off-peak pricing window — with a sun/moon glyph that follows the real lunar phase and a small settings panel for colours, glass opacity, blur, tone, scale and observer latitude. No client packages are required at runtime. Install with plugin_manager install_bundle target=<absolute path>. Code is MIT; the moon texture (FullMoon2010 by Gregory H. Revera) is CC BY-SA 3.0.
Related plugins
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
dsh-TUI
ccch1mneyyy/dsh-tui
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui