DeepSeek Harness Plugin

mingzaily/dsh-balance-pill

Stars ★ 0 Category Usage & Billing Added 2026-11-10

Composer-dock capsule with this session's DeepSeek spend, account balance, daily/weekly/monthly ledger and the peak/off-peak price window.

Install

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:mingzaily/dsh-balance-pill

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.

输入框状态行里的 👛 本会话 ¥0.083 胶囊,点击打开与原生统计一致的面板。

面板内容

段 内容
本会话花费 花费(大数值)、模型、口径说明
账户余额 总余额(大数值)、充值余额、赠金
账本 今日 / 近 7 天 / 本月花费
价格时段 空闲价 / 高峰价、距峰谷切换倒计时、当前时段建议

面板与胶囊样式逐项照抄宿主源码:ui-chat/.../StatsPills.module.css、 ui-chat/.../stat-dialog.module.css、ui-chat/.../stat-dialog.ts。

数据来源

  • 余额:宿主 deepseekAccount.getBalance()(桌面端登录态,不需要 API key)
  • 花费:llm/stream 的 usage chunk × 官方价目表,按发生时的峰谷时段计价
  • 账本:同样的实时记账按北京日期分桶,得出今日 / 近 7 天 / 本月

没有预算、没有对账段、没有配套配置/设置 UI。但底层能力保留:

  • 历史回填:启动后扫描会话存档,把插件装好之前的请求补进账本(按事件当时的峰谷价计价)。 面板不显示"回填 N 条",但「本会话花费 / 今日 / 本月」因此是完整的。
  • 余额观测:每次读余额都把下降/上升折进账本(observedSpend / observedRecharge / 观测起点),持久化在 usage.json 里,不展示;将来要恢复"对账"段只需加 UI。

计价

  • 价目(元 / 百万 tokens,flash):缓存命中输入 0.02/0.04,未命中 1/2,输出 4/8;pro 另一套
  • 高峰:北京时间周一至周五 09:00–12:00、14:00–18:00,排除法定节假日;其余(含周末、 调休上班的周末)空闲半价
  • 节假日表在 index.js 的 HOLIDAYS(已含 2026、2027),每年公告发布后追加

持久化

$DSH_HOME/dsh-balance-pill/usage.json(v5):sessions(按会话累计,30 天/500 条)+ daily(按北京日期分桶)+ balance(余额观测账本,UI 不展示)。2 秒防抖写,插件卸载时冲刷。

结构与生效方式

文件 作用 生效方式
client.js 胶囊、面板 刷新页面
index.js 余额、记账、峰谷、/data 路由 重启客户端
cordis.patch.yml 挂载声明 重装 bundle

已知限制

  • 回填依赖会话存档:已删除的会话、存档之外的请求无法恢复
  • 价目表与节假日表需随官方调整手动更新(一年一次)
  • 只有 flash / pro 有价目,其它模型不计入花费

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.