DeepSeek Harness 插件

dsh-token-usage-vectorsu

DSH web plugin: a per-session Token 用量 card for the dsh-better-sidebar right panel — cache hit/miss/output token counts, cache hit rate, and Beijing-time peak/valley cost estimation (2 decimals)(英文原文)

跳到安装方式

来源信息

GitHub 仓库
vector-sunlight/dsh-token-usage
最近更新
2026年8月16日
分类
界面增强
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/vector-sunlight/dsh-token-usage
插件名:dsh-token-usage-vectorsu
作者:vector-sunlight

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-token-usage

![dshfind](https://dshfind.com/zh/plugins)

DSH Web 插件:在 dsh-better-sidebar(侧片卡片)右侧栏注册「⚡ Token 用量」标签页, 按会话独立统计当前会话的 token 用量与费用。

界面截图

![Token 用量卡片(示例数据:缓存命中率 98.3%,全部为 2026-08-17 前旧价计费)](dsh-token-usage示例图.png)

功能

  • 用量统计:缓存命中 / 非缓存命中 / 缓存写入 / 输出 / 推理 tokens、总输入、总计,以及缓存命中率进度条(深红 → 松石绿渐变,提醒提高缓存命中)
  • 峰谷分时计价:按北京时间(UTC+8,不依赖本机时区)判定高峰/低谷时段(高峰 9:00–12:00、14:00–18:00,其余低谷);

每条用量按发生时刻所在时段分别计价;2026-08-17 00:00(北京时间)前按旧价、之后按峰谷价

  • 计量重置规则:上下文压缩(compaction/end)之后从新计量;

距最后一条记录满一周(再无新记录)时旧计量清零、重新开始;卡片显示「计量自 … 起」及重置原因

  • 北京时间含月日:卡片顶部实时显示「北京时间 8月17日 15:04:21」
  • 官网价格同步:Host 半启动时抓取 DeepSeek 官网定价页(英文 /

中文),解析各模型高峰/低谷两套价格(USD/CNY 双币种)与时段区间, 每 6 小时自动刷新;同步失败回退内置价格并显示警告徽章

  • 费用两位小数:主币种随界面语言(中文 ¥ / 英文 $),副币种并排显示
  • 会话独立窗口:切换会话自动复用/新建该会话专属的 token 窗口,各会话统计互不串扰

⚠️ 前置依赖(下载安装前必读)

本插件依赖「侧边卡片」插件 dsh-better-sidebar(>= 0.12.0): Token 用量卡片显示在它提供的右侧栏里,没有它插件无法工作。

  • package.json 已声明 peerDependencies.dsh-better-sidebar
  • 一键安装脚本会在安装前自动检测:未安装侧边卡片时会明确提醒,

确认后自动代为安装;拒绝则中止安装(不会继续安装本插件)

  • 运行时亦有守卫:缺少侧边卡片服务时插件优雅跳过并在控制台提示

安装

一键脚本(推荐,自带依赖检查)

# Windows PowerShell
powershell -ExecutionPolicy Bypass -File scripts/install.ps1
# 或远程执行
irm https://raw.githubusercontent.com/vector-sunlight/dsh-token-usage/main/scripts/install.ps1 | iex

# macOS / Linux
bash scripts/install.sh
# 或远程执行
curl -fsSL https://raw.githubusercontent.com/vector-sunlight/dsh-token-usage/main/scripts/install.sh | bash

GitHub 直装

dsh plugin --profile web add github:vector-sunlight/dsh-token-usage

本地手动

1. 将本目录放到 %USERPROFILE%\.dsh\plugins\dsh-token-usage 2. %USERPROFILE%\.dsh\profiles\web\package.json 的 dependencies 增加: "dsh-token-usage": "link:../../plugins/dsh-token-usage" 3. %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml 追加挂载行: ``yaml - insert: - id: token-usage name: 'dsh-token-usage' ` 4. 在 profiles\web 执行 pnpm install`

装完重启 DSH(如 pm2 restart dsh-web,无 pm2 则重启 dsh web)并硬刷新浏览器。

架构

  • lib/index.js:Host 半(ESM Cordis 插件)——注册 /token-usage/api/usage JSON 路由

(Host 头信任围栏与 /api 一致),折叠会话持久日志、解析官网价格、分段计价

  • lib/client.js:Client 半(window.__ModuleLoader__ 模块表 bundle)——向 betterSidebar

注册标签页,每 3 秒轮询 Host 路由

License

[MIT](LICENSE)