pythonshiyi/dsh-plugin-balance ↗★ 1
dsh-plugin-balance
余额显示:DeepSeek Harness 网页端会话头部实时显示账户余额(60 秒自动刷新)| Live account balance for DeepSeek Harness web UI (auto-refresh every 60s)
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗dsh-plugin-balance
English | 中文
DeepSeek Harness 网页端余额显示插件 —— 在会话头部右侧实时显示账户余额,每 60 秒自动刷新,点击立即刷新。
功能特性
-
会话头部右侧显示余额徽标:
[余额 ¥110.00] -
每 60 秒自动刷新,点击立即刷新
-
悬停明细:充值余额、赠送余额、账户可用状态
-
错误提示:查询失败显示红色
余额--,悬停查看具体原因(凭证缺失、curl 失败、响应解析失败等)
工作原理
| 环节 | 说明 |
|---|---|
| 接口 | Host 半段在 Harness 网页服务器上提供 GET /dsh-balance(同源,无 CORS 问题) |
| 凭证 | 优先 credentials 服务,其次 DEEPSEEK_API_KEY 环境变量 |
| 供应商配置 | 从 llm-deepseek 设置命名空间读取 apiKeyEnv / baseURL(默认 DEEPSEEK_API_KEY、https://api.deepseek.com) |
| 请求 | subprocess + curl → GET {baseURL}/user/balance,携带 Authorization: Bearer (argv 直传,15 秒超时) |
| 缓存 | Host 半段 30 秒 TTL |
| 槽位 | conversation.session.header.utilities(id: balance,order: 5) |
兼容性:面向提供 GET /user/balance 接口的 DeepSeek 兼容供应商(官方 DeepSeek API 形态)。自定义网关若未暴露该端点,会在悬停提示中显示失败原因。
安全说明:Authorization 头经短暂存活的 curl 进程参数传递(≤15 秒、本机进程),适合单用户机器;更严格的环境可将请求头写入临时配置文件。
环境要求
- DeepSeek Harness web 版(
dsh --profile web) - 系统 PATH 中存在
curl(Windows 10+ 与多数 Unix 系统自带) - 已配置 API Key:模型 页面(credentials 服务)或 环境变量