jelly-000/dsh-balance-monitor 预览 preview

jelly-000/dsh-balance-monitor

DeepSeek 账户余额、剩余比例条与今日花费,显示在 dsh 侧边栏底部。

Project Overview项目介绍

This is a DSH-native plugin that adds a UI component to DSH’s sidebar footer to display balance, quota, and usage information for multiple AI LLM providers. It automatically pulls already configured providers from DSH’s settings, eliminating the need for duplicate key entry. It can be installed directly with a single DSH CLI command: dsh plugin --profile web add "github:jelly-000/dsh-balance-monitor#main", after which you just need to restart the DSH web UI to activate it. The UI matches DSH’s native design system and automatically switches between Chinese and English to match DSH’s language setting. No third-party build tools are required for installation or modification.

The plugin ships with 14 preconfigured major LLM vendors including DeepSeek, Zhipu, Moonshot Kimi, OpenAI, Anthropic, OpenRouter, and xAI. It supports switching between different billing modes (such as Coding Plan subscriptions vs pay-as-you-go API) for the same vendor via an in-line UI toggle. If a vendor does not expose a public billing or balance API, the plugin falls back to calculating actual usage from DSH’s local session logs. Users can also add custom OpenAI-compatible gateways via an agent tool call or manual configuration. It prioritizes manual overrides followed by DSH-inferred mode based on provider base URL.

All API keys remain on the DSH server side, and only aggregated numeric usage snapshots are sent to the browser UI, matching DSH’s existing security model. The plugin includes a full Token activity dashboard with a 52-week contribution-style heatmap, daily usage trend lines, and per-model usage breakdowns from local session logs. It caches parsed session data to speed up repeated loads, with a cold scan taking about 2 seconds and cached loads taking around 300 milliseconds. The plugin is open source under the MIT license, with no external runtime dependencies or required build tools for modification or development.

dsh-balance-monitor 是专为 DeepSeek Harness (DSH) 开发的原生插件,可在侧边栏底部集中展示多个 AI 平台的账户余额、配额与用量情况,同时提供基于本地会话日志的 Token 热力图活动看板。插件会自动识别 DSH 中已配置接入的模型提供商,支持同一厂商不同计费模式切换,厂商未开放余额接口时会自动退化为本地实测用量统计。

它内置支持 DeepSeek、智谱、月之暗面、OpenAI、Anthropic 等 14 家厂商,允许用户通过 agent 调用或手动配置添加自定义的 OpenAI 兼容网关。所有 API 密钥仅存储在 DSH 服务端,浏览器仅获取用量数据的数字快照,界面会自动跟随 DSH 语言设置切换中英双语。

它提供基于本地会话日志的 52 周 Token 热力图、每日趋势图和模型用量统计,带缓存扫描功能可加速后续加载。插件无外部构建依赖,可直接通过 DSH 插件 CLI 命令安装,以 MIT 开源许可证分发,完全符合 DSH 的设计规范和安全机制。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 9 stars - very few users, little community feedback星标只有 9,几乎没人在用,遇到问题缺少社区反馈
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 github:jelly-000/dsh-balance-monitor

把 jelly-000/dsh-balance-monitor 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

English | 简体中文

dsh-balance-monitor

dsh-balance-monitor 是一个 DeepSeek Harness (dsh) 插件,在侧边栏底部集中展示多个 AI 平台的余额、配额与用量,并提供基于本地会话日志的 Token 热力图看板。

插件按厂商逐行堆叠,每行展示剩余额度、剩余比例条、已用量与当日支出。同一厂商同时提供 Coding Plan(订阅套餐)与 API 按量两种计费方式时,可通过行内的模式圆点在两种口径之间切换;厂商未开放余额或计费接口时,自动退化为 DSH 本地实测用量。界面样式基于官方设计令牌,力求克制内敛。

背景:DeepSeek 调价后,用户可能需要切换至智谱等平台,而原插件仅支持 DeepSeek 单一平台。本插件以平台适配器注册表为骨架,动态对接已配置密钥的厂商,并自动纳入 DSH 已接入的 provider。

功能特性

功能 说明
多厂商堆叠 单张卡片自上而下逐厂商一行,展示名称、余额、比例条与已用量
Coding Plan / API 切换 每行的模式圆点(绿 = Coding Plan,灰 = API 按量)展开浮层菜单,切换即写入配置并即时返回新快照,无需编辑文件
自动跟随 DSH 读取 settings.yaml 中的 llm-pi-ai.providers,自动补入 DSH 已接入的 provider,并通过 baseUrl 反查厂商、推断计费模式
本地实测用量 厂商未开放余额接口(智谱 API、b.ai、百炼、方舟、小米等)时,改以 DSH 会话日志中的实测 token / 请求数展示
Token 活动看板 统计条(累计、峰值、最长聊天、当前 / 最长连续)+ 52 周 token 热力图(每日 / 每周 / 累计三档)+ 近 7 日 / 近 30 日范围切换下的每日趋势图与模型用量卡(对标 ZCode 使用统计),底部保留厂商明细表
适配器类型 balance(真实余额)、quota(滚动窗口配额,多窗口分行展示)、cost(近 30 天费用);另有 local(本地实测)
配额取紧约束 多窗口时标题展示最紧张的窗口(如 5 小时已重置而本周已满,显示 0% 并倒计时至本周重置)
当日支出 余额型平台按日记录基线(持久化到状态文件),支出 = 基线 − 当前值;充值不会导致负数
通用自定义 通过 agent 调用 balance_monitor 的 addCustom 接入任意 OpenAI 兼容网关,或直接写入 $DSH_HOME/.credentials.yaml
收起态圆点 侧边栏收起至 36px 后,每厂商显示一个圆点(绿 / 琥珀 / 红按剩余量着色),悬停 tooltip 列出各厂商、数值及当前模式
位置 注册于官方 sidebar.footer.action 槽位,位于设置上方
健壮性 60 秒轮询,切回标签页立即刷新;上游失败时保留上次数据并标记为 stale,不闪错误
双语 跟随 dsh 界面语言(navigator.language)自动切换中 / 英
安全 API Key 仅存于服务端,浏览器只获取数字快照

支持的平台

内置 14 家厂商,各家声明所支持的计费模式;同一密钥的两种模式共用,切换仅改变展示口径:

id 显示名 环境变量 key 模式
deepseek DeepSeek DEEPSEEK_API_KEY API 按量(余额 ¥)
zhipu 智谱 GLM ZHIPU_API_KEY Coding Plan 配额(积分窗口)· API 按量(本地实测)
zai Z.ai(GLM 国际站) ZAI_API_KEY Coding Plan 配额 · API 按量(本地实测)
moonshot Kimi / 月之暗面 MOONSHOT_API_KEY Kimi For Coding 配额(5h + 周)· API 余额 ¥
minimax MiniMax MINIMAX_API_KEY Coding Plan 配额 · API 按量(本地实测)
stepfun 阶跃星辰 STEPFUN_API_KEY API 余额 ¥
dashscope 阿里百炼 Qwen DASHSCOPE_API_KEY API 按量(本地实测)
volcengine 火山方舟 Doubao ARK_API_KEY API 按量(本地实测)
xiaomi 小米 MiMo XIAOMI_API_KEY API 按量(本地实测)
siliconflow 硅基流动 SILICONFLOW_API_KEY API 余额 ¥
openrouter OpenRouter OPENROUTER_API_KEY API credits $
xai xAI (Grok) XAI_API_KEY API credits $
openai OpenAI OPENAI_API_KEY API 近 30 天费用 $
anthropic Anthropic ANTHROPIC_API_KEY API 近 30 天费用 $(需 Admin key)

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-mermaid 下一个 Next dsh-plugin-manager →