In the DeepSeek Harness (DSH) Web environment, developers often need to switch between tabs to check their balance and token consumption. dsh-deepseek-usage-panel provides a macOS-style floating usage panel that integrates real-time official balance data and locally measured token usage into the interface, without opening platform.deepseek.com/usage.

Plugin Scope

This is a client-side plugin maintained by WeiyangPro and released under the MIT license. It adds a frosted-glass UI component to the DSH Web interface, displaying official balance snapshots and token consumption trends based on local measurement.

Core Features

  • Official Balance: Data is retrieved by polling the GET /user/balance endpoint. Only the balance fields returned by the official API are displayed, ensuring a consistent data source.
  • Token Usage Statistics: Provides smooth charts for today, the current session, and the last 24 hours. The metrics include input tokens, output tokens, a breakdown of cache hits/misses, and distribution by model share.
  • Interaction Design:
    • Capsule and Panel: A capsule is displayed in the bottom-right corner. It can be dragged to any position, and the position is automatically remembered.
    • Expand and Collapse: Click the capsule to expand the panel. You can collapse it by clicking anywhere in the panel, clicking the traffic-light icons, or pressing ESC. The expansion includes transition animations.
    • Automatic Direction: The panel expansion direction is automatically selected based on the capsule position (upward or downward).
    • Refresh: A refresh button is provided in the upper-right corner. Clicking it rotates the icon and provides “Refreshed” status feedback.

Installation and Activation

To install the plugin, run the following command in a terminal. After installation, restart dsh web and perform a hard refresh in your browser (Ctrl/Cmd + Shift + R).

dsh plugin --profile web add dsh-deepseek-usage-panel

Configure the API Key

The plugin needs access to the DeepSeek API to retrieve balance information. The API key is stored only in the host Node process and is not injected into the browser, resulting in higher security. Configure it in ~/.dsh/.credentials.yaml:

version: 1
refs:
  DEEPSEEK_API_KEY: sk-你的key

It can also be set via the DEEPSEEK_API_KEY or DSH_USAGE_HUD_API_KEY environment variable.

Typical Usage

  1. View Status: The capsule in the bottom-right corner displays the current balance, today’s usage, and session usage in real time. The capsule position can be dragged and will automatically be restored the next time it is opened.
  2. Expand the Panel: Click the capsule to expand the panel. It displays the balance card, 24-hour chart, model share statistics, and a link to the official usage page.
  3. Interaction Controls: Click a blank area of the panel or press ESC to collapse it; click the refresh arrow in the upper-right corner to update the data immediately.

Configuration Options

In the DSH profile’s cordis.patch.yml file, you can override the configuration for id: usage-panel to adjust plugin behavior:

- id: usage-panel
  config:
    pollIntervalMs: 300000   # 余额轮询间隔(毫秒),最小 60000
    historyHours: 72         # 历史小时桶保留数
    baseURL: https://api.deepseek.com   # 覆盖接口地址
    apiKeyRef: DEEPSEEK_API_KEY         # 凭据引用名
    dataDir: null            # 覆盖数据目录(默认 $DSH_HOME/dsh-deepseek-usage-panel)

Data and Privacy

  • Data Storage: The API key exists only in the host (Node) process. The browser only receives the parsed balance snapshot. Historical token data is stored in state.json in the local data directory, with atomic writes and automatic trimming supported.
  • Metrics Scope Clarification:
    • The token data for today / last 24 hours / by model / session is locally measured, not the official DeepSeek platform ledger.
    • Because the plugin starts measuring from its startup time, requests generated before installation or after a restart cannot be counted. As a result, the “today” or “last 24 hours” data may be lower than the official full-day amount.
    • Token calculation for individual records uses the same source as official billing, but the total may deviate because the observation window is incomplete.
    • “Session” is the cumulative value for the current session and does not correspond to a calendar-day metric.
    • It is recommended to focus on the relative trends and composition of the data. For absolute totals, refer to the official usage page.

License and Ecosystem

  • License: MIT.
  • Node Version: >= 20.
  • Ecosystem: This plugin is part of the DeepSeek Harness plugin ecosystem. The community directory is maintained by an independent site and has no official affiliation with DeepSeek or High-Flyer.

Project Address: GitHub - WeiyangPro/dsh-deepseek-usage-panel