Preface

The DSH philosophy is “everything is a plugin”: there are plugins that alter agent behavior, and there are tools that only read existing runtime data and display it. qwert702/dsh-token-viewer falls into the latter category. It provides CC Switch-style token consumption statistics for the DeepSeek Harness Web GUI, primarily addressing questions like “how much billable input has the current session used?”, “what is the cache hit rate?”, “what are the overall costs and account balance?”.

It does not add prompt content, tools, or initiate new provider requests; the interface mainly consists of a set of read-only statistical surfaces and a balance proxy reader.

What Is This

  • Plugin name: qwert702/dsh-token-viewer
  • Maintainer: qwert702
  • License: MIT
  • Purpose: CC Switch-style token consumption statistics (read-only) for DeepSeek Harness Web GUI.

It displays per-request usage based on the harness’s host usageLog projection and additionally proxies the reading of the DeepSeek account balance. For Web GUI users, its value lies in consolidating token consumption, cache hit rates, cost trends, and balance into a single interface.

Core Features

TokenDock

TokenDock is a real-time bar located above the composer. It displays for the current session:

  • Billable input: uncached + cache reads + cache writes
  • Output
  • Cache hit rate
  • Approximate context usage

The sidebar card displays:

  • DeepSeek account balance
  • Balance refresh
  • Error retry when the host proxy fails
  • Aggregated consumption across all sessions
  • Expandable list by session

Usage Statistics Panel

The usage statistics panel performs per-request statistics based on the host usageLog projection. Each record corresponds to a reported assistant step, recording submission time, model, and four token buckets.

The main information in the panel includes:

  • Actual consumption hero
  • Number of requests
  • Total cost
  • Five-card breakdown
  • Cache hit rate progress bar

Trend Chart

The trend chart buckets by request submission time:

  • Current day bucketed by hour
  • Other times bucketed by day
  • Empty buckets filled with zero

The chart includes four token series and a dashed cost line.

Tabs

The panel provides three tabs:

  1. Request Log: sorted newest to oldest; click a row to open the corresponding session.
  2. Statistics by item.
  3. Statistics by model, showing average cost.

Time Range

Time range presets include:

today / 7d / 14d / 30d / all

Model Pricing

The plugin displays pricing based on model peak and off-peak rates:

  • Model: V4-Flash / V4-Pro
  • Pricing unit: per 1M tokens CNY
  • Cache writes: charged at the cache-miss rate
  • Beijing peak hours: 09:00–12:00 and 14:00–18:00
  • Peak price: twice the off-peak price
  • Unknown models: fallback to V4-Flash off-peak table

The price source may include built-in tables:

MODEL_PRICING

When accessible, the panel also fetches official provider pricing via the following endpoint:

GET /api/billing/pricing

Balance Route

Balance reading is completed via the following endpoint:

GET /api/billing/balance

This endpoint proxies DeepSeek’s:

/user/balance

The proxy path goes through the harness credentials service; the API key does not leave the server.

Installation and Activation

Execute the installation command in the DSH environment:

dsh plugin add qwert702/dsh-token-viewer

After installation, restart the harness, refresh the webpage, and then open in the sidebar:

Token Consumption → Usage Details

Typical Usage

Below is the basic viewing path after installation.

  1. Install the plugin:
dsh plugin add qwert702/dsh-token-viewer
  1. Restart the harness and refresh the Web GUI page.

  2. View the sidebar card:
    - Check the DeepSeek account balance.
    - Manually refresh the balance.
    - If the host proxy fails, use error retry.
    - View aggregated consumption across all sessions.
    - Expand to view the list by session.

  3. Open in the sidebar:

Token Consumption → Usage Details
  1. View in the usage statistics panel:
    - Actual consumption hero.
    - Number of requests.
    - Total cost.
    - Five-card breakdown.
    - Cache hit rate progress bar.
    - Trend chart.

  2. Switch the time range:

today / 7d / 14d / 30d / all
  1. Switch tabs:
    - Request Log: view per-request records and open corresponding sessions.
    - Statistics by item.
    - Statistics by model, and view average cost.

Use Cases and Notes

Suitable for the following scenarios:

  • Want to view token consumption for DeepSeek sessions in a single Web GUI.
  • Want to view cache hit rates, actual consumption, and total costs.
  • Want to view statistics by request, item, and model.
  • Want to check DeepSeek account balance while avoiding direct exposure of the API key on the client side.

Notes:

  • The plugin is positioned as a read-only statistical surface and does not add prompt content, tools, or provider requests.
  • The balance endpoint is proxied through the harness credentials service; the API key does not leave the server.
  • The plugin runs in the current DSH process context; before installation, check the source code, license, and dependency sources.
  • License is MIT.
  • Price display relies on built-in pricing tables or the provider’s official pricing endpoint; unknown models fall back to the V4-Flash off-peak table.

Conclusion

qwert702/dsh-token-viewer consolidates token consumption, cache hits, cost trends, and balance viewing for the DeepSeek Harness Web GUI into one place, making it suitable as a read-only usage panel in daily development.

GitHub repository:

https://github.com/qwert702/dsh-token-viewer

The directory page address was not provided in verified materials; it is recommended to search using the plugin name:

qwert702/dsh-token-viewer