dsh-token-meter-panel: DeepSeek Harness Token Usage and Cost Panel Plugin

The DSH (DeepSeek Harness) client records the Token usage for each invocation, but the kernel does not contain billing logic. The dsh-token-meter-panel plugin converts usage into cost data, adding an independent panel to the sidebar to display today’s consumption, budget progress, cost composition, and savings from cache hits.

Plugin Positioning

  • Type: Community plugin (not officially by DeepSeek).
  • Author: olimc2016.
  • Positioning: A Token statistics panel plugin within the DSH ecosystem that meets the criteria of “DSH 0.2.x compatibility, zero external dependencies, peak-valley pricing, and account balance”.

Core Features

The plugin primarily provides the following data dimensions:

  1. Official Usage (30 Days, Login-Free)
    Directly reads DSH account sessions, allowing you to view daily trends, usage by model, and request counts without requiring a browser login or API Key.

  2. Financial Data

    • Today’s Consumption: Large font display of the amount, budget progress bar, and comparison with the previous record.
    • Account Balance / Cumulative Consumption: Balance supports DeepSeek account login or API Key; cumulative consumption requires querying via the official API, without needing a web login.
  3. Visualization Panel

    • Quad-grid: Cache hit input, cache miss input, output Token counts, and call counts.
    • Daily Trend: Stacked bar charts for the last 7 or 30 days, supporting hover for details.
    • Today’s Hourly Distribution: 24-hour Token distribution with peak values marked.
    • Cost Composition: Spending proportion of the three Token types, plus “Today’s cost without cache”.
  4. Session Details

    • By Session: Tokens, call counts, and consumption for each session today; sub-agent sessions are specially marked.
    • Real-time Current Session: Real-time usage projection of the current conversation.

Billing Logic and Pricing

The plugin incorporates official DeepSeek pricing (collected from the official pricing page) and supports peak-valley tiered pricing.

  1. Tiered Pricing

    • Peak Hours: 9:00–12:00 and 14:00–18:00, Monday to Friday.
    • Off-Peak Hours: Half the peak price.
    • Note: The plugin currently does not recognize statutory holidays.
  2. Cache Pricing
    The price for cache-hit input is approximately 1/50 of the cache-miss input price. This is a key cost-saving metric highlighted by the panel.

  3. Special Pricing Rules

    • reasoningTokens are included in outputTokens and are not billed separately.
    • Unknown models do not undergo price estimation; only Token counts are accumulated.
    • Session title generation and web search calls do not record in usage and cannot be included in costs.

Installation and Activation

Installation Command

Use the official installation command specifying version v0.6.0:

dsh plugin --profile desktop add github:olimc2016/dsh-token-meter-panel#v0.6.0

Dual Package Name Mechanism

The plugin is released under two package names with identical code; installing either one is sufficient:
- Primary Package: dsh-token-meter-panel
- Short Name Twin Package: dsh-token-mb (Recommended for new users as the primary package has ceased publishing new versions on npm)

Since the slots and route prefixes are independent, installing both package names simultaneously will not cause conflicts, resulting in two “Token” panels appearing in the sidebar.

Activation and Configuration

  1. You must restart DSH Desktop after installation for it to take effect.
  2. Zero Configuration: After restarting, a “Token” dashboard icon will appear at the bottom of the sidebar.
    • Balance: The plugin automatically reads the browser login state (Local Storage) without requiring manual API Key configuration.
    • Multi-frame zstd Decoding: Comes with its own decoding logic, no need to install system-level zstd or zstdcat.
  3. Settings: You can adjust rates, refresh intervals, alert thresholds, and balance display visibility in Settings → Plugins → dsh-token-meter-panel.

Data Sources and Notes

Data Sources

  • Full Log Aggregation: Reads local session logs (session.v3.jsonl.zstd) and aggregates them by Beijing time buckets.
  • Official Projection: Real-time usage of the current session comes from DSH’s useProjection('tokenUsage').
  • Official Usage: Obtains 30-day usage by reading the official userToken via the browser login state.

Notes

  1. Local Estimation: The amounts shown in the panel are local estimates, not official invoices. Prices may change, so please refer to the official page.
  2. Permission Boundaries: The plugin only reads session logs; it does not write files, execute commands, or access the network (except for balance queries, which can be disabled).
  3. Data Blind Spots:
    • Session title generation and web search calls are not recorded in usage.
    • Active sessions are still being appended to, so “Today’s” data is a lower bound.
  4. Version Requirement: Compatible only with DSH 0.2.x.
羽毛球分组比赛记分
小程序二维码

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

Xiaoye