1841220388zzzcccxxx-star/dsh-token-stats
Token usage & cost statistics plugin for DeepSeek Harness — per model / date / session, cost estimation (USD/CNY), CSV/JSON export | DeepSeek Harness Token 用量统计插件:按模型/日期/会话统计用量与费用,支持 CSV/JSON 导出
Install
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
Add 1841220388zzzcccxxx-star/dsh-token-stats to your DSH config (web profile) to enable.
README
Expand full README Collapse
README is empty.
tt-a1i/archify
strukto-ai/mirage
liustack/modlens
omdsh-dev/DSH-better-sidebar
GanyuanRan/Aegis
dsh-market/dsh-market
toby-bridges/api-relay-audit
ysr666/dsh-vision-router