lovedheart/dsh-plugin-token-usage

lovedheart★ 1JavaScript最后同步: 2026-08-20

在 GitHub 打开

DSH plugin for cross-session token usage statistics (/usage command + Web GUI Token 用量 panel)

README 摘要

dsh-plugin-token-usage QwenPaw-style cross-session token usage statistics for DSH. The plugin aggregates the provider-reported token usage of every model call across all persisted sessions (including subagent sessions) into (date, provider, model) buckets and serves them through a single /usage command. - Zero runtime dependencies — only the Cordis ctx API and Node 22's built-in node:zlib (zstd) are used. - Durable source of truth — it reads the session logs under /.dsh/sessions , so it works on history that predates the plugin and needs no separate bookkeeping at write time. - No double counting — a committed assistant/message.usage wins; a step that never produced a message (failure) falls back to its last streaming usage chunk, flushed at turn/end . A persisted per-file watermark ( {hiSeq, framesIngested} ) makes the incremental scan idempotent across restarts and crash-recovery re-encodes. Command Example output: Token units: 1.2M for = 1,000,000 (million), 1.5B for = 1,000,000,000 (billion), plain integer below (one decimal, trailing .0 dropped). Config key default description defaultDays 30 lookback window for a bare /usage . backfillIntervalSec 30 seconds between incremental…

在 GitHub 查看完整 README →
工具/开发deepseek-harnessdsh-pluginpluginqwenpawtoken-usageagent

分类