插件目录 / Desktop / dsh-token-viewer
dsh-token-viewer
已验证 · 实测可装 qwert702
功能简介
DSH Web GUI插件:实时token消耗显示
可用 — 实测通过,早期项目
DSH Web GUI插件:实时token消耗显示 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-token-viewer
CC Switch-style token consumption statistics for the DeepSeek Harness Web GUI. Read-only surfaces over the harness's host-computed projections plus one balance read; the plugin adds no prompt content, tools, or provider requests.
Install (one command):
dsh plugin add qwert702/dsh-token-viewerRestart the harness, refresh the web page, then open the Token 消耗 card in the sidebar → 用量详情.
Features
- TokenDock — a slim live strip above the composer showing the current session's billed input (uncached + cache read + cache write), output, cache hit rate, and approximate context occupancy.
- Sidebar card — DeepSeek account balance (with refresh; error-retry when the host proxy fails) and aggregate consumption across all sessions, expandable to a per-conversation list.
- Usage statistics panel (right-side drawer, a faithful port of CC Switch's usage-dashboard method):
- Per-request statistics — the host
usageLogprojection records one timestamped entry per reported assistant step (commit time, model, four token buckets); every figure folds these records, never cumulative session totals. - Hero — real consumption (fresh input + output + cache write + cache read), request count, total cost, over a five-card breakdown row with a cache-hit-rate progress bar.
- Trend chart — requests bucketed by their own commit time (hourly for the day, daily otherwise, empty buckets zero-filled), four token series plus a dashed cost line.
- Three tabs — request log (newest first; clicking a row opens that session), per-project statistics, and per-model statistics with average cost.
- Range presets — today / 7d / 14d / 30d / all, resolved exactly like CC Switch (local midnight of N−1 days back).
- Per-request statistics — the host
- Per-model peak/off-peak list pricing — every request bills under its own model's provider list price (V4-Flash / V4-Pro, CNY per 1M tokens, cache writes at the cache-miss rate), split by the provider's Beijing peak windows (09:00–12:00 and 14:00–18:00, double the off-peak rate); versioned model ids match by prefix, unknown models fall back to the V4-Flash off-peak table. Prices live in
MODEL_PRICING(see below). - Balance route —
GET /api/billing/balanceproxies DeepSeek's/user/balancethrough the harness credentials service; the API key never leaves the server.
Screenshots



Repo layout
lib/index.js— plugin host half (balance route +modelUsage/usageLogsession projections), ready to load.lib/client.js— browser half bundle (built), discovered viapackage.jsondsh.client.scripts/build-client.mjs— regenerateslib/client.jsby vendoring the installed@deepseek-ai/dsh-client-ui-sidebarbundle (setDSH_SIDEBAR_BUNDLEor it probes~/.dsh/profiles).test/smoke.cjs—node test/smoke.cjs: host route + projections + SSR render checks.
The TypeScript monorepo source (extracted from deepseek-ai/deepseek-harness) lives on the archive/monorepo-src branch.
Model pricing
MODEL_PRICING in lib/client.js (and lib/index.js's projection fallback) holds the current DeepSeek list prices; the panel also fetches GET /api/billing/pricing and prefers the provider's official page when reachable, falling back to the built-in table otherwise.
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-token-viewer」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:qwert702/dsh-token-viewer Headless(CLI)profile:
dsh plugin --profile headless add github:qwert702/dsh-token-viewer 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
把 dsh 跑成原生桌面应用——独立窗口、托盘图标、快捷键——而不是浏览器标签。
适合谁
想要已安装应用的感觉和系统集成(托盘、全局热键、开机自启)的人。
二次开发建议
原生壳是缝——加全局快捷键、通知、单实例锁或按 OS 定制的行为。