Preface

In a web runtime environment like DeepSeek Harness (DSH) that emphasizes “everything is a plugin,” a common issue after calling multiple models is: how many tokens each model consumed, which parts hit the cache, the approximate cost, and how much balance remains in the DeepSeek account. model-usage-plugin is a DSH Web plugin designed to track token usage across models, estimate costs, and display the API account balance. It consolidates token details, cost estimates, and balance checks into the settings panel, making it ideal for users who need to verify model invocation costs within DSH.

What This Is

model-usage-plugin is a DSH Web plugin, with its repository located at https://github.com/AKS1st/model-usage-plugin and licensed under MIT. It addresses the core need of viewing token consumption by model, estimating costs, and displaying the DeepSeek account balance on the page.

Core Features

Let’s break down its capabilities.

Token and Invocation Statistics by Model

  • Tracks tokens by model, distinguishing between cache hits, misses, and writes.
  • Counts the number of invocations and failures.
  • Estimates costs based on pricing.

Default and Custom Pricing

  • Includes default prices for mainstream models: domestic models in CNY, overseas models in USD.
  • Applies default prices automatically on first use, which can be modified at any time.
  • Each model card offers a “Configure Price” button to adjust unit price and pricing currency, as well as a “Reset” button to restore defaults.

Peak/Valley Pricing

Each model can enable “Peak/Valley Pricing,” supporting up to two peak periods (HH:MM, crossing midnight if needed). Both peak periods share the same peak price; tokens during peak times are billed at the peak price, while those outside are billed at the normal price. If the peak price is left blank, the normal price is used.

DeepSeek’s default prices are updated according to the latest official peak/valley billing:

  • deepseek-v4-flash and deepseek-v4-pro come with the official 2026-08-17 pricing, including idle and peak prices, and two peak periods: 09:00–12:00 and 14:00–18:00 (based on server local time).
  • deepseek-chat and deepseek-reasoner use the latest official prices.
  • Known DeepSeek models still on old default prices or with empty peak periods will automatically upgrade to the official default configuration upon startup; user-customized prices with valid peak periods are unaffected.

Exchange Rates and Balance

  • Costs are displayed uniformly in the target currency, defaulting to CNY.
  • Exchange rates, along with timestamps, are cached to the data file upon successful retrieval.
  • Automatically refreshes once on startup if no cache exists.
  • When the settings page is opened, if the cache is not older than one week, it does not auto-refresh; users must click “Update Exchange Rate” manually. If there is no cache or it exceeds one week, it refreshes automatically once.
  • Queries the DeepSeek account balance and displays the total tokens and account balance prominently at the top of the page.

Display Control

The settings panel provides a “Model Consumption” tab. Enabling “Show Only Called Models” hides models that haven’t been used, displaying only those actually invoked.

Installation and Activation

The plugin is installed to the profile via dsh plugin (using pnpm forwarding) and automatically registered as a bundle layer. The repository notes it is pure JS, zero-build, and ready to use out of the box.

Installation from GitHub Repository

Run the following commands to install and restart the web service to activate the profile:

dsh plugin --profile web add github:AKS1st/model-usage-plugin
dsh web   # Restart web service to activate the profile

Local Installation

First clone the repository, then install by pointing to the repository directory:

git clone https://github.com/AKS1st/model-usage-plugin.git
dsh plugin --profile web add /path/to/model-usage-plugin
dsh web

Uninstallation

Run the following command to remove the plugin:

dsh plugin --profile web remove model-usage-plugin

Typical Usage

After completing the steps above, use it as follows:

  1. Open Settings → Model Consumption. The top will display total tokens, account balance, target currency, and exchange rate status.
  2. View the token details and costs in each model card.
  3. Click “Configure Price” to adjust the unit price and pricing currency, enable peak/valley pricing, and set peak periods and peak prices.
  4. Click “Reset” to restore default prices when needed.
  5. Enable “Show Only Called Models” to display only the models that have actually been used.

Data, Permissions, and Notes

  • Token statistics, pricing, and exchange rate caches (including timestamps) are saved in $DSH_HOME/musage-stats.json.
  • The balance API Key entered on the page is stored only in memory and not written to disk; for persistence, configure the DEEPSEEK_API_KEY environment variable or credentials.
  • The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation; this repository is licensed under MIT.
  • The DSH plugin ecosystem emphasizes “everything is a plugin,” and this plugin is provided as an independent repository. Use it based on the repository’s documentation and license.

Conclusion

model-usage-plugin is suitable for scenarios where you need to view model token consumption, cache details, cost estimates, and DeepSeek account balance within the DSH Web interface. It consolidates commonly needed cost information into the settings panel, making it easy to verify invocation details by model. Repository URL: https://github.com/AKS1st/model-usage-plugin.