pythonshiyi/dsh-plugin-balance1

dsh-plugin-balance

余额显示:DeepSeek Harness 网页端会话头部实时显示账户余额(60 秒自动刷新)| Live account balance for DeepSeek Harness web UI (auto-refresh every 60s)

AI Analysis

在会话头部实时显示 DeepSeek 账户余额,支持 60 秒自动刷新及悬停查看明细。适合需要随时监控账户额度剩余情况的用户。

Package
dsh-plugin-balance
Version
0.1.0
License
MIT
Last updated
Aug 14, 2026

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

dsh-plugin-balance

English | 中文

DeepSeek Harness 网页端余额显示插件 —— 在会话头部右侧实时显示账户余额,每 60 秒自动刷新,点击立即刷新。

License GitHub release dsh-plugin

功能特性

  • 会话头部右侧显示余额徽标:

    [余额 ¥110.00]
    
  • 每 60 秒自动刷新点击立即刷新

  • 悬停明细:充值余额、赠送余额、账户可用状态

  • 错误提示:查询失败显示红色 余额--,悬停查看具体原因(凭证缺失、curl 失败、响应解析失败等)

工作原理

环节说明
接口Host 半段在 Harness 网页服务器上提供 GET /dsh-balance(同源,无 CORS 问题)
凭证优先 credentials 服务,其次 DEEPSEEK_API_KEY 环境变量
供应商配置llm-deepseek 设置命名空间读取 apiKeyEnv / baseURL(默认 DEEPSEEK_API_KEYhttps://api.deepseek.com
请求subprocess + curlGET {baseURL}/user/balance,携带 Authorization: Bearer (argv 直传,15 秒超时)
缓存Host 半段 30 秒 TTL
槽位conversation.session.header.utilitiesid: balanceorder: 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