dsh-usage-dash-board: View local usage and estimated costs in DSH settings

Introduction

DeepSeek Harness (DSH) provides token details for each conversation round, but lacks a cross-session summary view. To track consumption, request counts, and cache hit rates over the long term, a common practice is to install external tools like cc-switch. These tools parse local session logs for statistics, adding an extra desktop application that requires maintenance to keep up with changes in DSH log formats.

Below is an introduction to the community plugin dsh-usage-dash-board (maintainer sixzjd). It displays token consumption, total request counts, cache hit rates, and daily trends in a native section within DSH Settings → Usage Statistics. All data is derived from local session logs; it does not connect to the internet, upload data, or require an API Key.

What is this

dsh-usage-dash-board is a client-side plugin for DSH (currently 0 GitHub stars, version 0.4.2, MIT license). It consumes the host-exposed ctx.sessionQuery service: DSH handles the decompression, sorting, and interruption round balancing of session logs. The plugin only processes structured events without performing file parsing or format guessing, so it does not depend on whether DSH changes the layout under $DSH_HOME/sessions.

It is classified as “client-side”: the browser half mounts in the settings.section slot of the settings page; the host half handles scanning, aggregation, persistence, and HTTP routing.

Data Source and Calculation

Processing Pipeline

durable session log
      │  ctx.sessionQuery.listSessions() / readSession()
      ▼
  Event Stream (decompressed, sorted)
      │  assistant/message.usage  ▸ Overwrites assistant/chunk in the same turn
      │  request/header / request/context  ▸ Model and provider identification
      ▼
  Collapsed into "single invocation" by (session, turn, step)
      │  Local calendar day bucketing
      ▼
  Daily aggregation / Model aggregation / Interval summary + Price list billing
      │  GET /api/dsh-usage-dash-board/summary
      ▼
  Settings page native section (settings.section slot)

Usage is counted only once per invocation: within the same turn:step, the final usage from assistant/message replaces the streaming assistant/chunk rather than adding to it; all-zero replay events will not overwrite recorded real numbers.

Metric Definitions

The token bucket follows the host @deepseek-ai/dsh-llm DISJOINT semantics: inputTokens contains only uncached input, while the cached portion is in cacheReadTokens / cacheWriteTokens.

Metric Calculation Method
Consumed Tokens Input + Output + Cache Write + Cache Read
Total Requests Number of invocations carrying usage (deduplicated by session:turn:step)
Cache Hit Rate Cache Read ÷ (Input + Cache Write + Cache Read)

When OpenAI-style protocols do not report cacheWriteTokens, this item is always 0, and the denominator for the hit rate does not include it either. This is due to missing upstream fields rather than a statistical omission.

Key Features

Panel capabilities are subject to the README and mainly include:

Area Content
Top Three Cards Consumed tokens, total requests, cache hit rate; click to view component details
Usage Trends Bar chart, switchable between Tokens / Requests; default by day, automatically by hour when “Today” or a custom range with the same start and end date is selected
Filters Provider, model, time range (Today / Last 7 / 30 / 90 days / All time / Custom); defaults to last 30 days when opened
Request Details Time, provider, model, tokens, and cost for each invocation
Provider / Model Grouped aggregation and share
Pricing Editable price list, calculating four price buckets based on USD / million tokens

The X-axis of the trend chart is padded by calendar days (or 24 time slots for the hourly view), and dates with no data are displayed as 0. The start point for “All Time” is the actual earliest record; if there are no records, it defaults to “Today” and is still displayed by day. The fetch time is marked below the title (e.g., · Data updated at 15:27:45); the panel does not auto-refresh and updates only when filters are changed or “Refresh” is clicked.

It includes DeepSeek’s official peak/off-peak pricing (including off-peak pricing all day on Chinese statutory holidays), such as the input/output/cache read unit prices for deepseek-v4-flash and deepseek-v4-pro; peak hours are UTC 01:00–04:00 and 06:00–10:00 (corresponding to Beijing Time workday morning and afternoon peak segments, excluding statutory holidays). Models without public unit prices are marked as “Unpriced”, and prices can be manually added in “Pricing”.

Installation and Activation

The package has not yet been published to npm; the installation command is subject to the repository README:

dsh plugin --profile web add github:sixzjd/dsh-usage-dash-board

Once published, the README instructions allow switching to:

dsh plugin --profile web add dsh-usage-dash-board

Refresh the browser page after installation. The plugin is compatible with DSH >=0.2.0-rc.2 <0.3.0 (see dsh.compatibility in package.json).

Uninstallation:

dsh plugin --profile web remove dsh-usage-dash-board

Typical Usage

  1. Install the plugin for the web profile using the command above and refresh the page.
  2. Open DSH Settings and go to Usage Statistics.
  3. Use the top filters to select provider, model, and time range; check “Request Details” when you need to verify a single invocation.
  4. If the estimated cost does not match official prices, edit the price list in “Pricing” (saving goes through a protected write interface requiring a process token).
  5. When programmatic verification of summaries is needed, you can request the host-registered GET /api/dsh-usage-dash-board/summary (accessible via loopback address only; the response does not contain prompts or reply content).

Some providers expose models using route aliases (e.g., Qoder’s qfmodel). The plugin may read the model discovery cache from dsh-qoder-connect located at $DSH_HOME/profiles/*/.dsh-qoder-connect/state/*-catalog.json, used only for display names; grouping, counting, filtering, and billing still use the route ID. You can determine if aliases were resolved via catalog.aliasCount in the summary response.

Use Cases and Caveats

Who it is for: Users who run agents in the DSH web client long-term and wish to aggregate tokens, request counts, and cache hit rates locally for estimated costs, without relying on external log parsing tools.

Runtime Boundaries: The plugin runs with the current DSH process privileges. It reads all listed sessions via ctx.sessionQuery (not limited to registered workspaces) and persists price lists in $DSH_HOME/storages. You should review the GitHub source code and the MIT license before installation.

Important Limitations (excerpted from README):

  • Costs are estimates based on built-in/manual price lists, not equal to provider bills.
  • For routes billed by credits (like Qoder), applying USD unit prices is just an “equivalent API price,” not the actual payment amount; the plugin only performs name resolution and does not automatically fill prices for aliases.
  • If an upstream is interrupted and the final assistant/message is missing, only chunk usage may be retained; if there are no usage events at all, tokens cannot be accurately restored.
  • Without request/header / request/context, the session model will be displayed as unknown.
  • The panel body is currently in Chinese, while sidebar labels follow the browser language.

The HTTP interface is restricted to loopback addresses and rejects cross-site Sec-Fetch-Site; writing prices requires a process token; responses contain only usage numbers, model identifiers, and session UUIDs, excluding prompts, titles, or workspace paths.

Conclusion

dsh-usage-dash-board brings cross-session usage statistics into the DSH settings page: based on the public sessionQuery seam, it aggregates locally with optional pricing and does not depend on external networks. Community directory page: skillhub.cn/plugins/sixzjd/dsh-usage-dash-board; Source code and full documentation: github.com/sixzjd/dsh-usage-dash-board.

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

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

Xiaoye