dsh-usage-stats
其他 活跃维护

dsh-usage-stats

hyl64/dsh-usage-stats

本地轻量统计插件,自动聚合全会话Token使用量与预估费用,数据本地处理无需上传,安装后即可实时查看用量明细。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
6 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:hyl64/dsh-usage-stats
git clone https://github.com/hyl64/dsh-usage-stats.git
git clone git@github.com:hyl64/dsh-usage-stats.git
README.md main

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.