Introduction

DeepSeek Harness (DSH) is a client framework. When used locally, tracking the exact cost of each conversation and context compression requires manual calculation or reliance on third-party tools. The dsh-cost-stats plugin directly leverages DSH’s internal routing to display a cost capsule next to messages and provide detailed cost statistics logs on the settings page.

Core Features

  • Cost capsule next to messages: Displays a cost capsule (¥/$) next to each assistant message.
  • Tier-by-tier details: Click the capsule to view tier-level details, including model, time period, cache hit rate, token count, and unit price.
  • Session total: Displays the cumulative cost for the current session.
  • Settings page “Cost Statistics”: Lists each billing item (reply + context compression), with support for date/month filtering and pagination.
  • Data source: Shares the same data source as the official “Usage” popup, using provider-reported token tiers.
  • Official pricing table: Uses the officially published CNY/USD price list, including billing attribution for legacy model names.
  • Time-of-day awareness: Supports peak/off-peak time-period awareness.
  • Model filtering: Supports filtering billing items by model.
  • Balance query: Supports balance inquiry.
  • Privacy and security: Does not read credentials, does not access external networks (except for balance queries), and does not modify the DSH core.
  • Multilingual: Supports Chinese and English.

Installation and Activation

Install:

dsh plugin --profile web add dsh-cost-stats@latest

Enable:
1. Restart dsh web.
2. Hard refresh the page in your browser (Ctrl/Cmd + Shift + R).

Supported DSH versions:
0.1.5-rc.2 / 0.1.7-rc.2 / 0.2.0-rc.2

Notes

  • Missing data handling: If there is no official price list for that turn or the routing attribution cannot be obtained, the capsule is not displayed. If official data is missing (retry failed), the cost is recalculated using host-side logs and marked as “recalculated from logs”.
  • Key security: The key is only used locally on the host side; it is not saved, not written to files, and not committed to repositories. The only external network request is the balance query.
  • Updates and restarts: After code changes, client-side changes require a hard refresh, while host-side changes require restarting dsh web.
  • Package name identification: An older similarly named package, dsh-session-cost, exists on npm; make sure to use dsh-cost-stats.

References