pythonshiyi/dsh-plugin-balance ↗★ 1
dsh-plugin-balance
余额显示:DeepSeek Harness 网页端会话头部实时显示账户余额(60 秒自动刷新)| Live account balance for DeepSeek Harness web UI (auto-refresh every 60s)
AI 분석
在会话头部实时显示 DeepSeek 账户余额,支持 60 秒自动刷新及悬停查看明细。适合需要随时监控账户额度剩余情况的用户。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 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 服务)或
DEEPSEEK_API_KEY环境变量
安装
方式一:npm(发布后可用)
cd ~/.dsh/profiles
npm install dsh-plugin-balance
方式二:本地目录或 Git 仓库
cd ~/.dsh/profiles
npm install /path/to/dsh-plugin-balance
# 或:npm install https://github.com/pythonshiyi/dsh-plugin-balance
然后注册到你的 profile 补丁,例如 ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
- id: plugin-balance
name: 'dsh-plugin-balance'
重启应用(dsh --profile web)并刷新页面即可生效。
卸载
从 cordis.patch.yml 删除该行,或直接禁用:
- id: plugin-balance
name: 'dsh-plugin-balance'
disabled: true
重启并刷新。
常见问题
显示 余额--? 悬停徽标查看具体原因:未找到凭证(请在 模型 页面配置 API Key 或设置 DEEPSEEK_API_KEY 环境变量)、curl 退出码(网络/证书问题)、响应解析失败(网关未暴露余额端点)。
余额多久更新一次? 浏览器每 60 秒拉取一次;Host 另有 30 秒缓存,避免频繁请求供应商接口。
支持与品牌
公众号:十一AIGC —— AI 工具评测与教程,第一时间获取本插件更新与更多 DeepSeek Harness 玩法。
如果本项目对你有帮助,欢迎 ⭐ Star,并关注公众号「十一AIGC」。
License
MIT