hyl64/dsh-usage-stats0

dsh-usage-stats

DSH 用量统计插件:本地扫描会话日志,按天、周、模型、工作区和会话聚合统计 Token 消耗并估算成本。

AI 分析

核心用途是完全本地化、离线地统计 DSH 历史账单。适合关注长期 API 消耗趋势,且对隐私要求极高、不希望数据联网的用户。

包名
dsh-usage-stats
版本
0.1.0
许可证
MIT
最近更新
2026年8月15日

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗

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.

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.