hj01857655/dsh-cost-track ↗★ 0

dsh-cost-track

追踪 Token 消耗并强制执行预算的工具 适合需要严格控制智能体单次模型调用成本和预算的用户。

包名
dsh-cost-track
兼容性
待验证
Cordis 依赖范围
^4.0.1
版本
0.5.1
许可证
MIT
最近更新
2026年9月19日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:hj01857655/dsh-cost-track

dsh-cost-track

npm version npm downloads CI license node GitHub stars dsh plugin

Track token spend and enforce budgets for every model call your dsh agent makes.

Install

dsh plugin --profile web add dsh-cost-track

Or from source:

dsh plugin --profile web add github:hj01857655/dsh-cost-track

What it does

  • Records every model call. Prompt tokens, completion tokens, and the model id are priced and appended to .cost/ledger.jsonl (append-only).
  • Prices calls. A built-in table covers DeepSeek's models. Override with your own rates for custom models.
  • Budgets. Set a monthly spend limit. When cumulative spend crosses the threshold, the plugin warns. With enforce: true, subsequent model calls are blocked.
  • Panel. A settings page shows today's spend, this month's spend, per-model breakdown, recent sessions, and the budget bar.

CLI

dsh-cost-track summary                          # show spend summary
dsh-cost-track budget --monthly 50 --enforce    # set $50/month budget with enforcement
dsh-cost-track record --model deepseek-chat --prompt-tokens 1000 --completion-tokens 500 --session s1

Pricing

Default rates (per million tokens, USD):

ModelPromptCompletion
deepseek-chat$0.14$0.28
deepseek-reasoner$0.55$2.19

Override by writing .cost/pricing.json:

{
  "my-model": { "promptPerMillion": 1.0, "completionPerMillion": 2.0 }
}

License

MIT