Introduction

When using the DeepSeek API within DSH Web, checking the remaining balance, configuring low balance alerts, or opening the recharge portal typically requires extra steps. dsh-balance-display is a DSH client plugin that places the balance display at the bottom of the Web GUI sidebar and supports balance trends, low balance warnings, and one-click recharge.

What is This

dsh-balance-display is maintained by zhangjianyu1006156, licensed under MIT, and categorized as a client plugin. It targets the DSH Web scenario, displaying the remaining DeepSeek API balance at the bottom of the sidebar and providing a “Balance Display” configuration entry in the settings page.

Core Features

Balance Capsule

  • Display balance at the bottom of the sidebar.
  • Click to refresh.
  • Display the recharge/gift split on hover.

Low Balance Warning

  • When the balance falls below the threshold, the dot turns red and a hover warning is displayed.
  • Configurable browser notifications; using browser notifications requires granting notification permissions.
  • The default low balance warning threshold is ¥5.
  • Display 4 decimal places when the balance is less than ¥1.
  • The settings page displays a sparkline trend chart and provides today/last 7 days consumption statistics.
  • Balance history and preferences are stored in browser localStorage with the key prefix dsh.balanceDisplay.*; the host side does not perceive or store this data.

Recharge and Retry

  • Both the capsule and settings page allow one-click access to platform.deepseek.com/usage.
  • On consecutive failures, the refresh interval increments automatically.
  • Pauses refreshing when switching tabs and refreshes immediately upon returning.

Themes and Collaboration

  • Supports light, dark, and follow system.
  • Chinese/English interface switches in real-time following dsh language settings.
  • Can declare the plugin in system prompts for agents to remind users to recharge when the balance is too low.

Installation and Usage

The installation command is as follows:

dsh plugin --profile web add dsh-balance-display

For local development mode, you can use:

dsh plugin --profile web add link:/path/to/dsh-balance-display

Restart dsh web after installation. A balance capsule will appear at the bottom of the sidebar, and a “Balance Display” tab will appear in the settings page.

Typical Configuration

In the “Balance Display” tab of the settings page, you can configure:

  1. Sidebar display balance badge.
  2. Auto-refresh interval; default is 10 minutes.
  3. Low balance warning threshold; default is ¥5.
  4. Browser notification when balance is insufficient.
  5. Agent collaboration, i.e., declaring the plugin in system prompts.

Security and Runtime Boundaries

  • API keys are handled entirely on the host side; the browser side only fetches masked balance JSON from the local loopback route.
  • dsh web defaults to binding only 127.0.0.1, routes are only GET (balance) and GET/POST (announce config), without CORS headers.
  • The plugin runs with the permissions of the current dsh process; you should check the source code and license before installing.
  • Browser notifications require browser notification permission authorization.

Compatibility and Environment

  • Compatible with the desktop packaged version (embedded dsh rc.5) and the official website npm version dsh web (rc.6).
  • package.json requires node >=22.19.

Testing

To test the host side, run:

node /tmp/test-balance-host.mjs

To test the client side, run:

node /tmp/test-balance-client3.mjs

Use Cases

Suitable for developers who frequently use the DeepSeek API via DSH Web and wish to view balance, configure low balance alerts, check recent consumption, and quickly jump to recharge without leaving the Web interface.

Links

Directory page: zhangjianyu1006156/dsh-balance-display

GitHub: zhangjianyu1006156/dsh-balance-display