wycto/dsh-balance-panel

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

DSH插件-模型余额显示功能

Project Overview项目介绍

This is a purpose-built native plugin for DeepSeek Harness (DSH) that displays account balance summaries for all configured AI model providers directly in the DSH web sidebar. It follows DSH’s official plugin conventions, with a valid DSH manifest and Cordis patch entry to enable automatic loading after installation. You can install it via the DSH CLI with a single command for profile-based setups, or load it from source for local development and debugging. After installation, you only need to restart or refresh the DSH web interface to start using it.

This plugin is designed for DSH users who work with multiple AI model API providers. It automatically filters out unconfigured or dormant provider entries, only showing providers and models that you have actually set up in your DSH profile. Major mainstream providers like DeepSeek, StepFun, Kimi, OpenRouter, and XAI have built-in balance query support, so you don’t need to do any extra configuration to get their balance data. It updates balance information automatically every five minutes, and you can also manually refresh at any time from the full panel.

The plugin is released under the permissive MIT open-source license, so it is free to use and modify for any purpose. It only requires the Cordis framework that is already included with DSH, so no extra dependencies need to be installed for regular usage. API keys are never exposed to the frontend client; they are only resolved and used within the DSH host process, so your credentials stay secure. If you use an unsupported provider, you can easily add a custom balance endpoint in your profile configuration.

这是一款专为 DeepSeek Harness (DSH) 开发的原生插件,用于在 DSH Web 界面侧边栏展示你已配置的所有模型服务商的账号余额摘要。点击侧边栏的余额胶囊即可打开完整面板,查看每个服务商的模型列表、密钥配置状态和详细余额信息,余额摘要会每5分钟自动刷新一次。它支持通过 dsh CLI 一键安装,也支持源码加载和本地开发调试,遵循 DSH 插件约定打包,安装后重启或刷新 Web 界面即可生效。

当你配置了多个大模型服务商的 API 密钥使用 DSH 时,这款插件可以帮你统一管理各个账号的余额或剩余额度,不用分别打开各个服务商的后台查看。它只会展示你实际已经配置过的服务商和模型,不会显示未配置的默认条目或休眠条目,界面简洁清晰。对普通 DSH 用户来说,安装后即可直接使用,无需额外复杂配置,DeepSeek 等主流服务商的余额接口已经内置支持。

插件基于 MIT 协议开源免费使用,核心依赖 DSH 的 Cordis 框架,如果你已经正常运行 DSH,一般无需额外安装依赖。密钥只会在 DSH 主机进程内解析使用,不会泄露到前端,保证你的凭证安全。对于不支持内置余额接口的服务商,用户可以自定义余额查询接口,不支持的服务商也会给出明确提示,不影响插件整体使用。

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

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

READMEREADME

dsh-balance-panel · DSH 模型余额面板

仓库名 dsh-model-balance;npm 包名 @wycto/dsh-balance-panel(scoped 命名,绑定 npm 账号 wycto,杜绝包名冲突;旧无前缀名 dsh-balance-panel 已废弃)。 DeepSeek Harness 插件:在侧边栏底部显示当前 DSH 配置的所有模型 Provider 的账号余额, 点击打开余额面板查看每个 Provider 的模型列表、密钥状态与余额明细。

DSH License


功能特性

  • 只列已配置项:只展示你在 settings 里实际配置过的 Provider(user/base 层有 profile,或为默认模型选中的 Provider)与其实际配置的模型;休眠声明与 schema 默认的全量模型列表不会出现。
  • 真实余额:内置 DeepSeek 官方 /user/balance 接口;其他 Provider 可自定义余额接口(见下文)。
  • 密钥状态:每个 Provider 显示其 apiKeyEnv 凭证是否已配置(密钥本身永不出 Host 进程)。
  • 侧边栏入口:设置按钮旁的小胶囊显示当前余额摘要(如 余额 64.23 CNY),每 5 分钟自动刷新。
  • 余额面板:点击胶囊打开全屏面板,逐 Provider 展示模型 chips、余额明细(总额/赠送/充值)与状态徽标。
  • 优雅降级:无密钥 / 接口不支持 / 查询失败都给出明确文案,不影响其他 Provider(不支持的显示「不支持」)。

工作原理

┌────────────────────────── 浏览器(Client 半身 lib/client.js)──────────────────────────┐
│  tool.view.cordis        ← Run 卡片内嵌余额视图(最新一次运行卡片内)                     │
│  sidebar.footer.action   ← 余额胶囊(摘要 + 点击开面板)                                  │
│  shell.overlay           ← 余额面板(已配置的 Provider / 模型 / 余额)                    │
│          │  GET /dsh-balance-panel(同源 fetch,每 5 分钟 + 手动刷新)                          │
└──────────┼───────────────────────────────────────────────────────────────────────────────┘
           ▼
┌────────────────────────── Host 进程(Host 半身 lib/host.js)─────────────────────────────┐
│ 1. llm.listConfigurableProviders()  →  声明目录(含休眠条目,逐个过滤)                   │
│ 2. settings.describe({redactSecrets}) → 按 user/base 层定位已配置 profile(默认值不算)   │
│ 3. credentials.describe/resolve    →  密钥状态 / 密钥值(只在本进程内使用)               │
│ 4. 余额策略 → fetch 余额接口(DeepSeek /user/balance 或 profile.balance 自定义)          │
│ 5. webServer 注册 GET /dsh-balance-panel,返回归一化 JSON                                     │
└───────────────────────────────────────────────────────────────────────────────────────────┘

目录结构

dsh-balance-panel/
├── package.json           # npm 包元数据 + dsh 元数据(bundle.patch / client.inject)
├── cordis.patch.yml       # 插件加载行(- insert: { id: dsh-balance-panel, name: 包名 })
├── lib/                   # 发布产物(files 只发布 lib/ + 上述文件)
│   ├── host.js            #   Host 半身(ESM;Node 全局 fetch;注册 /dsh-balance-panel 路由)
│   └── client.js          #   浏览器半身(__ModuleLoader__ 格式 bundle,由 src/client.js 生成)
├── src/                   # 源码
│   ├── host.js            #   Host 半身源码(= lib/host.js)
│   └── client.js          #   浏览器半身源码(纯 JS,React.createElement,无 JSX)
├── scripts/
│   └── build-client.mjs   # 把 src/client.js 打包成 lib/client.js(无需 esbuild)
├── README.md              # 本文档
├── LICENSE                # MIT
└── .gitignore

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

← 上一个 Prev mattpocock-skills-dsh-zh 下一个 Next dsh-enhanced-plugins →