@deepseek-ai/dsh-token-stats
DSH 跨会话 Token 消耗统计与报告工具插件
AI 分析
提供面向模型的 token_report 工具及 CLI 命令行,支持按天、月、模型汇总消耗。适合需要跨会话审计 Token 成本的用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:QEDQCD/dsh-token-stats说明文档
阅读完整 README ↗使用
命令行(一键查看,无需 DSH 运行时)
dsh-token-report # 今日 + 本月 + 全部汇总
dsh-token-report --by day # 按天明细
dsh-token-report --by month # 按月明细
dsh-token-report --model deepseek # 按模型过滤
dsh-token-report --since 2026-08-01
dsh-token-report --json # 机器可读 JSON
安装时自动在 ~/.local/bin/ 创建 dsh-token-report 符号链接。也可直接用:
node scripts/token-report.mjs --by day
模型侧(在 DSH 会话中)
token_report()
token_report(period: "day")
token_report(period: "month", model: "deepseek-chat")
token_report(period: "week", since: "2026-08-01")
预期输出(工具返回的文本表格):
Token Usage Report · 2026-08-17 10:30:00
Period: month · Timezone: local
Period Sessions Input CacheRead Hit% Output Total
--------------------------------------------------------------------------------
2026-08 12 456,789 234,567 33.9% 56,789 748,145
--------------------------------------------------------------------------------
TOTAL 12 456,789 234,567 33.9% 56,789 748,145
配置
token-stats 插件可通过 cordis 配置调整:
| 字段 | 默认 | 含义 |
|---|---|---|
logPath | ~/.dsh/token_usage.jsonl | token 用量日志文件路径 |
maxRecords | 0(无限制) | 最大保留记录数;超出时最旧记录被驱逐(待实现) |