Introduction

When developing agents with DeepSeek Harness (DSH), if model generation stutters, the UI often only shows “Deep Diving”, making it difficult to distinguish whether the model is processing or merely experiencing latency. The dsh-live-token-stats plugin uses real-time streaming data and the official tokenizer vocabulary to display a specific token status bar below the composer, helping developers determine whether the model is “drowning”.

Core Features

This plugin primarily addresses transparency in streaming output and provides the following capabilities:

  1. Real-time Tokenization and Calculation: Reads streaming responses in real time, uses DeepSeek BPE tokenization, and calculates tokens per second (TPS) and output token count in real time.
  2. Drowning Detection: Detects time to first token (TTFT) in real time to determine whether the model is drowning.
  3. Deviation Reconciliation: Compares local estimates with official usage deviations.
  4. Automatic Mounting: Automatically mounts as a bundle-layer plugin without requiring edits to DSH source code.

Installation and Enablement

Installing this plugin automatically mounts it as a bundle-layer plugin. Restart DSH web to take effect.

Install from GitHub:

dsh plugin --profile web add github:better-er/dsh-live-token-stats

Install from npm:

dsh plugin --profile web add dsh-live-token-stats

Typical Usage

Configure the following parameters in the profile’s cordis.yml or overlay:

  • enabled: Master switch; default is true.
  • tokenizerMode: Tokenization mode; default is 'bpe'.
  • 'bpe': Uses the built-in DeepSeek V4 vocabulary for real BPE splitting, which is closest to official usage.
  • 'density': Falls back to dual-density character estimation (requires configuring asciiTokenPerChar and cjkTokenPerChar).
  • rateWindowMs: Sliding window in milliseconds for real-time TPS; default is 3000.
  • debug: Toggle for diagnostic logs; default is false.

Configuration example:

- id: dsh-live-token-stats
  config:
    enabled: true
    tokenizerMode: bpe
    rateWindowMs: 3000
    debug: false

Applicable Scenarios and Notes

  • Dependency version: Requires dsh 0.1.5-rc.2 or higher.
  • Estimation deviation: Tool calls include additional charged message templates, so local estimates may be lower than actual values (measured approximately +40~60 tokens per tool call).
  • Installation mechanism: peerDependencies serves only as a compatibility gate and does not participate in local installation.
  • Source structure: Source code is in the src/ directory; build artifacts are in the lib/ directory.

The plugin provides transparent token-level monitoring for the DSH ecosystem. For more details and source code, refer to: Directory Page | GitHub.