Budget & cost management
Track and cap LLM API spend. Every call is recorded; budgets stop the agent before a runaway conversation costs you real money.
Cost tracking
Each LLM round-trip is recorded with: tokens in, tokens out, tokens served from cache (not billed), estimated cost, which model, and which provider. That data drives the cost views in the admin and the support export.
Budget limits
| Limit | Where configured |
|---|---|
| Per-turn hard cap | Per provider, in Settings → Budgets. Stops the agent loop the moment a single turn would exceed it. |
| Daily token budget | Per provider, sliding 24h window. |
| Monthly cost cap | Per provider, USD. |
When a limit is hit, the agent loop stops and the chat tells you which budget tripped. No silent overrun.
Viewing costs
- Admin dashboard widget — aggregate stats (conversations, messages, providers).
- REST:
GET /pfw/v1/agent-runtime/metrics?windowHours=168— cost by provider, tokens by provider, calls by action. - Support export — full per-turn cost breakdown.
Keeping costs down
- Prompt caching — enable on supported providers to cut input token cost on repeated content.
- Pick the right model size per task — use a cheaper "small" model for routine work; reserve the larger model for the cases that actually need it.
- Set a hard cap even if you do not expect to hit it — it is the difference between a noticed mistake and a surprise bill.