dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Track token spend and enforce budgets for every model call your dsh agent makes.
dsh plugin --profile web add dsh-cost-track
Or from source:
dsh plugin --profile web add github:hj01857655/dsh-cost-track
.cost/ledger.jsonl (append-only).enforce: true, subsequent model calls are blocked.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
Default rates (per million tokens, USD):
| Model | Prompt | Completion |
|---|---|---|
| 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 }
}
A Cost page inside Settings. The host registers GET /api/cost-track.panel and
rebuilds the payload from the ledger on every request, so the panel always reflects what
is on disk. A headless host has no web connection and simply skips the route.
The panel shows:
| Path | Role |
|---|---|
src/index.ts | Host half — apply(ctx), exposes the costTrack service |
src/cost.ts | Core cost tracker — record, query, aggregate |
src/pricing.ts | Built-in price table + custom pricing loader |
src/budget.ts | Budget checking and enforcement logic |
src/store.ts | Append-only .cost/ledger.jsonl |
src/cost-view.ts | Payload → view model, shared by host route and browser half |
src/cli.ts / src/bin.ts | Command-line entry, usable without dsh |
src/routes.ts | Panel route on the host's web connection |
src/client/view.tsx | Browser half — pure rendering |
src/client/index.tsx | Browser half — fetch and settings registration |
src/client/locales.ts | zh / en dictionaries |
npm ci
npm run typecheck
npm run build
npm test
MIT