AI Usage Budget¶
A permitted spend over one scope and one calendar period.
An AI Usage Record shows what a call spent. A budget records how much a
scope may spend in a period, and the app reports the spend for the current period beside the
limit. The app that runs the agent reads exceeded_budgets() before a call and refuses the call
when the spend reaches a limit. This app records and reports the spend. It does not stop a call.
Fields¶
| Field | Type | Required | Description |
|---|---|---|---|
name |
String | Yes | The name the operator reads this budget by. |
description |
String | No | What this limit is for. |
enabled |
Boolean | Yes | The app does not offer a disabled budget to a consuming app. |
agent |
AI Agent | No | Set exactly one of the agent, the model, or the tenant. |
model |
AI Model | No | Set exactly one of the agent, the model, or the tenant. |
tenant |
Tenant | No | Set exactly one of the agent, the model, or the tenant. |
period |
Choice | Yes | day, week, or month. Calendar periods in the server time zone. |
cost_limit |
Decimal | No | The most the scope may spend in the period. |
token_limit |
Integer | No | The most tokens the scope may spend in the period. |
A budget needs exactly one scope and at least one limit.
The period and the retention¶
The period counts the usage records that the prune did not delete. The prune deletes usage records
after checkpoint_retention_days. So the app refuses a budget whose period is longer than the
retention, because it would count less spend than occurred. With the default 30-day retention, the
app refuses a month budget until the administrator raises the retention.
The spend¶
spent_cost and spent_tokens report what the scope spent since the start of the current period.
A usage record with no recorded cost counts as zero.
Currency¶
Costs use each provider's billing currency. A tenant budget over two providers can add two currencies together. The recorded costs are the sums of what each provider charged.