DeepSeek Harness (DSH) offers a rich plugin ecosystem. During model inference, cost monitoring is a must-have. Existing approaches often rely on third-party tools or manual calculations. The dsh-token-billing plugin introduced below displays billing readings directly below the input box in the Web UI.

Plugin Overview

This is a token billing plugin for DeepSeek Harness, maintained by jianzhexu. Its core purpose is to track the cost of each model call and display total session and workspace costs based on DeepSeek’s official pricing.

Core Features

  • Cost Statistics: Displays the total cost for the current session and its associated workspace.
  • Time-Based Pricing: Differentiates between peak and off-peak prices. Peak hours are 9:00–12:00 and 14:00–18:00 Beijing Time, and the off-peak price is half of the peak price.
  • Data Persistence: The billing ledger is stored in the token_billing storage domain, so the data remains after a restart.
  • Hover Details: Hovering over the billing row reveals session/global costs, token usage, per-model statistics, the workspace list, and the pricing table.

Installation and Activation

Before installing, make sure you are using a profile that includes the Web application (for example, dsh --profile web). The installation command is as follows:

dsh plugin --profile <name> add github:jianzhexu/dsh-token-billing

Installation also activates the plugin. The plugin is mounted through the bundle’s own patch layer, so there is no need to manually edit configuration files.

Usage and Configuration

View the billing readings in the Web UI. To override the configuration or disable the billing row, locate the row ID token-billing in the profile’s cordis.patch.yml.

Notes

  • Runtime Permissions: The plugin runs with the permissions of the current DSH process.
  • Source Code Review: Check the source code and license before installation.
  • Pricing Rules: Models not listed on the pricing page are not billed.
  • Build Dependencies: The plugin is pure JavaScript and requires no build step; installation from Git does not require allowBuilds to be built with pnpm.