Introduction

In the Web mode of DeepSeek Harness (DSH), recording the Token usage and cost of each model inference is a common requirement. The dsh-cost-tracker plugin is intended for this purpose. It automatically records the Token usage and cost (CNY) of each API call, supports peak/valley pricing, and provides Agent tools for querying.

Core Features

  • Cost statistics: Automatically records the Token usage and cost (CNY) of each API call, including input, output, and cache hits.
  • Peak/valley pricing: Built-in price table. Peak hours (Monday to Friday 9:00–12:00, 14:00–18:00, excluding statutory holidays) and off-peak half pricing are automatically distinguished. Weekends and statutory holidays are treated as off-peak all day. Local models are counted as 0.
  • Visualization dashboard: The settings page provides overview cards, a spending bar chart, and a usage heatmap. Hover to view details.
  • Agent tools: In the conversation, ask questions such as “How much have I spent so far?”, and the Agent will call tools such as cost_stats / cost_prices to answer.
  • Multi-node aggregation: Supports multi-node aggregation (cloud sync), requiring integration with a self-hosted cloud service.
  • Subscription quota monitoring: Supports quota monitoring and equivalent cost statistics for subscription plans such as Kimi Coding Plan and Volcano Ark Coding Plan.
  • Other features: Balance query, CSV export, history import (v1.9.0), official price sync (v1.9.0), multi-vendor price catalog (v1.9.0), Plan and pay-as-you-go dual track (v1.9.0), zero credential persistence to disk (v1.9.0).

Installation and Enablement

Run the following command in the terminal to install the plugin:

dsh plugin --profile web add @angelyeye/dsh-cost-tracker

After installation, restart dsh web and refresh the browser. The “Cost Statistics” sidebar should appear in the settings page of the DSH Web GUI, and the cost status bar should be displayed below the chat input box.

Typical Usage

Directly ask about the cost status in the conversation. For example, enter: “How much have I spent so far?”, and the Agent will call the relevant tools to return the statistical results.

Notes

  • Local persistence: Data is stored locally; it is not lost on restart and not uploaded.
  • Version defect: v1.7.0 has a client registration defect, and plugins installed by any installation method cannot be loaded. Please use v1.7.1 or a later version.
  • Upgrade cleanup: When upgrading to v1.9.1, do not simply “install the new version again”; you must clear the old files first, otherwise duplicate loading will occur.
  • Settings location: Starting with v1.9.0, settings are centralized under “Settings → Cost Statistics → gear icon in the upper-right corner”.

Ecosystem Background

The DSH philosophy is that “everything is a plugin”. This plugin is maintained by community developer Angelyeye under the MIT license.