Back to home

hyl64

dsh-usage-stats

No description

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-usage-stats

A local plugin for DeepSeek Harness that aggregates token usage and estimated cost across all of your sessions, broken down by day, week, model/provider, workspace, and session.

It scans the per-session logs directly and is fully local and offline — no network calls, no telemetry, nothing sent anywhere.

Community project, not affiliated with DeepSeek. DSH is in developer preview and may change; this targets 0.1.0-rc.6 (and later rc.6-based releases).

What it gives you

A single model-facing tool, usage_stats, returns a table like:

### By day         in           cr          cw        out     total     cost
2026-08-14   in= 12,509,564 cr=856,513,536 cw=0 out= 2,246,292  tot=871,269,392  cost=$13.67
### By model
opencode-go/deepseek-v4-flash ... cost=$6.67
yes/deepseek-v4-pro             ... cost=$1.58
### By workspace  /  ### By session (top 8)

Fields: in (uncached input), cr (cache read), cw (cache write), out (output). Cost is an estimate from a configurable price table (default: DeepSeek API list prices per 1M tokens).

Install

Clone or copy this repo, then place it on your DSH profile patch. Add one row to cordis.patch.yml under the profile's - insert: list:

- id: dsh-usage-stats
  name: './dsh-usage-stats/lib/index.mjs'

Restart DeepSeek Harness (dsh web). In a new session the model can call usage_stats.

Prerequisites

  • Node.js with zstd on PATH (apt install zstd on Debian/Ubuntu).

Configuration

Price overrides (USD per 1M tokens) go in the plugin config: — keys match the model name or its provider/model form, or fall back by the model suffix:

- id: dsh-usage-stats
  name: './dsh-usage-stats/lib/index.mjs'
  config:
    costs:
      'my-gateway/deepseek-v4-flash': { input: 0.15, cacheRead: 0.005, output: 0.45 }

If a model has no entry it falls back to the model suffix, then to unknown.

License

MIT.