DSH (DeepSeek Harness) plugin ecosystem emphasizes “everything is a plugin.” When developing agents or calling APIs, one of the most common problems is invisible consumption: how much balance remains, how much has been used today, and whether usage will suddenly exceed the limit. Existing approaches either rely on manual refresh in the web interface or lack active interception of consumption limits. dsh-balance-monitor brings this data directly into the DSH left sidebar, providing a full-page panel and a sidebar widget.

Plugin Overview

This is a DSH plugin intended to display API account balances in real time in the left sidebar. It supports multi-platform balance detection, peak/off-peak pricing, session and daily consumption statistics, and configurable consumption limits. The plugin works on both web and desktop clients, with the same core logic. The author is ConTr0L0, the category is Online Tools, and it is licensed under MIT.

Core Capabilities

  1. Full-page panel and widget in the left sidebar

    • The plugin adds a “Balance Monitor” entry to the left sidebar (placed between Plugins and Usage Statistics).
    • Clicking this entry renders the full panel in the main area, including balance, statistics charts, limit settings, and more.
    • The bottom sidebar widget displays account balance, today’s consumption, limit progress, and peak/off-peak status in real time.
  2. Multi-platform balance detection

    • Supported platforms include DeepSeek Official (account login or API Key), Zhipu GLM, OpenRouter, and Tavily.
    • DeepSeek Official can be read through a logged-in account (Platform wallet: credit + bonus) without an API Key.
    • In settings, choose the priority for the balance source: automatic (account first; fall back to API Key when not logged in), account login only, or API Key only.
  3. Peak/off-peak pricing and automatic synchronization

    • The plugin includes DeepSeek Official rules: peak hours are Monday through Friday, 9:00–12:00 and 14:00–18:00 Beijing Time; weekends and China public holidays are off-peak all day (off-peak half price).
    • The pricing table is automatically synced from the DeepSeek official documentation and validated daily; no manual configuration is required.
    • Requests are priced according to their actual occurrence time; if synchronization fails, it falls back to the built-in default pricing.
  4. Consumption statistics and charts

    • Supports a bar chart of consumption for the last 7 days and a daily stacked token chart (7/14/30 days, filterable by model).
    • Provides a consumption heatmap (30 days/90 days/one year), colored by billed amount; hover to view the amount and token counts.
    • Displays the full session consumption list, sorted by most recent.
  5. Consumption limits and interception

    • Supports three types of consumption limits: daily amount, cumulative amount, and LLM request count.
    • Configurable behavior when limits are exceeded: alert only or alert and terminate.
    • When “alert and terminate” is selected, the server intercepts subsequent LLM requests and returns a clear error.

Installation and Enablement

Before installing, ensure that the DSH version is 0.2.0-rc.2 or higher. After installation, you must fully quit and restart DSH (for desktop, choose Quit from the tray; for the browser version, refresh the page).

Installation Command

dsh plugin --profile web add github:ConTr0L0/dsh-balance-monitor

Desktop Notes

Desktop uses the reserved desktop profile, which cannot be managed directly through CLI commands. Please install it from within the DSH app: Plugins page → Add plugin → enter the local directory path.

Typical Usage

  1. Open the panel: Click “Balance Monitor” in the left sidebar to open the full panel.
  2. Configure Keys: Enter the API Key for each platform in the panel (masked display is supported, and values do not pass through the client).
  3. Adjust refresh: Choose the refresh frequency (5s / 30s / 60s).
  4. Set limits: Go to the settings page and configure the three consumption limit types and the behavior when limits are exceeded.
  5. View details: Click the sidebar widget or the balance number in the panel to switch platforms and view detailed consumption charts and lists.

Billing and Data Notes

  • Data sources: DSH session logs (session.l.zstd, etc.). The plugin deduplicates by the unique message.id of assistant/message entries before billing.
  • Calculation logic: Each LLM request is billed separately for input/output/cache hits. Pricing determines whether a request occurs during peak hours based on request time; peak hours use the full price, while off-peak periods (weekends/holidays) are multiplied by 0.5.
  • Models and providers: Includes usage from all providers in DSH logs. DeepSeek Official is billed according to official pricing; other providers are token-count only.
  • Pricing synchronization: The plugin automatically validates and updates the pricing table daily (source: DeepSeek official documentation page).

Technology and Architecture

  • Server: Located in lib/index.js, responsible for session log parsing, balance polling, and limit interception.
  • RPC channel: Located in lib/rpc.js, provides services through POST /dsh-balance-monitor/<endpoint> prefix routing, with Host/Origin validation.
  • Client: Located in lib/client.js, registers three slots: sidebar.panellist, main, and sidebar.footer.action.
  • Storage: State is stored in $DSH_HOME/storages/dsh-balance-monitor/state.json, and preferences are stored in prefs.json; both use atomic writes.

Ecosystem Background

The DSH philosophy is “everything is a plugin.” This plugin is included in the community catalog and has no affiliation with DeepSeek Official. It is recommended to check the source code and license before installing.

  • GitHub repository: https://github.com/ConTr0L0/dsh-balance-monitor
  • Community catalog: https://www.skillhub.cn/plugins/ConTr0L0/dsh-balance-monitor