Skip to main content

Budgets

List Budgets

Returns budgets visible to the current workspace, ordered by creation time with the newest first. Supports filtering by scope kind, scope target id, period, and active state, plus an optional free-text query that searches across denormalized target names via Typesense.

Create a Budget

Creates a new budget in the workspace. Exactly one scope variant must be set (workspace / project / identity / api_key / provider / model). At least one of limits.amount, limits.token_limit, or rate_limit.requests_per_minute MUST be provided. Uniqueness is enforced across (workspace_id, scope_kind, scope_target_id).

Retrieve a Budget

Retrieves the metadata for an existing budget by its unique identifier. Returns NotFound when the budget does not exist in the caller’s workspace.

Delete a Budget

Permanently deletes a budget. Consumption counters in Redis for this budget are cleared immediately. The response body is empty on success.

Update a Budget

Updates mutable fields of a budget: limits, rate limit, activation, and expiration. The scope is immutable: to change a budget’s target, delete and recreate it. Omitted fields keep their current values.

Reset Consumption

Clears the current-period cost, token, and request counters for the budget. The budget record itself is preserved; only the Redis counters are reset.