az7627
dsh-token-usage
Per-conversation token usage timeline plugin for the dsh Web conversation view
- Stars
- 1
- Language
- TypeScript
- Created
- Aug 15, 2026
- Updated
- Aug 15, 2026
Introduction
dsh-token-usage
DeepSeek Harness 插件:在 Web 对话视图统计 token 用量(分时段堆叠柱状图 + 精确到个位的总计)。
- 会话头右缘「用量统计」按钮 → 右侧抽屉
- 对话多选(默认当前对话 / 全选 / 仅当前)
- 分度:15 分钟 / 1 小时 / 1 天;范围:近 7 天 / 近 30 天 / 全部
- 三桶:缓存输入(
cacheReadTokens)、输入(inputTokens + cacheWriteTokens)、输出(outputTokens) - ECharts 堆叠柱状图(本地时区日历对齐)、精确到个位的 tooltip、总计与每对话明细
- 数据来自会话日志重放(
/usageRPC 通道),历史对话装上即有数据
安装到你的 dsh(npx 版)
# 首次安装(会把它挂进 ~/.dsh/profiles/web 的 bundle 列表)
npx @deepseek-ai/dsh plugin --profile web add <本目录的绝对路径>
# 重启你的 dsh web 后生效
npx @deepseek-ai/dsh web
更新
# 在本目录重新构建
pnpm install
pnpm run build
# 因为是 link 安装,重启 dsh web 即生效;如换成 file 安装需重跑 add
npx @deepseek-ai/dsh plugin --profile web add <本目录的绝对路径>
卸载
npx @deepseek-ai/dsh plugin --profile web remove dsh-token-usage
开发
pnpm install # 依赖(zod 运行期;echarts 打进浏览器 bundle)
pnpm run build # tsc + tsdown → lib/index.js(宿主半)+ lib/client.js(浏览器半)
pnpm test # vitest(组件测试 mock 了 echarts)
类型检查依赖同目录下 deepseek-harness 源码树里已构建的 lib/types(仅编译期引用,运行期全部由 dsh 安装提供)。