FengHuoLinShan/dsh-plugin-llm-balance 预览 preview

FengHuoLinShan/dsh-plugin-llm-balance

Plugin插件 Native原生 ⭐ 3 MIT Usage & Cost用量与计费

DSH插件:可拖动的API余额/配额悬浮卡片(DeepSeek / Moonshot / Kimi For Coding自动发现、分档变色、实时刷新)| 适用于DeepSeek Harness的可拖动API余额/配额卡片

Project Overview项目介绍

This is a native DSH plugin that adds a persistent floating balance and quota card to the DSH web GUI. It can be installed with a single dsh plugin add command, supporting multiple installation methods including from npm, GitHub, local source, or tarball. After installation, you just need to restart the DSH service, and the card will appear in the top-right corner of your web interface. It requires DSH version 0.1.1-rc.2 or newer, and works with both loopback RPC for older versions and the newer BrowserAuth RPC for newer DSH releases. It automatically discovers configured providers from your existing DSH settings, so you do not need to manually add each provider.

The plugin automatically tracks the most recently used providers after activation, only keeping up to 3 different providers in the floating card. Existing entries keep their position, and only older unused entries get replaced when you use a new provider. The card is draggable and remembers its last position, supports manual refresh on click, and auto-refreshes every 60 seconds by default. It pauses refreshing when the page is hidden, and updates immediately when the page becomes visible again. It is ideal for DSH users that regularly use multiple LLM providers and want to quickly check their remaining balance and quota.

The plugin follows the MIT open source license, and has strong security guarantees for your API credentials. API keys are never sent to the browser, and all balance queries are proxied through the DSH server, so your credentials never get exposed. OpenAI Codex quota display is an optional feature that requires you to install the separate dsh-codex-connect plugin and complete ChatGPT OAuth login, and other providers work without any extra dependencies. The color coding for balance and quota makes it easy to see at a glance how much you have left, with green for healthy levels down to gray for exhausted quota.

这是DeepSeek Harness(DSH)的原生余额配额悬浮卡片插件,安装后会在DSH的Web GUI常驻显示最近使用的最多3个LLM提供商的使用情况,让余额、套餐余量和重置时间一目了然。它支持自动发现配置,可合并内置提供商、llm-pi-ai配置和插件自身配置,无需手动逐个添加提供商,目前支持8个主流LLM服务商。

插件会自动记录启用后成功完成的模型调用,仅保留最近3个不同提供商,已有项目保持位置稳定,新调用仅替换淘汰项。卡片支持拖动且会记忆位置,支持点击手动刷新,默认每60秒自动刷新一次,页面隐藏时暂停刷新,恢复可见后立即更新,适合高频使用多LLM提供商的DSH用户快速查看配额状态。

本插件遵循MIT开源许可协议,要求DSH版本不低于0.1.1-rc.2,可通过一条dsh plugin命令完成安装,安装后重启DSH服务即可生效。API密钥不会发送到浏览器端,所有余额查询都由服务端代理,不暴露凭证,OpenAI Codex配额显示为可选功能,需额外安装dsh-codex-connect插件。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-plugin-llm-balance

把 FengHuoLinShan/dsh-plugin-llm-balance 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-plugin-llm-balance

🏷️ DSH 官方插件生态收录项目(git tag: dsh-official-plugin;GitHub topics: dsh-plugin · deepseek-harness)。

English | 中文

DSH(DeepSeek Harness)的余额与配额悬浮卡片。它会在 Web GUI 中常驻显示最近使用的最多 3 个 provider,让余额、套餐余量和重置时间一眼可见。

余额与配额悬浮卡片

功能

  • 自动跟随最近使用的 provider:只记录插件启用后成功完成的模型调用,显示最近 3 个不同 provider;已有项目保持槽位稳定,新项目只替换被淘汰项。
  • 同时支持余额与配额:金额余额按数值显示;套餐配额同时展示 5 小时、周等可用窗口及重置时间,状态颜色按最紧张的窗口计算。
  • DeepSeek 峰谷电价徽标:DeepSeek 余额行尾部显示「☾ 低谷 / ☀ 高峰」小药丸——2026-08-17 起高峰为北京时间工作日 09:00–12:00、14:00–18:00,含周末在内的其余时段均为低谷半价;纯时钟计算不发请求,tooltip 显示时段表与距切换的倒计时,徽标随现有余额轮询及标签页恢复刷新;未配置 Key 的行不挂徽标。
  • 自动发现配置:合并内置 provider、llm-pi-ai.providers.* 和本插件配置,无需逐个添加。
  • 轻量交互:卡片可拖动并记忆位置;点击即可刷新;默认每 60 秒自动刷新,页面隐藏时暂停、恢复可见时立即更新。
  • 凭据不出服务端:API Key 和 OAuth token 不会发送到浏览器;DSH 0.1.1 使用 loopback-only RPC,0.1.2 使用其统一 BrowserAuth。

支持范围

Provider 展示内容 凭据来源
DeepSeek / DeepSeek Official CNY 余额 DSH credentials
Moonshot / Moonshot CN CNY 余额 DSH credentials
Kimi For Coding 5h、周配额与套餐等级 DSH credentials
OpenAI Codex 5h、周、可选月配额与 Credits Codex Connect 的 ChatGPT OAuth
OpenCode Go 5h、周配额 DSH credentials
OpenRouter API Key 日/周/月消费限额 DSH credentials
MiniMax / MiniMax CN Token Plan 5h、周配额 DSH credentials
Z.AI / BigModel Coding Plan 5h、周配额 DSH credentials

余额颜色:绿 >=100,黄 20–99,红 1–19,灰 <1。配额颜色:绿 >=50%,黄 20–49%,红 5–19%,灰 <5%;加载或查询失败同样显示灰色。

原理

  • 服务端(lib/index.js):记录最近使用的 provider,通过 /api/llm-balance 精确 Fetch 路由代理余额查询,从显式 apiKeyEnv 或 llm-pi-ai/<provider> API-key record 取凭据,并对同源请求去重;OAuth grant 只判断已配置,不解析内容。

  • 浏览器端(lib/client.js):聚合最近 3 个 provider,只请求当前需要展示的数据,并负责刷新、着色、拖动和位置记忆。

  • 支持的 provider 接口:

    provider id 接口 口径
    deepseek / deepseek-official GET https://api.deepseek.com/user/balance 余额(CNY;官方 total_balance 为字符串,数字同样兼容)
    moonshotai / moonshotai-cn GET https://api.moonshot.ai/v1/users/me/balance / https://api.moonshot.cn/... 国际/CN 余额(CNY)
    kimi-coding GET https://api.kimi.com/coding/v1/usages 套餐配额(顶层 usage=周限额 + limits 窗口明细(5h 限流等,window 对象归一化为 5h/周),含套餐等级)
    openai-codex dsh-codex-connect(GET https://chatgpt.com/backend-api/wham/usage) Codex Connect 配额(rateLimits 主 bucket(id codex,回退首个)窗口 = 剩余百分比(limit=100,18000s → 5h、604800s → 周,其余稳定时长标签);可选 individualLimit → 月配额、credits → USD 余额或 Credits 段(credits.unlimited=true 时仅因百分比 UI 显示为有限 100/100——绿色 100% 而非灰色 ∞/∞,账户本身仍无限))
    opencode-go GET https://opencode.ai/zen/go/v1/usage OpenCode Go 套餐配额(usage.rolling → 5h、usage.weekly → 周:percent 为已用百分比 → amount=100-percent、limit=100,resetsAt → 重置时间;monthly 忽略;单个窗口无效只跳过该窗口,至少一个窗口有效才成功。⚠️ 端点目前无官方公开文档,可能变化)
    openrouter GET https://openrouter.ai/api/v1/key 当前 Key 的日/周/月消费限额;Key 未设限时如实报告无剩余额度口径
    minimax / minimax-cn GET https://www.minimax.io/v1/token_plan/remains / https://www.minimaxi.com/... Token Plan 文本模型 5h、周剩余比例
    zai / zai-coding-cn GET https://api.z.ai/api/monitor/usage/quota/limit / https://open.bigmodel.cn/... Coding Plan 5h、周剩余比例;忽略 MCP/tool-only 月额度

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-usage-meter-harness 下一个 Next dsh-native-browser →