bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
本地用量账本:从本机会话日志统计每日、每模型、每工作区的 token 消耗、缓存命中率、工具请求占比与估算费用,并提供按模型编辑单价的设置面板。
A local-first usage ledger for DeepSeek Harness: mines the session logs on this machine and reports per-day / per-model / per-workspace token consumption, cache hit rate, tool-vs-chat split, and an estimated cost.
本地用量账本插件:从本机会话日志统计每日 / 每模型 / 每工作区的 token 消耗、缓存命中率、工具请求占比,并按配置单价估算开销。
Install it as a DeepSeek Harness plugin from this repository — in the desktop app open the plugin market (插件市场) install field and paste:
github:cp990207/dsh-usage-ledgerOr from a local clone, point the same field at the absolute path of the checkout. The bundle patch registers the usage-ledger entry with the ledger dashboard in the header; no extra configuration is needed.
price editor (input / output / cache read / cache write, per 1M tokens)
it knows (Kimi, GLM, MiniMax, DeepSeek coding-plan models, verified against official pricing pages). Catalog prices follow plugin updates.
editor always lists exactly the models you actually used.
user profile patch (via the host's config editor) and takes precedence over the built-in catalog. Untouched rows keep following the catalog.
* fallbackrow (default $0.50 in / $2.00 out per 1M tokens) and flagged in the UI.
Saving recomputes every stored cost (the ledger folds events at read time), so historical days are restated under the new prices immediately.
The plugin's config is { currency: string, prices: Record }. Prefer the ⚙ dialog; hand-editing the usage-ledger row of your profile's cordis.patch.yml works too:
- insert:
- id: usage-ledger
name: 'dsh-usage-ledger'
config:
currency: CNY # display currency label (USD default)
prices:
glm-5.3-flash: { input: 0.15, output: 0.5, cacheRead: 0.03, cacheWrite: 0 }If the host environment has no config editor, the ⚙ button is hidden and the dashboard explains how to edit the patch instead.
All data is computed locally from session logs. The HTTP endpoint listens on the loopback interface only and rejects cross-site requests.
The ⚙ Prices editor needs a host that mounts the configEditor service (DeepSeek Harness desktop and web both do). On hosts without it the plugin still folds the session log and serves the dashboard — read-only, priced from the built-in catalog.
ctx.fiber.entry andctx.get('configEditor') instead of injected service access, so the price editor is offered wherever the host provides one (and never crashes the save route when it does not). The config schema returns the user's own rows only, so resolved config no longer folds the built-in catalog into the profile patch. Entry lookup accepts any package name ending in usage-ledger.
MIT © 2026 白白酱 (cp990207)