jiamuAi/dsh-token-usage 预览 preview

jiamuAi/dsh-token-usage

Plugin插件 Native原生 ⭐ 3 MIT Usage & Cost用量与计费Data & Analysis数据与分析

DSH Token用量统计面板(Codex风格):全实例Token消耗汇总+活动热力图。

Project Overview项目介绍

This plugin is built specifically for DeepSeek Harness (DSH), adding a dedicated Token usage statistics panel to DSH's native web interface. It tracks total Token consumption across all sessions for a running DSH instance, displaying multiple key metrics and visualizations to help users clearly see how their Tokens are being used. To install, users can simply send a single command to their DSH Agent, which will automatically read the repository description, clone the code, and set up the plugin. Users can also choose to manually install it by cloning the repository directly to DSH's local extensions folder, then add the plugin to DSH's bundle list and restart the DSH web service.

After installation completes, users will find a new "Token Stats" entry added to the bottom of DSH's native left sidebar. When opening any existing conversation session, a small real-time usage capsule button will appear right next to the conversation title. Clicking either entry opens the main interactive statistics panel, which supports toggling between light and dark themes matching DSH's native system style. Data for the panel refreshes automatically every five seconds, and all historical usage data is preserved across DSH restarts so users never lose their long-term usage tracking. The interface mimics the familiar usage page style from Codex, so Codex users will have no extra learning curve to use this plugin.

This plugin is released under the permissive MIT open source license, and its usage counting aligns exactly with DSH's built-in token-meter tool. For regular end users, pre-built compiled assets are already included in the lib directory, so no extra build steps are required after installation, and the plugin works out of the box right after DSH restarts. If you want to modify the source code or add new features, you will need to use DSH's native compilation tools to build the updated assets, then commit the new build output back to your working repository. The counting method includes all Token usage from input, output, cache reads, and cache writes, matching DSH's internal calculation standards.

这是专为DeepSeek Harness(DSH)开发的原生插件,提供仿Codex风格的Token用量统计面板,为DSH的Web界面新增专用入口,统计当前DSH实例下全部会话的Token总消耗量,清晰展示五大核心指标、活动热力图以及高频插件排行。支持通过给DSH Agent发送指令一键安装,也可手动克隆代码仓库到扩展目录完成安装。

安装完成后,用户可在DSH左侧边栏底部找到「Token统计」入口,任意打开会话后,标题旁还会显示实时用量胶囊按钮,点击任意入口即可打开统计面板,面板支持深色/浅色双主题切换,数据每5秒自动刷新,重启后历史数据不会丢失。对熟悉Codex的用户来说,界面风格符合原有使用习惯,几乎没有额外学习成本,能快速上手查看用量。

插件遵循MIT开源协议,数据统计口径与DSH内置的token-meter保持一致,累计Token包含输入、输出、缓存读写的用量总和,一般用户不需要额外构建,预编译产物已经放在lib目录,开箱可用。开发修改代码需要依赖DSH内置的编译工具,完成后同步产物到仓库即可。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:jiamuAi/dsh-token-usage

把 jiamuAi/dsh-token-usage 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-token-usage

中文 · English

DSH 的 Token 用量统计面板 —— 仿 Codex 个人用量页风格,把整个 DSH 实例的 Token 消耗一目了然地展示出来:累计 / 单会话峰值、活动热力图、插件 Top5。

License DSH Plugin Status

这是什么

DSH 刚发布,大家最关心的就是:我的 Token 到底花哪去了?

这个插件在 DSH Web 界面里加一个 Token 用量统计面板,把当前运行实例全部会话的 token 消耗汇总,点击入口即弹出居中面板(深色 / 浅色主题):

面板(浅色主题) 面板(深色主题)

特性

  • 5 大指标:累计 / 单会话峰值 Token、最长聊天时长、当前 / 最长连续天数
  • Token 活动热力图:每日(GitHub 贡献图)/ 每周(柱状)/ 累计(折线)三视图,悬浮看数值
  • 活动洞察(含最常用模型)+ 插件 / Skill Top5:谁在消耗最多,一目了然
  • 两个原生入口,与 DSH UI 融为一体:
    • 侧边栏底部「Token 统计」按钮(应用级常驻)
    • 会话头部实时用量胶囊:⚡ 2.61亿(每 5 秒自动刷新)
  • 深空紫双主题,跟随系统 / 手动切换

入口位置:侧边栏底部按钮 + 会话头部 ⚡ 胶囊

为什么值得装

  • 一眼看清 Token 去向:累计、单会话峰值、每日热力图,不用再猜
  • Codex 用户零学习成本:熟悉的用量页风格,界面一看就懂
  • 天然的传播素材:大家都喜欢晒"我今天用了多少 token",截一张图发出去,就是最好的宣传

安装

插件依赖 DSH 内置包(@deepseek-ai/*),放进 DSH 仓库即可自动解析,无需额外安装。

方式一:让 Agent 一句话装好(推荐)

把下面这句话发给你的 DSH Agent,它会自己读这个仓库的说明并完成安装:

你看一下这个仓库:https://github.com/jiamuAi/dsh-token-usage ,然后帮我把 dsh-token-usage 安装到我的 DSH 上。

方式二:手动装

git clone https://github.com/jiamuAi/dsh-token-usage.git
cp -R dsh-token-usage <你的deepseek-harness路径>/packages/extensions/
cd <你的deepseek-harness路径> && pnpm install && pnpm run build:lib

<你的deepseek-harness路径> = DSH 源码在你机器上的位置。不知道在哪?终端执行 readlink -f $(which dsh) 能看到 dsh 的真实路径,往上找 deepseek-harness 目录就是。

然后编辑 ~/.dsh/profiles/web/package.json,在 dsh.profile.bundles 里加上:

"dsh-token-usage"

最后重启 dsh web,刷新页面即可看到入口。

使用

  1. 重启后,左侧栏底部出现「Token 统计」入口
  2. 打开任意会话,标题旁出现实时用量胶囊 ⚡ 2.61亿
  3. 点击任一入口打开面板;右上角可切主题、关闭
  4. 热力图支持三视图切换 + 悬浮看单日 / 单周 / 累计数值

数据每 5 秒刷新;历史会话自动回填,重启不丢。

数据口径

与 DSH 内置 token-meter 一致:

  • 每 step 一条 usage 记录:assistant/chunk {type:'usage'} 为持久记录;assistant/message.usage 覆盖同一步的 chunk 记录(不重复计数)
  • 累计 Token = input + output + cacheRead + cacheWrite
  • thinking 等级由 reasoningTokens 近似;Skill 统计从 skill 工具调用参数解析

架构

┌─ Host(DSH 进程内)──────────────────────────────┐
│ TokenUsageService (TypertRemoteService)          │
│  ├─ 启动时回填全部历史 session                    │
│  ├─ session/event 实时折叠                        │
│  └─ @Remote('getStats') → /api/tokenUsage/getStats│
└──────────────┬───────────────────────────────────┘
               │ connection.rpc(通用通道,无需改 DSH)
┌─ Browser ────▼───────────────────────────────────┐
│  ├─ sidebar.footer.action        侧栏入口        │
│  ├─ conversation.session.header.actions ⚡ 胶囊   │
│  └─ shell.overlay                面板模态框       │
└──────────────────────────────────────────────────┘

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-gui-hanhua 下一个 Next dsh-tunnel-plugin →