alanzhao0128/dsh-balance-monitor 预览 preview

alanzhao0128/dsh-balance-monitor

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

Project Overview项目介绍

This repository is a purpose-built plugin for DeepSeek Harness (DSH), designed to add a real-time balance and usage monitoring card directly to the footer of DSH’s sidebar, right above the settings button. It supports three major DeepSeek channels, including the official DeepSeek channel, Volcano Ark channel, and Command Code channel, each displaying relevant balance, spending, or quota progress information. You can install it directly via the DSH CLI command either from the GitHub repository or the npm registry, and no local build steps are required. It requires DSH version 0.1.2-rc1 or higher, with specific version matching for newer DSH releases to ensure compatibility.

This plugin is intended for DSH users who regularly use DeepSeek API and want to track their spending and quota usage without leaving the DSH interface. After installation, the plugin automatically detects the model channel of the current active session, displays the correct content for that channel, and pulls fresh usage data every 60 seconds by default. When you switch between channels or sessions, the plugin automatically updates the displayed content to match the current active channel. You can adjust display thresholds, refresh intervals, and network settings directly through the DSH settings panel, and most configuration changes take effect immediately without a DSH restart.

This plugin is released under the permissive MIT open-source license, and it is free to use and modify. Each supported channel requires specific credentials to access full functionality: the official DeepSeek channel needs an API key pulled from your existing DSH configuration, plus an optional platform token to pull official usage statistics. Volcano Ark requires an access key ID and secret access key, and Command Code requires an existing API key configured in DSH. All credentials are kept securely on the DSH server side and never exposed to the browser frontend, and there is no third-party telemetry or tracking.

dsh-balance-monitor 是专为 DeepSeek Harness (DSH) 开发的原生插件,在 DSH 侧边栏底部(设置按钮上方)添加 DeepSeek API 余额与用量监控卡片。它支持三大主流 DeepSeek 渠道:官方渠道、火山方舟渠道、Command Code 渠道,分别展示对应渠道的余额、花费和套餐额度进度信息。可通过 DSH CLI 直接从 GitHub 或 npm 安装,无需本地构建步骤,版本要求适配 DSH 0.1.2 及以上版本。

这款插件面向需要在 DSH 内实时追踪 DeepSeek API 消费和套餐额度的用户。安装完成后,插件会自动感知当前活动会话的模型渠道,按渠道类型展示对应余额、花费或套餐进度,每 60 秒自动拉取最新数据,切换渠道时会自动更新展示内容。用户可在 DSH 设置面板直接调整显示阈值、刷新间隔、网络参数,配置保存后即时生效,无需重启 DSH。

该插件采用 MIT 许可证开放源码,无需付费使用。不同渠道需要配置对应凭证才能获取完整数据:DeepSeek 官方渠道需要 API 密钥(从 DSH 读取)和可选的平台令牌(用于获取官方消费统计),火山方舟渠道需要 AK/SK 凭证,Command Code 渠道需要 API 密钥。所有凭证仅保存在服务端,不会暴露到前端浏览器,网络请求仅发送到官方接口,无第三方遥测。

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

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

READMEREADME

English | 简体中文

dsh-balance-monitor

DeepSeek 余额与花费窗口,直接显示在 dsh 侧边栏底部。

一个极简的 DeepSeek Harness (dsh) 插件:在侧边栏底部(设置上方)显示当前会话渠道的余额/用量。DeepSeek 官方渠道显示余额与今日/7日/30日花费窗口(支持官方用量数据);火山方舟渠道显示 Agent Plan 套餐额度(5小时/周/月进度条);Command Code 渠道显示 5h/周/月 用量窗口(GOAT/Pro/Max 等套餐);Google AI Pro 渠道(Antigravity 经 CLIProxyAPI 反代)显示 5 小时/周剩余额度(Gemini 与 Claude/GPT 两个模型组)。样式完全使用官方设计令牌,克制内敛。

侧边栏底部余额卡片

功能

功能 实现
实时余额 服务端调用 GET https://api.deepseek.com/user/balance,使用 $DSH_HOME/.credentials.yaml 中的 DEEPSEEK_API_KEY(环境变量优先)
今日/7日/30日花费(官方) 配置 DEEPSEEK_PLATFORM_TOKEN 后,服务端调用官方用量接口 platform.deepseek.com/api/v0/usage/cost(与平台用量页同一份数据),按日期窗口累加。7日 = 今天往前 6 天,30日 = 今天往前 29 天(均含今天)。不受「在其他环境使用 API」影响
余额差值回退 无平台 token 或官方接口失败时,今日花费回退为余额差值账本(只累计余额下降,充值不冲账);7日/30日显示 —
渠道感知 卡片跟随当前会话的模型渠道(provider)自动显隐:DeepSeek 官方显示余额/花费;火山方舟显示 Agent Plan 进度条;Command Code 显示用量窗口;Google AI Pro(cliproxy)显示 5h/周 剩余额度;其他渠道显示「暂不支持」占位;无会话不显示
火山方舟 Agent Plan 配置 AK/SK 后,调用 GetAFPUsage 控制面 API(SigV4 签名),显示 5小时/周/月 三档套餐额度进度条,颜色随用量变化(绿→黄→红)
Command Code 用量 配置 COMMANDCODE_API_KEY 后,调用 api.commandcode.ai/alpha/billing/credits 等接口,显示 5h/周/月 三窗口已用百分比与重置倒计时
Google AI Pro 额度 配置 CPA 管理地址 + Basic 认证 + 管理密钥后,读取 CPA 上 antigravity-priority 插件探测的配额快照,按 Gemini / Claude+GPT 两个模型组显示 5h 与每周剩余百分比、重置倒计时(CPA 刚重启导致快照为空时自动触发一次探测)。服务端需自行搭建,见搭建指南
位置 注册在官方 sidebar.footer.action 槽位 —— 设置上方,零 hack
折叠态 收起后变为 36px 圆形,显示紧凑余额 + tooltip
健壮性 60s 轮询 + 切回标签页时刷新;上游失败时保留上次数据(变淡标记 stale),不闪错误

安装

浏览器端 bundle 是手写的 classic script,无构建步骤,git 安装无需 prepare 脚本:

dsh plugin --profile web add "github:alanzhao0128/dsh-balance-monitor#main"

或从 npm:

dsh plugin --profile web add @alanzhao/dsh-balance-monitor

然后重启 Web UI(dsh --profile web)。卡片出现在展开的侧边栏底部、设置按钮上方。

版本要求:0.7.8+ 兼容 dsh ≥ 0.1.5-rc.1(包含 0.1.7+ 架构重构,支持 SettingsForms 与双轨设置);dsh 0.1.2-rc.1 宿主请固定安装 0.7.1。

配置

设置面板(推荐)

打开 dsh 设置(齿轮)→ 余额监控 / Balance Monitor,可编辑卡片行为参数,保存后写入 ~/.dsh/settings.yaml 的 dsh-balance-monitor: 段,即时生效(个别参数重启后生效):

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-awesome-agent-preset 下一个 Next dsh-bilingual-reader →