1841220388zzzcccxxx-star/dsh-token-stats

插件 ⭐ 2 MIT data

DeepSeek Harness 的令牌使用与成本统计插件——按模型/日期/会话统计,成本估算(美元/人民币),CSV/JSON 导出 | DeepSeek Harness 令牌用量统计插件:按模型/日期/会话统计用量与费用,支持 CSV/JSON 导出

catalog 简介:Token usage & cost statistics plugin for DeepSeek Harness — per model / date / session, cost estimation (USD/CNY), CSV/JSON export | DeepSeek Harness Token 用量统计插件:按模型/日期/会话统计用量与费用,支持 CSV/JSON 导出

安装

3. `cd ~/.dsh/profiles/web && pnpm install`
4. Restart DSH web. Open **Settings → 📊 Token Stats**.

> `cordis.patch.yml` declares the bundle-layer mount point so the plugin auto-loads at startup.

## How it works

- **Authoritative data** = DSH persisted session logs: `assistant/message` events carry real `usage`
  (input / output / cache-read / cache-write / reasoning tokens), `request/header` events carry provider/model.
- A one-shot backfill at startup (`sessionQuery`) rebuilds the in-memory aggregation index from all history
  (bounded concurrency).
- `llm/stream` usage chunks are captured for live (display-only) in-flight totals.
- When an adapter reports no usage, `tokenMeter.estimateMessage` is used and the record is flagged `estimated`.

## HTTP API (`/token-stats/api`)

| op | description |
| --- | --- |
| `summary` | today / week / month / total aggregates |
| `query` | time series (day/week/month) + per-model / per-session aggregates; filters: `model`, `sessionId`, `from`, `to` |
| `models` | built-in pricing table (USD per 1M tokens) + USD→CNY rate |
| `sessions` | session list (`id` + `title`) |
| `export` | CSV / JSON dump (`format=csv\|json`, optional `model` / `sessionId`) |

## Development

1841220388zzzcccxxx-star/dsh-token-stats 加入你的 DSH 配置(web profile)即可启用。

README

展开完整 README 收起

README 内容为空。