cuttlefish520/dsh-token-meter0

@cuttlefish520/dsh-token-meter

Real-time, provider-agnostic token usage dashboard for DeepSeek Harness: draggable/resizable floating panel, sidebar toggle, and Ctrl/Cmd+Shift+M shortcut.

AI Analysis

核心用途是实时监控对话过程中的 Token 消耗。适合对 API 资费敏感、需要实时掌握生成开销的用户。需挂载在 host 组合中。

Package
@cuttlefish520/dsh-token-meter
Version
0.1.0
License
MIT
Last updated
Aug 15, 2026

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

@cuttlefish520/dsh-token-meter

DeepSeek Harness 的实时 Token 用量浮窗插件(供应商无关)。A real-time, provider-agnostic token usage dashboard for DeepSeek Harness — a draggable floating panel in the style of Claude Desktop.

功能 Features

  • 供应商无关:拦截 llm/stream 统一出口,任何走 Harness llm 服务的供应商(DeepSeek、OpenAI、Anthropic…)都会被统计;供应商返回官方 usage 时自动采用精确值,否则按字符数/4 估算。
  • 实时面板:流式输出 token 实时跳动(呼吸灯),每 1 秒刷新。
  • 统计卡:会话、消息、总 Token、活跃天数、当前/最长连续、高峰时段、最爱模型。
  • 分布:按供应商 / 按模型的 Token 条形图 + 最近调用列表。
  • 交互
    • 拖动位置(面板顶部标题栏)
    • 调整大小(右下角手柄,最小 260×200)
    • 最小化 / 展开(标题栏「—」/ 右上角胶囊)
    • 重置统计(标题栏「重置」)
    • 侧边栏底部常驻开关「⏱ Token 开/关」
    • 全局快捷键 Ctrl/Cmd + Shift + M 一键显示/隐藏(自动避开输入框)

包结构 Package layout

@cuttlefish520/dsh-token-meter
├── package.json          # dsh.client 声明 + exports["./client"]
├── lib/
│   ├── index.js          # host 半侧:token 计数 + HTTP 路由
│   └── client.js         # 浏览器 client bundle(window.__ModuleLoader__.load)
└── README.md

安装 Install

# 发布为 npm 包后:
npm install @cuttlefish520/dsh-token-meter

# 或本地 file: 安装(部署侧):
npm install /path/to/dsh-token-meter

挂载 Mount(必须挂在 host 组合)

⚠️ 必须挂在 host 组合base.cordis.yml / web.cordis.yml),不能挂在 agent preset:浏览器 client bundle 只会从 host loader 的条目中发现(dsh-client-modules 扫描 ctx.loader.entries(),preset 子树不在其中)。

在部署的 host 组合中加入一行:

# base.cordis.yml / web.cordis.yml
- id: token-meter-dashboard
  name: '@cuttlefish520/dsh-token-meter'

重启 Harness 后,浏览器端会自动发现并加载 ./client bundle(dsh.client 声明),右上角出现浮窗,侧边栏底部出现开关。

Host HTTP 路由

路由方法说明
/token-usage/stateGET返回 JSON 快照(live 调用 + 聚合统计 + 最近调用)
/token-usage/resetPOST清空内存统计

说明 Notes

  • 统计是进程内内存态:Harness 重启后清零。
  • 输出 token 在供应商不返回 usage 时按 字符数/4 估算,属于近似值。
  • 面板位置/大小是浏览器内存态,刷新页面回到默认(右上角 340px)。

License

MIT