dsh-balance
文件与数据 活跃维护

dsh-balance

ywleeo/dsh-balance

可在dsh Web对话底部、token统计栏前方实时展示DeepSeek账户余额,无需跳转个人中心查询,安装即用无冗余配置,体积小巧,方便开发者随时掌握账户额度使用情况。

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

dsh-balance

在 dsh Web 对话底部显示 DeepSeek 账户余额的精简插件 —— 一行小字,排在会话数据(token 统计)前面。

截图

余额与 token 统计同一行显示(¥192.04 ⟳ 在最前,无多余文字):

dsh-balance 余额显示

特性

  • ✅ 挂在 conversation.composer.dock(order: -1),显示在 token 统计行(order 0)前面
  • ✅ 与 StatsLine 同视觉族:12px / label-tertiary / 居中
  • ✅ 刷新:挂载时 + 每 5 分钟轮询 + 点击 ⟳ 手动刷新
  • ✅ API key 不出 host(客户端只 fetch 同源 JSON 路由)
  • ✅ 不写会话日志、不注册投影 —— 无会话恢复污染风险
  • ✅ 零构建、纯 ESM,host + 极简客户端模块

安装

cd ~/.dsh/profiles/web
pnpm add file:/path/to/dsh-balance   # 或 pnpm add github:ywleeo/dsh-balance

在 ~/.dsh/profiles/web/cordis.patch.yml 追加:

- insert:
    - id: dsh-balance
      name: dsh-balance

重启 dsh web + 刷新页面。

原理

  • host(index.js):/plugins/dsh-balance/balance 路由 → 凭据服务解析 DEEPSEEK_API_KEY(与 llm-deepseek 同一 key 缝)→ GET https://api.deepseek.com/user/balance → JSON。
  • client(client.js):dock 组件 fetch 同源路由,挂载/每 5 分钟/点击刷新。

维护

pnpm run sync      # 同步到本机已安装的 profile 拷贝
pnpm run release   # 升版本 + 同步 + commit + tag + push

生效方式:index.js 改动 → 重启 dsh web;client.js 改动 → 刷新页面。

License

MIT