Bundle
dsh-cost-track
Track token spend and enforce budgets for every model call your dsh agent makes.
- Source
- hj01857655
- License
- MIT
- Updated
- Updated 3 hours ago
Readme
# dsh-cost-track
[](https://www.npmjs.com/package/dsh-cost-track)
[](https://www.npmjs.com/package/dsh-cost-track)
[](https://github.com/hj01857655/dsh-cost-track/actions/workflows/ci.yml)
[](LICENSE)
[](package.json)
[](https://github.com/hj01857655/dsh-cost-track/stargazers)
[](https://github.com/topics/dsh-plugin)
Track token spend and enforce budgets for every model call your dsh agent makes.
## Install
```sh
dsh plugin --profile web add dsh-cost-track
```
Or from source:
```sh
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
```sh
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):
| Model | Prompt | Completion |
|---|---|---|
| deepseek-chat | $0.14 | $0.28 |
| deepseek-reasoner | $0.55 | $2.19 |
Override by writing `.cost/pricing.json`:
```json
{
"my-model": { "promptPerMillion": 1.0, "completionPerMillion": 2.0 }
}
```
## License
MIT
Install
dsh plugin --profile web add github:hj01857655/dsh-cost-track
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-cost-track from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.