llm-budget
Autonomous cost governance primitives — hard budget enforcement across agent fleets.
Track token spend per model, per agent, and per fleet. Block requests before they exceed budget limits. Emit structured cost events for audit trails.
What's inside
- BudgetLedger — per-model token accounting with configurable hard and soft limits
- FleetGovernor — aggregate budget across many agents; enforce global spend caps
- CostEvent — structured cost records for logging, alerting, and analytics
- Budget policies — daily, per-request, per-agent, and rolling-window limits
Features
- Hard limits that refuse requests before they exceed budget (not just alert after)
- Atomic ledger updates — safe under concurrent agent load
- Pluggable cost tables — bring your own per-token pricing for any model
Quick start
use ;
let ledger = new;
// Before sending a request
ledger.check_and_reserve?;
// After receiving response
ledger.commit?;
Add to your project
[]
= { = "https://github.com/Mattbusel/llm-budget" }
Test coverage