1148281964/dsh-token-stats1

dsh-token-stats

Global token usage statistics for the DeepSeek Harness: real llm/stream usage collection, durable JSONL ledger, per-provider/model/session/day aggregation, cost estimation with OpenRouter price refresh, a draggable FAB panel, a centered detail dashboard, and a token_stats model tool.

AI 분석

适合成本与用量监控场景,适用于关注会话/周期开销的用户。需允许账本目录与价格源。

패키지
dsh-token-stats
버전
0.6.1
라이선스
MIT
최근 업데이트
2026. 8. 15.

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:1148281964/dsh-token-stats

使用

  • FAB 悬浮球(右下角):点击展开面板,可拖动;面板右上角「⛶」打开居中大屏弹窗;「全局 | 当前会话」切换统计范围
  • 设置页:设置 → Token 统计,包含同样的面板与大屏弹窗入口
  • 大屏弹窗:「↻ 更新价格」从 OpenRouter 拉取最新模型价格并重算全部历史费用;KPI、环形图、趋势(当月/近31天)、表格、明细
  • 模型工具:对话中调用 token_stats{"sessionId": "..."} 可选)

配置

环境变量说明
DSH_TOKEN_STATS_DIR账本目录覆盖(默认 `
/data/token-stats/`)
DSH_TOKEN_STATS_PRICES价格覆盖 JSON:{"": {"input":0.27,"cacheRead":0.07,"cacheWrite":0.27,"output":1.1}}(USD/1M tokens)

价格表默认值来自 OpenRouter 公开模型列表(查询日期见 lib/index.js 注释),可通过面板按钮或环境变量校正。