When developing with the DeepSeek Harness (DSH) Web UI, you need to frequently check the current session’s Provider quota or cash balance. Manually switching pages or checking the console is inefficient and unintuitive. This plugin adds a persistent floating card to the right edge of the DSH Web interface and automatically switches the data source based on the current session’s Provider.

Plugin Scope

This is a client plugin maintained by MST19711, and its core is an extensible backend architecture. It not only supports OpenCode Go subscription quotas, but is also compatible with pay-as-you-go balances for Zhipu and DeepSeek. When the model used in the current session matches an integrated backend, a persistent panel is displayed on the right edge; when switching to an unintegrated provider, it automatically hides.

Core Features

  1. Floating Card
    Displayed on the right edge of the DSH Web UI. The panel content is automatically selected based on the current Provider; only one card is displayed at a time. The card contains a title, the current model name, data rows, and an update timestamp.

  2. Automatic Selection Mechanism
    The plugin has three built-in backends: OpenCode Go, Zhipu, and DeepSeek. It automatically matches the corresponding backend based on the current session’s Provider ID or BaseURL.

  3. OpenCode Go Subscription Quota
    Supports subscription quota display across three time windows: 5-hour rolling, weekly, and monthly.
    * Display content: remaining percentage, reset countdown, and progress bar.
    * Color cues: remaining ratio ≤30% displays orange, ≤10% displays red.

  4. Generic Balance Backend
    * Zhipu: Supports pay-as-you-go cash balance (available balance, cumulative recharge, cumulative consumption). Complimentary and frozen balances appear when non-zero. Badge dot alerts are based on absolute balance (<¥10 red, <¥50 orange).
    * DeepSeek: Supports pay-as-you-go cash balance. Displays available balance, the recharged portion, and the complimentary portion. When the account is unavailable (is_available: false), a status line is appended. Badge dot alerts are based on currency thresholds (CNY <¥10 / <¥50, USD <\(2 / <\)10).

Installation and Verification

Installation

Use the official installation script. It installs to the web profile by default:

bash install.sh

Verification

Run the verification script to test backend logic. The script supports offline mode (using a fake context and fake upstream) and online mode (reading ~/.dsh/.credentials.yaml):

node test-deepseek-backend.mjs          # 离线验证
node test-deepseek-backend.mjs --live   # 在线验证

Extension and Security

Adding a New Provider

The plugin uses an extensible multi-backend architecture and can be extended without client-side changes. Add a backend object to the BACKENDS array in lib/index.js:

{
  id: 'my-provider',
  displayName: 'My Provider',
  cache: new TTLCache(60_000),
  matchesProvider(id, node) { ... },
  async resolvePanel(ctx, providerId, node) {
    return {
      ok: true,
      panel: {
        title: 'My Provider',
        rows: [ { label: '剩余', value: '…', bar: { fill: 42, tone: 'warn' } } ],
        chip: { text: '…', tone: 'ok' },
        foot: '…',
      },
    };
  },
}

Security and Protection

  • API Key Security: API keys are resolved only by the DSH credentials service inside the server-side process; keys never enter the browser and are not written to logs.
  • Independent Caching: Each backend has independent caching. OpenCode Go uses a 15s cache, while Zhipu and DeepSeek each use a 5min cache. Failures are not cached and are retried on the next poll.
  • Routing Protection: Routes include same-origin/loopback protection, and cross-site reads return 403.

Upgrade Notes

When upgrading from an older version, first remove the old package name and replace the package name in dsh.profile.bundles. The changes take effect after restarting DSH.

Summary

This plugin provides DSH users with intuitive real-time data feedback and addresses the pain point of monitoring quotas and balances in the Web UI. For more details, refer to GitHub or Community Catalog.