Preface

DeepSeek Harness (DSH) uses a plugin-based architecture, but monitoring API balance and token consumption is not intuitive in daily use. Existing solutions often require manually switching pages or relying on third-party monitoring tools. The tugu-dsh-balance-widget plugin adds an entry in the DSH sidebar and displays balance, the top-up entry, and consumption data in real time using a centered large card, addressing this pain point.

Plugin Information

Name: tugu-dsh-balance-widget
Author: jieguanya
License: MIT
Positioning: Network tool plugin

Core Features

This plugin keeps the sidebar entry and settings button on the same horizontal row and provides the following features:

  1. Bottom-left entry and centered large card
    The entry is located in the lower-left corner of the sidebar. Clicking it opens a centered large card. The card can be closed by clicking the mask, the close button, or the ESC key. While the panel is open, the entry remains visible and can be toggled at any time.

  2. Real-time balance monitoring
    The plugin automatically reads the DEEPSEEK_API_KEY configured in DSH and calls the official DeepSeek API GET /user/balance. While the panel is open, balance data is automatically refreshed every 60 seconds and can also be refreshed manually.

  3. Top-up entry
    The panel provides a top-up button. Clicking it directly opens the official DeepSeek top-up page platform.deepseek.com/top_up in a new window.

  4. Today’s consumption and model grouping
    Displays today’s call count, total tokens, and cost. Consumption data is grouped by model (model / call count / cost). Newly added models appear automatically without modifying the plugin configuration.

  5. Consumption trend chart
    By default, displays a daily consumption bar chart for the last 7 days or last 30 days. Hovering with the mouse shows daily cost and token details.

  6. Current session tokens
    Replays the full persistent session log, supplements in-progress messages in real time, and covers historical records from before restart.

  7. Today’s approximate consumption
    Estimated based on the difference between the current balance and the opening balance. The data is labeled with “approx.” to avoid confusion with official data.

  8. Security mechanism
    The API key is parsed only on the host side per request. The browser only accesses local routes, so the key does not leave the local machine.

Installation and Activation

Prerequisites:
- DeepSeek Harness 0.1.7+
- DEEPSEEK_API_KEY is configured (settings page or .credentials.yaml)

Installation command:

dsh plugin --profile web add <插件目录路径>

Typical Usage

After restarting DSH, a “Balance” entry appears in the lower-left corner of the sidebar (on the same row as the settings button). Click the entry to view the centered large card.

If you need to verify the API response data, use the following command (replace <port> with the actual port):

curl http://127.0.0.1:<端口>/api/dsh-balance

Notes

  • This plugin runs with the permissions of the current DSH process. Review the source code and license before installation.
  • Node.js or pnpm environments do not need to be configured on colleagues’ machines; the one-click script handles it automatically.
  • The plugin calculates and displays prices based on the official price list.