The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When developing or debugging with the API, developers need real-time visibility into account balance, current session costs, and price differences across models. The dsh-usage-monitor plugin integrates official DeepSeek API pricing, session usage costs, cumulative costs, and account balance into the DSH interface.

Features

This plugin provides the following capabilities:

  • Account balance: Displays total balance, paid balance, and credits, and supports manual refresh.
  • Session cost: Uses incremental pricing by model and time period, so the displayed value does not jump when switching models; if the session has not yet been recorded in the ledger, it falls back to a local estimate and labels it as “Est.”
  • Model details: Records tokens and costs in per-model buckets, and displays Flash and V4-Pro details separately.
  • Cumulative cost: Maintains a local ledger for cross-session usage with incremental pricing, and accumulates accurately across peak and off-peak periods; it continues recording even when the panel is not open.
  • Automatic pricing: Includes official pricing and automatically distinguishes peak and off-peak periods.
  • Dual entry points: Adds a Usage tab in the main chat view to show the full panel, and displays a persistent dock above the input box with balance, session cost, current model unit price, and pricing period.

Installation

Before installing, make sure DSH is installed and use the web profile. Run the following command to install:

dsh plugin --profile web add github:liyiersan/dsh-usage-monitor

You can also install from a local directory:

dsh plugin --profile web add /path/to/dsh-usage-monitor

After installation, restart DSH:

dsh web

Usage

In the opened Web interface, set the API key using the environment variable DEEPSEEK_API_KEY or the configuration file ~/.dsh/.credentials.yaml. After configuration, you can find the Usage tab at the top of the main chat view, or see the usage dock above the input box.

Pricing & Billing

The plugin includes official pricing and automatically distinguishes peak and off-peak periods. Peak hours are Monday to Friday, 09:00-12:00 and 14:00-18:00 Beijing Time. Off-peak prices are half of peak prices. Prices are in CNY per million tokens.

Model Time Period Cache Hit Cache Miss Output
DeepSeek-V4.1-Flash Off-peak 0.02 1 4
DeepSeek-V4.1-Flash Peak 0.04 2 8
DeepSeek-V4-Pro Off-peak 0.15 4.5 13.5
DeepSeek-V4-Pro Peak 0.3 9 27

Billing rules:
* cacheRead (cached input) is billed at the cache-hit price;
* uncachedInput (uncached input) is billed at the cache-miss price;
* output is billed at the output price;
* cacheWrite (cache write) is conservatively billed at the cache-miss price;
* Unrecognized model names fall back to Flash and are labeled in the interface.

Costs are calculated incrementally by the local ledger and are consistent with official billing.

Privacy & Security

  • No data collection: The plugin does not collect or upload telemetry data.
  • Key security: It does not store the API key; the key is provided only by the DSH credentials service or process environment variables.
  • Balance queries: These happen only on the host side and target api.deepseek.com.
  • Local ledger: Stored in $DSH_HOME/usage-monitor/ledger, it records only session IDs, token usage, and model-bucketed amounts, and is not committed to the repository.
  • Recommendation: Do not commit the local ledger or credential files to Git.

Compatibility & Maintenance

  • Compatible with DSH 0.1.5-rc.1 (web profile) and 0.1.1-rc.2.
  • Price changes require updating both lib/pricing.js and lib/client.js.

Conclusion

This plugin is suitable for developers who need real-time cost monitoring during debugging. See its GitHub repository for more details.