dsh-meter: DeepSeek Harness Per-session Billing Plugin

DeepSeek Harness adopts a plugin-based architecture, allowing functionality to be extended via plugins. dsh-meter is a plugin focused on session-level cost monitoring and billing. It displays current session token usage and costs in the top-right corner of each session and provides price configuration capabilities, solving the problem of difficulty in quantifying costs during long conversations or development processes.

Core Features

Session Header Entry
There is a persistent cost badge in the top-right corner of each session, displaying the current session cost and peak/idle status. If the model used in the session has no configured price, the badge displays an amber “Price Unregistered” tag. A status label appears next to the badge: red “Peak” if currently in peak hours, otherwise gray “Idle”. Judgment is based on the provider’s timezone (default Beijing time).

Statistics Card
Hovering or clicking the badge expands a statistics card. The card displays detailed usage for the current session: cached hit and miss token counts, cache write status, and output token count. Costs are displayed side-by-side by currency. The card also includes a context usage bar with compression predictions, and mini-charts showing token usage changes per turn. Derived sub-agents and their costs are listed at the bottom of the card. Status dots (solid green dot, spinning ring, neutral dot) reuse the official StateDot component to reflect the running status of sub-agents.

Round-by-Round Consumption Details Panel
Provides “By Turn” (merging tool call steps) and “By Request” views. Switching views changes the granularity of the charts and tables. The cost bar chart and four-segment token stacked chart display consumption per turn. The detail table is arranged in reverse chronological order by turn and supports collapsing.

Setup and Pricing Logic
The price table can be edited via the GUI settings page (plugin configuration page). Supports tiered pricing (by request length) and peak hour awareness (configurable multiple peak windows and effective weekdays). Includes a built-in statutory holiday calendar; if the current day is a holiday, peak pricing is not triggered. The pricing core supports attributing time slots by request time, determining tiers by request length, and separate pricing for cache miss/hit/write.

Installation and Enablement

Source Directory Installation (Recommended)
The current source code line (0.3.3x) has not been published to npm. It is recommended to install using the source directory method:

npx @deepseek-ai/dsh plugin --profile web add ./dsh-meter

Package Installation
The dsh-meter on npm is stuck at version 0.3.18. When running hosts 0.2.x and newer, the pre-install peer validation will directly refuse installation. The npm version 0.3.18 can only be installed on hosts running the 0.1.7 line (0.1.7-rc.2 ~ 0.1.7.x):

npx @deepseek-ai/dsh plugin --profile web add dsh-meter@0.3.18

After installation is complete, restart the GUI or host to enable it.

Configuring Pricing

Pricing via Configuration File
You can also use a configuration file to maintain the price table, and Agents can generate the configuration directly based on this. The default path is $DSH_HOME/dsh-meter/prices.yaml (if DSH_HOME is not set, it defaults to ~/.dsh/dsh-meter/prices.yaml).

# Validate price configuration
node scripts/check-prices.mjs
# Or specify a file
node scripts/check-prices.mjs my-prices.yaml

The unit is Yuan/Million tokens. Priority order: Explicit Configuration > Price File > Built-in Default.

Migration and Maintenance

The plugin is a standalone package. When migrating to another machine, simply copy the dsh-meter/ directory (without node_modules/) or the .tgz file over and re-run the installation command.

After migration, be sure to reinstall once to ensure the profile configuration is updated correctly. Prices are stored as integers (1/100000 units) with no floating-point errors.

Notes

  • Version Compatibility: The dsh-meter on npm is stuck at 0.3.18, with a peer range of ^0.1.0-rc.7. When running hosts 0.2.x and newer, peer validation will refuse installation.
  • License: No explicit license information was found in the materials.
  • Precision: Prices are stored as high-precision integers and displayed with two decimal places.

dsh-meter

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye