DeepSeek Harness plugin

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)

Jump to install

Source facts

Repository
vector-sunlight/dsh-token-usage
Latest update
Aug 16, 2026
Category
UI Enhancements
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/vector-sunlight/dsh-token-usage
Plugin: dsh-token-usage-vectorsu
Author: vector-sunlight

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

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)