dsh-balance-card: Persistently Monitoring Current Model Provider Balance in DSH Web Sidebar

Preface

When switching between models from different vendors in DSH, balances are often scattered across various consoles or billing APIs. Confirming “which vendor the current session is using and how much remains” usually requires opening separate pages or keeping track manually. The dsh-balance-card introduced below (npm package name @utmotc/dsh-balance-card) aggregates API balances or subscription quotas from various vendors into the left side of dsh Web: a card attached above the settings button that switches vendors according to the model selected in the current session, and can expand details in place without navigating away from the page.

What Is This

dsh-balance-card is published by community maintainer Utmotc, categorized as a client plugin (for dsh Web). It solves the problem of: seeing at a glance the balance, quota, or credits of the vendor behind the model currently used in the conversation, while distinguishing between monetary amounts (yuan/dollars, etc.) and credits, to avoid mixing different units of measurement in the same display.

Readings are provided to the browser via GET /api/dsh.balance after the host parses API keys and other credentials; settings are handled through GET/POST /api/dsh.balance.settings, using the same authentication as Connection. Keys are not written to the plugin’s disk; the browser side only receives numbers.

Core Features

  • The card displays the balance of the vendor corresponding to the model used in the current session: ring progress, percentage, progress bars for each plan, and last update time.
  • Switch models, and the card switches accordingly; clicking the card expands a details panel in place, without the session leaving the current page.

Built-in Vendors and Data Sources

The plugin reads data through each vendor’s official billing interface or status routes from other plugins in the ecosystem, mainly including:

Type Vendor / Scenario Description
API Balance DeepSeek, StepFun, Kimi Coding, OpenRouter, MiniMax, xAI/Grok Their respective official GET interfaces; amounts or quotas are displayed according to the reading type
Credits WorkBuddy, Qoder Does not re-implement login logic; reads published status routes from dsh-workbuddy-connect / dsh-qoder-connect
Subscription Quota ChatGPT (Codex), Claude, Grok (X Premium), GitHub Copilot, Google Antigravity Works in conjunction with dsh-plugin-subscriptions to display subscription quotas and reset times, etc.

Additionally, you can declare additional vendors or override built-in endpoints in the user file $DSH_HOME/model-balance-providers.json (default ~/.dsh/model-balance-providers.json) without modifying plugin code.

Vendors without API-level billing (such as some console-only billing routes) will display “Not supported at this time”; if a console link is available, it will be provided.

Units and Display

  • Amounts use ¥ / $ etc. and words like “yuan / dollars”; credits are separately labeled “credits”; quotas use forms like counts; when units cannot be determined, display “Unit unknown” rather than forcing them to be treated as RMB.
  • Balance monitoring settings page allows configuration of: display location (sidebar card / input box capsule / both / neither), polling interval, alert threshold, unit formatting, update time format, thousands separators, etc.; settings are written to the plugin’s own configuration, without triggering a loader rebuild or requiring a dsh restart.

Security and Degradation

  • By design, no additional dsh authorization is required; when a service is missing, only a block is not displayed, the application startup is not blocked.
  • WorkBuddy / Qoder / subscription readings will display clear states such as “Not installed”, “Not logged in”, “Read failed” when the corresponding plugin is not installed, not logged in, or the route fails, rather than silent errors.

Installation and Activation

Requires dsh 0.1.7 or newer, Node 22.19+ (or 24+), consistent with dsh’s own requirements. The current npm release version is 1.4.0 (MIT license).

Execute in the terminal (original command from the documentation):

dsh plugin --profile web add @utmotc/dsh-balance-card

If using the dsh1024 CLI with community installation statistics, you can also execute:

dsh1024 plugin --profile web add @utmotc/dsh-balance-card

Installation will automatically add the package to $DSH_HOME/profiles/web, write to dsh.profile.bundles via dsh.bundle.patch, and apply loader patches, thereby auto-activating. For upgrades, you can update on the plugin page or execute:

dsh plugin --profile web add @utmotc/dsh-balance-card@latest

Method 2: Web Plugin Page

In the installation box on the plugin page in the dsh Web sidebar, paste and confirm:

  • npm package name (recommended): @utmotc/dsh-balance-card
  • or GitHub archive: https://github.com/Utmotc/dsh-balance-card/archive/refs/tags/v1.4.0.tar.gz

After installation, the plugin can be toggled on the same page.

Typical Usage

1. View Balance with Model After Configuring Credentials

Each vendor is resolved through dsh credentials or environment variables. For example, DeepSeek commonly uses DEEPSEEK_API_KEY (settings namespace llm-deepseek-api-key or llm-pi-ai), while OpenRouter, MiniMax, xAI, etc. are mostly configured under llm-pi-ai. After selecting a model on a certain vendor’s route in Web, the sidebar card should display the vendor name and reading; if it fails, click to open the details panel to view HTTP or parsing error messages.

2. Works with WorkBuddy / Qoder

When selecting workbuddy / workbuddy-ai or qoder / qoder-global model groups, the corresponding connect plugin must be installed and logged in; this plugin reads credits from loopback status routes, for example:

  • workbuddy → /plugins/dsh-workbuddy-connect/status
  • qoder-global → /plugins/dsh-qoder-connect/global/status

3. Custom Vendors (Zero Code)

  1. Confirm that the vendor provides a billing GET interface with Bearer API Key.
  2. Edit ~/.dsh/model-balance-providers.json (or the file pointed to by DSH_MODEL_BALANCE_CONFIG), and add an entry under providers, for example:
{
  "providers": {
    "my-vendor": {
      "name": "My Vendor",
      "baseURL": "https://api.example.com",
      "endpoint": "/v1/balance",
      "keyEnv": "MY_VENDOR_API_KEY",
      "response": { "type": "currency", "currency": "CNY", "balance": "data.balance" }
    }
  }
}
  1. Store MY_VENDOR_API_KEY in credentials or environment variables, restart dsh (vendor lists are cached per process), then select a model on the my-vendor route to verify the sidebar reading.

The vendor id must match the harness route id; aliases can be declared using aliases.

4. Adjust Display and Polling

Open the Balance Monitoring settings page in dsh Web, select display location, polling interval, alert threshold, etc., save and it takes effect without needing a restart.

Use Cases and Notes

Suitable for: Developers who frequently switch between multiple vendor models in dsh Web and want to verify API balances, subscription windows, or WorkBuddy/Qoder credits without leaving the conversation page.

Notes:

  • The plugin runs under the current dsh process permissions; credentials are resolved by the host. Before installation, it is recommended to read the GitHub repository source code and MIT license to confirm compliance with your security policy.
  • Subscription quotas depend on dsh-plugin-subscriptions and corresponding login/OAuth; when not installed or not logged in, the display will degrade.
  • If using expr expressions in custom providers.json, the configuration file is equivalent to trusted code and should be guaranteed to be writable only by yourself.

The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub directory page is a community collection with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-balance-card aggregates the balance, quota, or credits of “the vendor corresponding to the current model” into a card in the Web sidebar, and works in division with other connect / subscriptions plugins, with unit display also differentiated. If you need to persistently view accounts in the harness, you can install @utmotc/dsh-balance-card using the above command, then toggle and adjust parameters in the plugin page or “Balance Monitoring” settings as needed.

  • Directory page: https://www.skillhub.cn/plugins/Utmotc/dsh-balance-card
  • GitHub: https://github.com/Utmotc/dsh-balance-card
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye