The Web interface of DeepSeek Harness (DSH) is mainly used for interaction. Developers often need to monitor API call costs and account balances. The dsh-ui-billing plugin adds a billing component to the bottom of the Web GUI sidebar to display the cost of the current session and the real-time API balance.

This is a small widget that displays the current session cost and API balance. It is a client-side plugin maintained by HenryHwong and is licensed under the MIT License.

Core Features

Current-session cost
Displays the total cost of the current conversation. The plugin aggregates the usage records from assistant/message and calculates the cost in CNY based on the price table loaded at startup. Switching sessions updates the display; pagination and compaction do not change the displayed amount. If there are unpriced tokens, it shows (+N tokens unpriced).

Live API balance
Displays the provider account balance. It is read through Harness’s provider facts and refreshed every 60 seconds or when the connection is reset. Clicking the row refresh button refreshes manually.

Collapsed-rail glyph
When the sidebar is collapsed, a single ¥ symbol is shown. Hovering over it displays two lines of information, and clicking it refreshes the balance.

Idle by default
If no subscribers are mounted, it does not fetch data, saving resources.

Installation and Enablement

This plugin is installed through the DSH plugin manager. Run the following command in the Web profile directory:

dsh plugin --profile web add @huanghanheng/dsh-ui-billing

Configuration and Price Table

The plugin uses built-in price tables and billing rules by default. To customize, specify the following in the plugin configuration:

- id: ui-billing
  name: '@huanghanheng/dsh-ui-billing'
  config:
    prices:
      'deepseek-v4-pro':
        offPeak: { inputPerM: 4.5, cacheReadPerM: 0.15, outputPerM: 13.5 }
        peak: { inputPerM: 9, cacheReadPerM: 0.3, outputPerM: 27 }
    peakHours: [[540, 720], [840, 1080]]
    utcOffsetMinutes: 480

Configuration options:
* prices: Custom input, cache-read, and output prices for each model.
* peakHours: Peak-hour configuration (in minutes).
* utcOffsetMinutes: Time-zone offset (480 represents Beijing time, UTC+8).

Dependencies and Prerequisites

  • DSH version: DSH 0.1.7-rc.1 or later is required.
  • Projection Registry Composed: The Web interface must load the @deepseek-ai/dsh-session-projection package to support the cost-line display.
  • API Key: A DeepSeek API Key must be configured (via the credentials service or the DEEPSEEK_API_KEY environment variable).
  • Permissions: The plugin runs with the permissions of the current dsh process.

Security Notes

  • Display only: It only displays data; it does not write to session logs, send data to the model, or generate additional RPC calls (except the read-only /api/billing.balance).
  • Credentials host-side: The API key is resolved by the host-side credentials service and does not enter browser packages.

This plugin addresses the pain point of viewing costs and balances in the Web interface, making it suitable for developers who need fine-grained control over API call costs.

GitHub Repository | Community Directory