dsh-balance
其他 活跃维护

dsh-balance

mxl2498/dsh-balance

轻量级Web插件,安装后页面悬浮展示DeepSeek账户实时余额,点击区域即可跳转官方充值页,无冗余功能,操作简单直观,方便用户随时查看账户额度、快速完成充值。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
JavaScript
主要语言
None
开源协议
129 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:mxl2498/dsh-balance
git clone https://github.com/mxl2498/dsh-balance.git
git clone git@github.com:mxl2498/dsh-balance.git
README.md main

余额悬浮球(@dsh-external/余额悬浮球)

DSH Web 插件:右下角悬浮显示 DeepSeek 账户余额,点击直达官网充值页

  • 悬浮胶囊实时显示总余额(如 余额 ¥110.00),可拖动到任意位置(记忆在 localStorage);
  • 点击展开明细卡片:总余额 / 充值余额 / 赠送余额、最近更新时间、刷新去充值 ↗ 按钮;
  • 余额低于阈值(默认 ¥5)时胶囊变红并带 ⚠ 告警;
  • 服务端代理余额接口,DEEPSEEK_API_KEY 密钥只留在服务端,不会进入浏览器
  • 60 秒自动刷新(页面隐藏时暂停,回到前台立即补一次)。

截图

右下角悬浮球(点击展开明细与充值入口):

余额悬浮球

设置 → 「余额悬浮球」页(开关 / 刷新间隔 / 低余额阈值 / 悬浮位置):

余额悬浮球设置页

架构

浏览器端(悬浮球 UI)  --fetch-->  服务端代理 /dsh-balance/balance  --fetch-->  DeepSeek API
   lib/client.js                    lib/index.js (ctx.webServer + ctx.credentials)   api.deepseek.com/user/balance

服务端通过 ctx.credentials 解析 DEEPSEEK_API_KEY(DSH 凭证系统,当前已配置),
Authorization: Bearer 请求 https://api.deepseek.com/user/balance,结果缓存 60 秒。

配置

cordis.patch.yml(本包自带,可被 profile 的 patch 覆盖)中调整:

配置项 默认值 说明
cacheSeconds 60 服务端余额缓存秒数
topUpUrl https://platform.deepseek.com/top_up 充值页地址
enabled true 是否启用悬浮球
refreshSeconds 60 客户端自动刷新间隔秒数
lowBalanceThreshold 5 余额低于该值(CNY)时红色告警
position bottom-right 默认悬浮位置(bottom-right / top-right / bottom-left / top-left

安装(从 GitHub)

# 加入 web profile 的依赖(声明 dsh.bundle,dsh plugin 会自动追加进 bundles)
dsh plugin --profile web add github:mxl2498/dsh-balance
# 然后重启 DSH Desktop / dsh web

本地开发时也可用 dsh plugin --profile web add file:../dsh-balance 安装本地目录。

注意

  • 余额接口以 balance_infos 第一项为准(一般即 CNY 账户);多币种时卡片会列出各项。
  • 若显示"余额 --",把鼠标悬停在胶囊上看具体错误(未配置密钥 / HTTP 状态 / 网络失败)。
  • 充值页需要登录 DeepSeek 开放平台账号。