Introduction

When developing with DeepSeek Harness (DSH) or using it for everyday conversations, tracking same-day token consumption and cost is essential. Manual counting is inefficient and error-prone. This plugin reads DSH’s own session logs and provides a real-time summary in the bottom-right corner of the Web interface.

Plugin Scope

This is a daily usage report widget for the DSH Web interface. It stays in the bottom-right corner, automatically aggregates same-day token consumption, message count, and turn count for each session, and estimates cost using DeepSeek pricing. The plugin is maintained by HaoR325 under the MIT license.

Key Features

  • Daily Usage Summary: Displays input, output, cached tokens, message count, turn count, and estimated cost.
  • Auto Refresh and Caching: Supports 60-second auto-refresh. A server-side caching mechanism prevents UI spam and avoids unnecessary API load.
  • Cost Estimation: Uses DeepSeek’s default prices. Unit prices can be overridden via environment variables.
  • Floating Widget UI: Displays a semi-transparent card in the bottom-right corner, with NaN-safe handling and immediate use after refresh.
  • HTTP API: Provides the GET /api/dsh-usage-daily/report endpoint, returning aggregated JSON for the current day, convenient for secondary development.

Installation and Activation

Install via a local link to avoid reliance on network repositories.

dsh plugin --profile web add link:<absolute path to this repository>

After installation, restart dsh web, press F5 in the browser to refresh, and the daily usage report widget will appear in the bottom-right corner.

Environment Variable Configuration

By default, the plugin calculates cost using DeepSeek’s official pricing. If adjustment is needed, override it via environment variables. Units are USD / million tokens.

Variable Default Value
DSH_USAGE_INPUT_PER_M 0.27
DSH_USAGE_OUTPUT_PER_M 1.10
DSH_USAGE_CACHE_READ_PER_M 0.07
DSH_USAGE_CACHE_WRITE_PER_M 0.27

API Reference

The plugin registers an HTTP endpoint via webServer for data retrieval.

Endpoint:

GET /api/dsh-usage-daily/report

Example Response:

{
  "ok": true,
  "date": "2026-01-01",
  "sessions": 3,
  "messages": 41,
  "turns": 12,
  "totals": { "input": 12345, "output": 6789, "cacheRead": 0, "cacheWrite": 0 },
  "totalTokens": 19134,
  "costUsd": 0.0087,
  "perSession": [
    { "id": "session-1", "messages": 20, "turns": 8, "tokens": 12345 }
  ]
}

Technical Details

  • Data Source: Data comes directly from DSH’s own session logs (sessionQuery.readSession). No token or platform billing API is required.
  • Tech Stack: Pure Node ESM with no external dependencies.
  • Implementation: Injects the bottom-right widget script via tapIndex, and uses sessionQuery.listSessions / readSession to aggregate same-day events.

Summary

This plugin uses server-side caching and local log reading to accurately monitor daily DSH consumption, making it suitable for agent developers who need to control costs. For more details, see the ecosystem directory or the GitHub repository.