Virtual key budgets

Each virtual LLM key can have a monthly spend limit:
When the budget is exhausted, the key is blocked until the next billing period. Set budget_monthly_usd: 0 for unlimited spend.

Token estimation

Estimate token count and cost before sending a request:
Response:

Usage monitoring

Query usage by key, model, or time range:
Each usage event includes:
  • Input/output token counts
  • Estimated cost
  • Model and provider
  • Latency
  • Routing decision

Budget alerts

Configure webhook alerts when a key approaches its budget limit:
Events:

Tool call budgets

For agent runs that use many tools, set a per-run token budget:
When either limit is reached, the run is terminated with a BUDGET_EXCEEDED error.