rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:nomxy/dsh-balance
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness 侧边栏余额胶囊:把 DeepSeek 官方账户余额 和 峰谷时段 做成一个 20px 高的小胶囊,贴在侧栏页脚「名字那一行」的右侧,不占一整块地方。
¥56.10 · 谷 1d9h

图中为按 lib/client.js 的样式渲染的外观预览(同一份 CSS,脱离 DSH 页面单独成像);实际位置在侧栏名字按钮右侧、连接指示灯左侧。
DEEPSEEK_API_KEY 请求官方 GET /user/balance(不出本机);没配 Key 时自动改用 DSH 的账号登录态(deepseekAccount 服务 → get_user_summary),账号余额照常显示,不需要额外配置。2d15h / 5h47m / 23m),每 15 秒刷新。—,悬停能看到原因,不会编数字。从 npm 装(当前版本 0.1.3):
dsh plugin --profile <你的 profile> add @nomxy/dsh-balance@0.1.3
装完刷新页面或重启 DSH 即生效。要求 DSH >= 0.2.1(需要 dsh.client + dsh.bundle 清单)。
常用配套命令:
# 看装了哪些版本
dsh plugin --profile <profile> list
# 升级到最新
dsh plugin --profile <profile> update @nomxy/dsh-balance
# 卸载
dsh plugin --profile <profile> remove @nomxy/dsh-balance
装完可以做一次自检(把端口换成你当前 GUI 的端口,可在 DSH 窗口标题或 dsh web 输出里看到):
curl -s http://127.0.0.1:<port>/api/dsh-balance
# {"ok":true,"balance":{"isAvailable":true,"total":53.08,"currency":"CNY"},
# "peak":false,"next":{"peak":true,"at":...,"ms":...},
# "tier":{"input":1,"cacheRead":0.02,"cacheWrite":0,"output":4,"model":"deepseek-flash","known":true}}
侧栏出现 ¥53.08 · 谷 19h 这样的胶囊即为成功。
胶囊里的「峰 / 谷」用的是 DeepSeek 官方峰谷计费口径,逐条如下(实现见 lib/pricing.js):
| 项目 | 规则 |
|---|---|
| 高峰时段 | 北京时间 09:00–12:00、14:00–18:00(半开区间,12:00 整属于空闲) |
| 适用日 | 周一至周五;周末全天按空闲计价(调休上班的周末也算空闲) |
| 法定节假日 | 全天按空闲计价(HOLIDAY_RANGES 内置 2027 年及以前的中国法定节假日表) |
| 时区 | 判定固定按北京时间(UTC+8,无夏令时),与部署机器时区无关 |
| 倒计时 | 距下一次峰谷切换的时长:午休结束 12:00→14:00 显示 2h;周五 18:00 之后显示到下周一 09:00(如 2d15h) |
| 价格 | 悬停提示的单价按当前所处的峰谷档取(元 / 百万 tokens),缓存写官方暂不计费(0) |
两种颜色:峰=#d97706(橙)、谷=#15803d(绿);模型不在内置价格表里(例如第三方网关上的同名模型)时,胶囊只显示余额,不显示峰谷。
右键点胶囊会弹出设置菜单,三组选项,点一下立即生效并记住(存在浏览器 localStorage 的 dsh-balance:prefs,字段为 size / position / form):
| 组 | 可选值 | 说明 |
|---|---|---|
| 大小 | 小 / 标准 / 大 | 高度 18 / 20 / 24px,字号 10.5 / 11.5 / 13px |
| 位置 | 名字右侧(默认)/ 名字左侧 / 行末 | 胶囊在名字行里的插入位置 |
| 形式 | 胶囊(默认)/ 纯文字 / 圆点 / 仅金额 | 纯文字去掉边框与底色;圆点把「峰 / 谷」换成同色圆点;仅金额只留 ¥余额,倒计时收进悬停提示 |
键盘等价入口:Tab 聚焦胶囊后按 Shift+F10 或菜单键 → 方向键选择 → Enter 确认;Esc 或点菜单外关闭。侧栏折叠成 36px 图标栏时胶囊照旧隐藏。
无需配置。余额按下面顺序取,能拿到哪一个就用哪一个:
DEEPSEEK_API_KEY(与 llm-deepseek 同一引用),请求官方 GET /user/balance;想换网关地址时可用环境变量 DEEPSEEK_BASE_URL(注意:指向第三方网关时 API Key 会发给该地址)。deepseekAccount 服务的 get_user_summary),只取正常钱包、不含赠送额度;未登录时胶囊回到 — 并在悬停里说明原因。/api/dsh-balance、/api/dsh-balance/holidays),且只接受 Host 为回环地址或本监听地址的请求(与 DSH 自身 /api 栅栏同一口径);跨站标记与异源 Origin 一律拒绝。lib/pricing.js),官方调整规则或发布次年放假日历时需要更新版本。div[class*="triggerRow"]。宿主半(lib/index.js、lib/pricing.js:余额读取、峰谷与节假日规则、单价表)取自
@dougen/dsh-deepseek-usage(MIT),仅把插件 id 与路由改名,并去掉了对 @deepseek-ai/dsh-credentials 的运行时依赖(credentialRef 是编译期 brand,运行时为恒等函数)。
客户端半(lib/client.js)为本项目重写:不注册槽位,直接挂载紧凑胶囊。
本项目的代码、发布到 npm、以及向 awesome-dsh-plugin 提交的收录条目,均由作者本机运行的 DSH(DeepSeek Harness) 代理端到端完成,作者负责需求与授权。
MIT,见 LICENSE(包含上游 MIT 声明)。
A 20px balance chip for the DeepSeek Harness sidebar footer, sitting right of the name row: official DeepSeek balance plus the current peak/off-peak window with a countdown to the next switch, hover for the active model's unit prices, click to refresh. No telemetry; the host half only serves two loopback-only routes.

Peak/off-peak (official DeepSeek billing rules): peak = Beijing time 09:00–12:00 and 14:00–18:00 on weekdays only; everything else — weekends (even make-up workdays), Chinese public holidays, and the 12:00–14:00 lunch gap — is off-peak/idle. The countdown shows the time until the next switch (e.g. 2d15h from Friday 18:00 to Monday 09:00).
Install:
dsh plugin --profile <your-profile> add @nomxy/dsh-balance@0.1.3
Requires DSH >= 0.2.1 (dsh.client + dsh.bundle present). Verify with curl -s http://127.0.0.1:<port>/api/dsh-balance.
Host half derived from @dougen/dsh-deepseek-usage (MIT). Code, the npm publish, and the awesome-dsh-plugin listing were all prepared end-to-end by DSH (DeepSeek Harness), the agent running on the author's own machine.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。