Back to home@outprintHelloLi

dsh-piggy-bank

dsh插件:DeepSeek 官方余额状态栏(DSH web 插件)

Stars
0
Language
JavaScript
Created
Aug 25, 2026
Updated
Aug 25, 2026
GitHub repo

Introduction

dsh-piggy-bank

DeepSeek Harness (DSH) Web 插件:一个可拖动的悬浮存钱罐,实时显示 DeepSeek 账户余额,并在余额发生变化时弹出扣减 / 增加动画。

功能

  • 悬浮存钱罐:可拖动位置,支持 卡通猪 / 蓝色鲸鱼 / 黑金龙纹 / 陶瓷 4 种内置样式,也可导入外部 .svg 作为自定义样式。
  • 余额展示:余额显示在存钱罐上方,带深色文字背景。
  • 自动刷新:页面打开、任务开始 / 结束时立即刷新;对话运行期间按设定间隔(默认 30 秒)自动查询,仅在页面可见时轮询。
  • 余额动画:查询时存钱罐摇晃;余额下降时抖动并显示 -¥xx.xx(淡入淡出 5 秒);余额增加时以金色显示 +¥xx.xx
  • 设置界面:在 DSH 的设置侧边栏中,可调整「查询时间间隔(秒)」(5–600)、切换样式、添加自定义 SVG。

数据来源为 DeepSeek 官方接口 GET https://api.deepseek.com/user/balance。DeepSeek 开放平台未提供 token 用量 / 费用 / 账单接口,因此本插件只展示余额,不做本地用量记账或费用估算。

安装

本插件为纯 Node.js 实现,跨平台通用,一键安装:

node scripts/install.mjs

也可以使用各平台快捷脚本:

  • Windows(CMD)scripts\install.cmd
  • Windows(PowerShell)scripts\install.ps1
  • macOS / Linux./scripts/install.sh

安装脚本会自动:找到 dsh profile(默认 web)→ 复制插件 → 在 profile 的 package.json 中登记依赖和 bundle → 执行 pnpm install

完成后再重启 dsh web 并硬刷新页面(Windows: Ctrl+Shift+R;macOS: Cmd+Shift+R)。

可选参数

node scripts/install.mjs --profile headless   # 安装到其它 profile
node scripts/install.mjs --no-install        # 只复制/登记,不运行 pnpm install

发布到 npm / GitHub 后,也可用 DSH 自带命令安装:

dsh plugin --profile web add dsh-piggy-bank

前置条件

  • ~/.dsh/.credentials.yaml 中已配置 DEEPSEEK_API_KEY
  • Node.js ≥ 20,pnpm 可用。
  • DSH 已初始化 web profile(~/.dsh/profiles/web)。

结构

文件作用
lib/index.jshost 端:注册 /dsh-piggy-bank/status 路由、监听 turn/end、注册设置命名空间。
lib/client.jsclient 端:悬浮存钱罐 + 余额动画 + 设置卡片 + 定时查询。
scripts/install.mjs跨平台一键安装脚本。
cordis.patch.yml把插件行插入 DSH host 组合。

License

MIT