插件目录 / Network / dsh-deepseek-balance
dsh-deepseek-balance
已验证 · 实测可装 lin-cheng-lab
功能简介
DeepSeek API 余额监视器:DSH 右下角悬浮徽章 + 7天/30天用量费用图表
可用 — 实测通过,早期项目
DeepSeek API 余额监视器:DSH 右下角悬浮徽章 + 7天/30天用量费用图表 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-deepseek-balance
右下角悬浮的 DeepSeek API 余额监视器 —— 为 DeepSeek Harness (DSH) 实时显示账户余额与用量费用。
功能
- 🟢 右下角常驻悬浮徽章:状态色圆点 + 实时余额,任何页面/会话下都可见
- 📊 用量费用图表:7 天 / 30 天柱状图,悬停查看每日金额
- 🔄 每 60 秒自动刷新,也可手动刷新
- 🎨 自动适配深浅色主题(使用 DSH 主题变量)
- 🔑 自动读取已配置的
DEEPSEEK_API_KEY凭证,无需手动填写 - 🔒 Key 安全:通过环境变量传给 curl,命令行/日志不出现明文
余额数据来自官方接口 GET https://api.deepseek.com/user/balance;
用量数据来自本机 DSH 会话日志的真实 token 统计(按官方价格换算费用),
更早的历史因本地无账单记录以灰色示意柱展示。
安装
dsh plugin --profile web add "github:<你的用户名>/dsh-deepseek-balance#main"
然后重启 dsh --profile web,右下角即可看到余额徽章。
凭证配置
在 ~/.dsh/.credentials.yaml 中配置:
DEEPSEEK_API_KEY: sk-xxxxxxxxxxxxxxxxxxxxxxxx
开发
pnpm install
pnpm build # tsc 编译 Host + tsdown 打包 Client
产物结构:
lib/index.js— Host 半(RPC handler:余额/用量查询)lib/client.js— Client 半(悬浮徽章 UI,__ModuleLoader__bundle)
工作原理
┌──────────────┐ connection.rpc.call ┌──────────────────────────┐
│ Browser UI │ ──────────────────────▶ │ Host (Node) │
│ shell.overlay│ /deepseek-balance │ ├─ credentials.resolve │
│ 悬浮徽章+图表 │ ◀────────────────────── │ ├─ shell curl 余额 API │
└──────────────┘ RpcResult │ └─ sessionQuery 用量统计 │
└──────────────────────────┘
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-deepseek-balance」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
Web profile:
dsh plugin --profile web add dsh-deepseek-balance Headless(CLI)profile:
dsh plugin --profile headless add dsh-deepseek-balance 包信息
npm:dsh-deepseek-balance · 版本 — · 实测环境 dsh 0.1.0-rc.6
实测报告
端到端验证通过:dsh 0.1.0-rc.6 上 L1 安装 + L2 加载 + L3 运行问答。
使用场景
给 agent 网络能力——请求、API、代理或协议——让它能触达外部系统。
适合谁
任务涉及网络的人——调 API、抓资源或与远端服务通信。
二次开发建议
适配器和请求整形是缝——加协议、鉴权处理器、重试和端点抽象。