bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
按模型追踪 token 成本:可配置缓存命中/未命中、输出与高峰时段单价,实时会话花费条,并标记未配置价格的模型。
🇨🇳 中文说明
Token cost tracking for DeepSeek Harness, with per-model configurable pricing and peak/off-peak rates.
assistant/message usage) against a
per-model pricing table you configure — cache-hit / cache-miss input, output,
and optional peak-window rates.cost projection (total / peak / off-peak / per-model),
consumed by the Web UI to show a live session cost readout.Install into a dsh profile straight from GitHub — the plugin ships a
dsh.bundle layer, so dsh plugin add enables it automatically:
dsh plugin --profile web add github:yflmq001/dsh-cost-tracker
Pricing starts empty (models: {}); fill in your models under the plugin's
config (see below). To override defaults, add a cost-tracker row to the
profile's own cordis.patch.yml — later layers win by row id.
⚠️ When overriding, address the row by its
id(cost-tracker), not byname. Cordis non-insert patches locate the target line byid; aname-keyed override row is silently dropped, leaving prices atmodels: {}.
The cross-session bill persists through dsh's storage domain; a profile without a storage backend keeps the bill in memory only.
Pricing lives under the plugin's config (Schemastery-validated). All prices are currency units per million tokens; you fill them in manually (no scraping).
- id: cost-tracker
config:
models:
deepseek-v4-flash:
inputMiss: 1.0 # cache-miss input
inputHit: 0.02 # cache-hit input (omit if no cache tier)
output: 2.0
peak: # peak tier: hours + toggle + prices
hours: ["09:00-12:00", "14:00-18:00"] # Beijing time
enabled: true # false = peak off (base rates always); omit = on
inputMiss: 3.0
inputHit: 0.10
output: 9.0
gpt-4o: # any model the harness can reach
inputMiss: 2.5
output: 10.0
The plugin registers the cost projection:
{
totalCost, peakCost, offpeakCost,
callCount, unconfiguredCalls, unconfiguredModels,
byModel: { [model]: { inputHit, inputMiss, output, total } },
}
Cache writes are priced at the miss rate (providers bill the write at the miss tier; the written tokens become cache hits on a later call).
Two choices keep the numbers honest:
/cost command are available.assistant/message.usage is absent when the adapter
reports no accounting, and the session format has no compatibility promise.