dsh-dual-balance

Introduction

The status bar in DeepSeek Harness (DSH) has two independent wallet sources: the Platform wallet of the logged-in account (including top-up and bonus balances) and the official balance associated with the API Key. Most current community plugins only cover the API Key balance and do not show the actual available funds inside the logged-in account.

The dsh-dual-balance plugin displays these two sources together in the status bar. It uses the DSH built-in deepseekAccount service to read the account balance and calls the official /user/balance endpoint to read the Key balance. For the same funds, it automatically merges the display; for different accounts, it displays them side by side.

Core Features

  1. Dual balance display: Shows both the Platform wallet balance for the logged-in account and the API Key balance.
  2. Smart folding: When the two sources belong to the same account, they are automatically collapsed into a single segment.
  3. Detail panel: Click the pill-shaped icon to expand details, including the top-up/bonus breakdown.
  4. Zero configuration: No extra configuration is required; it works immediately after installation.
  5. Secure and reliable: Keys are used only inside the Host process, and the browser reads numbers only through read-only routes.
  6. Failure handling: If a read fails, the last successful value is retained and marked with ⚠, and the value is never displayed as 0.
  7. Visual alignment: Reuses official CSS primitives and aligns pixel-perfectly with the other pills in the status bar.

Installation and Activation

This plugin requires DSH version 0.1.5-rc.1 or higher and Node.js >= 20. The package includes a prebuilt lib/ directory, so no extra build step is needed.

Install from the repository (recommended):

dsh plugin --profile web add github:fangweixuan26-hash/dsh-dual-balance

Install from a local directory (for development and debugging):

dsh plugin --profile desktop add /path/to/dsh-dual-balance

After installation, the Web and Desktop interfaces refresh automatically. If nothing changes, refresh the page manually.

Uninstall:

dsh plugin --profile web remove dsh-dual-balance

Usage

After installation, a new pill appears in the status bar. The pill displays different content based on the current state:

  • Same account: shows Balance ¥9.49.
  • Different accounts: shows Account ¥13.78 | API ¥2.00.
  • Account not logged in: shows Account not logged in.
  • API Key not configured: shows API not configured.
  • Read failure: retains the last successful value and marks it with ⚠.
  • Unavailable: shows Balance unavailable.

Refresh logic:
- Automatically refreshes once after 60 seconds of inactivity.
- Force-refreshes once when clicking the pill to open the panel.

Technical Details

  • Currency handling: Prefers CNY; if CNY is unavailable, displays the currency with the largest absolute value.
  • Folding logic: When both sources are ready, the currency is the same, and the difference between the account-side total and the API-side total is ≤ 0.01, they are considered the same funds and are collapsed.
  • Dependencies: Zero npm runtime dependencies.
  • Security: Account credentials and the API Key are used only inside the Host process; the browser fetches data through local read-only routes.

Summary

dsh-dual-balance solves the problem that DSH users cannot directly view the logged-in account’s Platform wallet balance in the status bar. By reusing official primitives, it provides a secure, stable, and visually consistent balance viewing experience.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye