The design philosophy of DeepSeek Harness (DSH) is “Everything is a plugin”. When developing or using DSH Web GUI for agent development, real-time visibility into the day’s token consumption cost and cache hit rate can significantly improve debugging efficiency. The dsh-cost-widget plugin provides this capability by integrating key metrics into the Web interface.

Plugin Positioning

This is a DSH Web GUI client plugin maintained by zhangshaobo608. It addresses the following need: view the average cost per million tokens for the day for V4-Flash / V4-Pro on a DeepSeek Open Platform account, as well as the cache hit rate, without leaving the Web interface.

Core Features

  1. Floating panel: Provides a draggable floating panel with two forms: a compact floating bar and a full panel.
  2. Cost calculation: Displays the average cost per million tokens for the day for V4-Flash / V4-Pro (= daily cost ÷ daily token count × 1 million).
  3. Metrics overview: Displays cache hit rate (with a progress bar), today’s consumption, request count, today’s total cost, total hit rate, and balance.
  4. Peak/off-peak labeling: Beijing time 9:00–12:00 and 14:00–18:00 are peak hours; the remaining time is off-peak.
  5. Automatic refresh: Refreshes automatically every 5 minutes and supports manual refresh.
  6. Position memory: The panel position is stored in localStorage.

Installation and Enablement

Prerequisite: A DSH web profile (@deepseek-ai/dsh >= 0.1.0-rc.6) is required.

Run the following command to add the plugin:

dsh plugin --profile web add "github:zhangshaobo608/dsh-cost-widget"

After restarting dsh web, hard refresh the browser (Cmd+Shift+R). The panel will be mounted in the bottom action area of the Web GUI sidebar (sidebar.footer.action slot).

Configuring Credentials (One-Time)

The plugin reads the platform session token through the harness credential pipeline. Add the following to ~/.dsh/.credentials.yaml:

DEEPSEEK_PLATFORM_TOKEN: <userToken>

How to obtain userToken: After logging in to platform.deepseek.com in Chrome, run the following command in the F12 console. The token will be copied to the clipboard automatically:

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

Copy the long output string (starting with eyJ) and paste it into the configuration file.

Data Source and Security

  • Data source: The data comes from internal APIs of platform.deepseek.com (/api/v0/usage/by_api_key/{amount,cost} and /users/get_user_summary). It shares the same JSON interface as the official usage page and does not scrape the web page.
  • Interface security: The plugin registers only a read-only loopback endpoint, GET /api/dsh-cost/today, on the local machine. Non-local calls are rejected with 403.
  • Credential limitation: A public API key (api.deepseek.com) only exposes /user/balance and does not include usage statistics. Therefore, usage statistics require a platform session token.

Typical Usage

  1. Restart dsh web and hard refresh the browser.
  2. Find the default compact floating bar in the lower-right corner or the sidebar action area (DeepSeek ¥x · hit rate · peak/off-peak).
  3. Click the floating bar to expand the full panel and view detailed data.
  4. Hold the title bar to drag the panel to any position.

Notes

  • The plugin runs only on the local machine, and position memory is stored in localStorage.
  • A public API key does not provide usage statistics. You must configure a platform session token to fetch data.
  • It is recommended to review the source code and license before installing.

Summary

This plugin provides DSH users with a lightweight cost and cache monitoring solution. The community directory and GitHub repository links are as follows: