@dsh-external/dsh-usage-stats
Manifest validUsage Statistics: Aggregates the total token usage and model distribution across all sessions, displayed on the settings page
@dsh-external/dsh-usage-stats
English | 中文
DeepSeek Harness (DSH) 用量统计插件:聚合所有会话的 token 使用量(输入 / 输出 / 缓存读 / 缓存写),按模型与按天明细,并在设置页展示,可配置单价估算费用。
功能
- 聚合总览:全部会话的 token 总量、请求数、会话数。
- 按模型明细:每个 provider/model 的请求数与各项 token。
- 按天明细:每日用量列表 + 简易趋势图。
- 单价与费用估算:内置常见 provider 单价,可在设置页按模型覆盖,支持 USD/RMB 显示。
- 加载优化:后台预热 + 会话变化防抖重扫 + 增量按会话缓存 + stale-while-revalidate,打开设置页不阻塞。
安装
① 插件市场一键安装
若已安装 dsh-market 插件市场:
- 打开 Settings → Plugin Market
- 搜索
dsh-usage-stats(或@dsh-external/dsh-usage-stats) - 点 安装,刷新页面即可在设置页看到「用量统计」
插件市场只收录其 registry 里列出的源;若搜索不到,请先用下面②/③/④安装,再考虑把它加入市场 registry。
② dsh plugin add(官方安装命令)
本包已声明 dsh.bundle manifest,可用官方命令直接安装:
dsh plugin --profile web add @dsh-external/dsh-usage-stats
包未发布 npm 时会回退为 GitHub 源码安装,依赖网络可达 github.com。
③ dsh-super-injector 直接注入
dev_inject_plugin <本仓库目录>
④ 克隆 + 打包安装
git clone https://github.com/dustinmoon78/dsh-usage-stats.git
cd dsh-usage-stats
bash scripts/build.sh # 校验 lib 并产出 tgz
# 在目标环境安装/注入产出的 tgz
数据流
遍历 ctx.sessionPersistence 的会话快照(listSnapshots / list),inspect/readFrom 读取事件,折叠 assistant/message 与 assistant/chunk(usage) 的 token 字段,按当前生效的 provider/model(request/header)归属。
API
| 方法 | 路径 | 说明 |
|---|---|---|
GET | /dsh-usage-stats/api | 总览(?refresh=1 强制重扫) |
POST | /dsh-usage-stats/api/prices | 保存单价/汇率 |
curl -s 'http://127.0.0.1:<port>/dsh-usage-stats/api'
返回结构含 total、byModel(每模型含 byDay)、byDay、sessionCount、generatedAt、prices、refreshing。
依赖
- 宿主须提供服务:
webServer、sessionPersistence、sessionProjectionCache。 - 运行时 peer:
cordis(>=4.0.0-rc <5)。
License
BSD-3-Clause
Comments
Loading…
From the same category
by zhu1090093659
DeepSeek Harness (DSH) Web Plugin Aggregation Ecosystem · Everything is a plugin, distributed via the Creative Workshop
★ 8.2k
↓ 134/wk
Apache-2.0
TypeScript
Oct 1, 2026
dsh plugin --profile web add dsh-webby 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
★ 3.9k
↓ 11.6k/wk
MIT
TypeScript
Oct 1, 2026
dsh plugin --profile terminal add @deepseek-harness-tui/dsh-tuiby YuJunZhiXue
DeepSeek Harness 破甲:让所有模型都能破甲,不同模型可换不同提示词;默认提示词面向国模「小码酱」。Jailbreak for every model — swap prompts per model. 求 Star 收藏 ⭐
★ 2.9k
MIT
JavaScript
Oct 1, 2026
dsh plugin --profile web add dsh-purgeby 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,
★ 1.8k
↓ 32k/wk
Apache-2.0
TypeScript
Sep 30, 2026
dsh plugin --profile web add dsh-contextby agentrq
AgentRQ: Human-in-loop realtime conversational task manager for AI Agents. Self-hosted! Control your own agents from wherever you want Mobile, Web, Desktop. Designed to work well with your own Claude
★ 1.1k
↓ 56/wk
Apache-2.0
JavaScript
Oct 1, 2026
dsh plugin --profile web add @agentrq/dsh-plugin-agentrqby vshulcz
One memory shared by Claude Code, Codex, Cursor, Copilot CLI, OpenClaw and 20 more coding agents, built from the session history already on disk. A fix found in one agent comes back in any of them, in
★ 1.1k
↓ 1.2k/wk
MIT
Go
Oct 1, 2026
dsh plugin --profile web add dsh-deja