@local/dsh-model-usage
Manifest valid左侧栏「模型用量」面板:统计本机每个模型消耗的 Token 与请求数,并展示当前模型与已配置模型。
dsh-model-usage
DSH 插件:在左侧栏加入「模型用量」入口,打开一个按模型统计 Token 消耗与请求次数的面板。
功能
- 左侧栏入口:
sidebar.panellist(全局面板图标区)新增条形图图标;折叠成轨道时显示 Tooltip,展开时显示文字。按钮、焦点、aria 与选中态由 shell 拥有,插件只提供图标与本地化标签。 - 整页面板:
main以同一 id 注册,点击栏位即切换到该页。 - 页面内容:
- 当前模型(provider / model / 推理强度)
- 按模型的用量表:请求数、输入、输出、缓存读取、推理 Token、合计、最近使用时间
- 统计进度(首次扫描历史会话时)
- 已配置的 provider / model 目录
- 界面文案与元数据提供中文、英文两套。
安装
本仓库是一个标准 DSH bundle(dsh.bundle.patch + dsh.client)。把本目录作为 bundle 装进当前 profile:
plugin_manager action=install_bundle target=<本目录绝对路径>
安装后刷新 DSH Web 页面即可看到左侧栏图标。升级 / 卸载:在插件页停用或移除 Model Usage,或对同一 bundle 执行 remove_bundle。
数据来源
- 用量来自本机会话日志中
assistant/message事件的data.usage,模型身份取data.message.source.{provider,model}。 totalTokens不直接采信(并非所有 provider 都写),改为按输入 + 输出自行计算。- 按会话持久化 revision(
dev:ino:size:mtimeNs:ctimeNs)缓存结果到~/.dsh/plugin-data/dsh-model-usage/usage-cache.json,重启后只重读变更过的会话;新 turn 通过session/event实时增量累加。 - Host 半提供只读的同源接口
GET /api/model-usage(?action=scan触发重扫),带同源校验。
说明
- 首次打开需要扫描全部历史会话(本机 435 个会话 / 约 843MB 压缩日志,耗时约 1–2 分钟,带进度条),之后走缓存。
- 统计范围仅限本机会话日志,不含其它设备或已删除的会话。
结构
| 文件 | 作用 |
|---|---|
index.js | Host 半:会话折取、缓存、/api/model-usage 路由 |
client.js | Client 半:左侧栏图标与中央页面(两个 slot 注册) |
cordis.patch.yml | bundle 插入 model-usage 行 |
package.json | bundle 清单与 dsh.client 声明 |
locale/*.json | 插件管理页显示用标题/描述 |
icon.svg | 插件图标 |
许可证
本项目基于 MIT 协议开源,Copyright (c) 2026 HitMargin。
Comments
Loading…
From the same category
by ccch1mneyyy
DSH 官方公众号收录的 TUI 补位插件:Claude Code 风,鲸鱼顶栏/实时状态/流式思考/双击 Esc 回滚/上下文进度+TPS。npm 一键装。 DSH official WeChat featured TUI plugin — Claude Code style: whale bar, live status, streaming thoughts, double-Esc rol
★ 6.5k
↓ 22.4k/wk
MIT
TypeScript
Nov 2, 2026
dsh plugin --profile terminal add @deepseek-harness-tui/dsh-tuiby kingcharleslzy-ai
Community-maintained dsh-purge fork with host-policy patches, prompt and rule settings, diagnostics, separate update-check and install controls, and local backup/rollback.
★ 4k
MIT
JavaScript
Nov 1, 2026
dsh plugin --profile web add dsh-purge-communityby bowenliang123
The best DeepSeek Harness plugin for context insight and management, with context dashboard / browser / sidebar and context command, for context statistics, composition, breakdown, evolution details,
★ 4k
↓ 139k/wk
Apache-2.0
TypeScript
Nov 2, 2026
dsh plugin --profile web add dsh-contextby strukto-ai
The World's First Virtual Terminal for AI Agents
★ 3.8k
↓ 316/wk
Apache-2.0
TypeScript
Nov 2, 2026
dsh plugin --profile agent add @struktoai/mirage-dshby mmparko
DeepSeek Harness 破甲 (mirror of YuJunZhiXue/dsh-purge) — 上游即将删库,此为本仓库全量镜像:含全部分支/73 个 tag/完整提交历史。原作者署名与二开要求见 README 署名章节。
★ 2.9k
MIT
JavaScript
Oct 13, 2026
dsh plugin --profile web add dsh-purgeby c1overzz
DSH 插件:每天替你刷一轮 B站,读字幕挑出值得的、写一份日报,值得的 @ 你
★ 1.1k
↓ 36.2k/wk
MIT
JavaScript
Oct 31, 2026
dsh plugin --profile web add dsh-bili-scroll