agentspend-cli
v0.1.0
Published
Track and cap AI agent API spend, and sync agent config/state across environments
Maintainers
Readme
agentspend
Track and cap AI agent API spend, and sync agent config/state across environments.
Local-first, free CLI. No server, no account — everything lives in ~/.agentspend
(or $AGENTSPEND_HOME if set).
Real numbers, not a benchmark — agentspend doesn't have a retrieval/accuracy metric
to report, so this is test count, package size, and dependency count, regenerated
from an actual build/test run by scripts/refresh-stats.mjs. See
docs-vp/guide/stats.md for details.
Try it now
npx agentspend-cli spend track --provider openai --cost 0.42
npx agentspend-cli spend reportInstall
npm install -g agentspend-cliThe package on npm is agentspend-cli; the command it installs is agentspend.
What agentspend solves
- No visibility into agent API cost —
spend trackrecords each call's cost by provider and project;spend reporttotals it. - Budgets get blown silently —
spend budget <amount>sets a cap;spend budget(no argument) checks status and exits non-zero when over, so it can gate a CI job. - Agent config/memory drifts across machines —
sync save/sync loadsnapshots a config or state file under a named profile you can restore anywhere.
Usage
spend
agentspend spend track --provider openai --model gpt-4o --cost 0.42 --project myagent
agentspend spend track --provider anthropic --cost 0.10 --project myagent
agentspend spend report # totals across all entries
agentspend spend report --project myagent # scoped to one project
agentspend spend report --json # machine-readable output
agentspend spend budget 10.00 # set a $10 budget
agentspend spend budget # check status; exits 1 if over budgetsync
agentspend sync save myagent ./agent-config.json # snapshot a file as "myagent"
agentspend sync load myagent ./restored-config.json # restore it elsewhere
agentspend sync list # list saved profilesDevelop
pnpm install
pnpm dev -- spend track --provider openai --cost 0.42
pnpm typecheck
pnpm testApp code lives in src/logic/; the CLI wiring is in src/cli.ts.
Release
pnpm changeset # describe your change
git commit -am "..." # commit the changeset fileMerging to main triggers the deploy-npm-publish GitHub Actions workflow (Changesets
opens a "Version Packages" PR; merging that publishes). Requires an NPM_TOKEN secret.
Docs
Contributing
See CONTRIBUTING.md. Please also review our Code of Conduct and Security Policy.
License
MIT © Manoj Mallick
