bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
Usage and cost tracking plugin for DeepSeek Harness, inspired by Codex 0.144's "usage limit" credits reminder: watch every model call and keep a running token/cost tally, with warnings before the budget runs out.
English | 中文
llm/stream waterfall and
accumulates inputTokens, outputTokens, cacheReadTokens,
cacheWriteTokens, reasoningTokens from every usage chunk without
buffering or altering the stream; one call counts once.provider/model key in the config.agent/turn-stopping, usage accumulated
since the last settlement is appended (deltas only) to
~/.dsh/dsh-usage-cost/stats.json, bucketed by date and by model.dailyBudgetUsd / sessionBudgetUsd set,
crossing the threshold logs once per date and once per session:
[dsh-usage-cost] 今日用量超预算 / 本次会话用量超预算.usage_report model tool: read-only report of today, the current
session, the per-model breakdown and the budget state (dailyExceeded
/ sessionExceeded flags).usage-cost/status returns the same report.dsh plugin --profile web add github:DamonKoy/dsh-plugins#path:/packages/dsh-usage-cost
Restart dsh web. Active by default, records usage with no config.
Optional file ~/.dsh/dsh-usage-cost.json:
{
"prices": {
"deepseek-official/deepseek-v4-flash": {
"inputPerM": 0.28,
"outputPerM": 0.42,
"cacheReadPerM": 0.028,
"cacheWritePerM": 0.42
}
},
"dailyBudgetUsd": 2,
"sessionBudgetUsd": 0.5
}
| Field | Default | Meaning |
|---|---|---|
prices | {} | Per-model overrides in USD per 1M tokens, keyed by provider/model |
dailyBudgetUsd | unset | Warn when today's cost exceeds this |
sessionBudgetUsd | unset | Warn when this process's cost exceeds this |
Config is re-read on every use, so edits apply without a restart.
Written synchronously at every turn settlement (small file, no races); costs are estimates from the price table, not provider invoices:
{
"byDate": {
"2026-08-16": { "calls": 3, "inputTokens": 1200, "outputTokens": 800, "costUsd": 0.00068 }
},
"byModel": {
"deepseek-official/deepseek-v4-flash": { "calls": 3, "inputTokens": 1200, "outputTokens": 800, "costUsd": 0.00068 }
}
}
llm/stream listener calls next() first and only reads chunk fields; stream, options and chunks are never modified.MIT