Introduction

The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin”. During development or when calling the DeepSeek API, real-time monitoring of balance, token consumption, and request frequency is essential. dsh-deepseek-balance is a web UI plugin designed for this need. It embeds API usage information directly into the sidebar, allowing you to track core data without leaving the current page.

What Is This

This is a DeepSeek Harness (DSH) web UI plugin maintained by developer qianTouchFish under the MIT License. Its core function is to keep a DeepSeek API usage bar always visible in the sidebar and provide an expandable card to view more detailed consumption data.

Core Features

  1. Always-visible usage bar in the sidebar
    Directly above the “Settings” button in the sidebar, it always displays the balance, spending amount, API request count, and Tokens. Data refreshes automatically every minute and turns yellow as a low-balance warning.

  2. Expand to view detailed data
    Click the usage bar to expand the full card. You can view consumption by model and time dimension (Today, Yesterday, Last 7 Days, Last 30 Days, This Month, Last Month), with a mini bar chart included.

  3. Official cumulative consumption
    Displays official cumulative consumption data. This data comes from the platform console and requires configuring a platform token. If it is not configured, the system automatically falls back to a balance difference estimate.

  4. Peak/Off-peak Period Indicator
    Shows the current billing period in real time next to the model selector. Beijing Time 09:00-12:00 and 14:00-18:00 are marked as peak hours; all other times are off-peak.

  5. One-click token retrieval
    Supports one-click extraction of the platform token (DEEPSEEK_PLATFORM_TOKEN) from local Chrome, Edge, or Chromium browsers.

  6. Theme and persistence
    The plugin automatically adapts to light/dark themes. Time dimension, API Key, and model selection are automatically persisted.

Installation

Run the following command in your terminal:

dsh plugin --profile web add github:qianTouchFish/dsh-deepseek-balance

After installation, restart the web app (desktop icon or dsh web) and refresh the page. The usage bar will appear at the bottom of the sidebar.

Configuration and Usage

  1. Enter the API Key
    On first use, go to the DSH “Settings → Models” page and enter DEEPSEEK_API_KEY.

  2. Retrieve official data
    To view official cumulative consumption and more precise data, open the usage card and click the “Auto-fetch” button at the bottom. The plugin will try to extract the token from a local browser that is logged in to https://platform.deepseek.com.

  3. Manually configure the token (optional)
    If automatic retrieval fails, you can extract it manually. After logging in to the platform in your browser, press F12 to open the console and run the following code to extract the token:

JSON.parse(localStorage.getItem('userToken')).value

Append the retrieved token to the ~/.dsh/.credentials.yaml file:

DEEPSEEK_PLATFORM_TOKEN: <那串令牌>

Notes

  • This plugin depends on the installed DSH CLI and pnpm.
  • When using the “Auto-fetch” feature, the browser must already be logged in to https://platform.deepseek.com, and incognito mode is not supported. If the browser uses a non-default profile (such as Profile N), adjust it in the plugin settings.

Summary

dsh-deepseek-balance addresses the pain point of developers frequently switching pages to check API balance and consumption by providing an always-visible usage bar and expandable detail card in the sidebar. Together with the peak-hour indicator and automatic refresh mechanism, it better supports agent development and cost control.

Plugin catalog: [catalog_url]
GitHub repository: [github_url]