Skip to main content

Quota

This page is auto-generated from the formations OpenAPI spec. Do not edit manually — run pnpm generate-formations-resource-docs to regenerate.

Creates a quota — a project-scoped cap that blocks (enforce) or reports (monitor) when a windowed aggregate is exceeded. requests quotas are enforced by the request middleware; tokens/cost_usd quotas at the pre-generation check. Mirrors the quotas REST contract; scope, metric, window, and meter_type are immutable after creation (only limit, mode, and on_unpriced update).

Syntax

type: quota
properties:
scope: String
scope_ref: String
metric: String
window: String
limit: Number
mode: String
on_unpriced: String
meter_type: String

Output

The physical resource ID is the public ID of the created resource. Reference it from other resources with a ref expression:

some_field:
ref: MyQuota

Properties

scope

The scope the quota applies to

Required: Yes Type: String Allowed values: project, api_key, agent, actor


scope_ref

Public id of the api key / agent / actor the quota applies to. For api_key and agent scope, NULL means all entities of that scope type in the project. For actor scope, NULL means one budget per actor rather than a pooled total across all actors.

Required: No Type: String Nullable: Yes


metric

The metric being capped

Required: Yes Type: String Allowed values: requests, tokens, cost_usd, storage_bytes


window

The window over which the metric is aggregated. storage_bytes caps a stored total rather than a windowed one, so it takes current and refuses every other value; current is refused for every other metric.

Required: Yes Type: String Allowed values: rolling_1m, rolling_1h, rolling_24h, calendar_month, current


limit

The cap. Positive integer for requests/tokens/storage_bytes (bytes); fractional allowed for cost_usd.

Required: Yes Type: Number


mode

enforce blocks with 429; monitor fires the webhook only

Required: No Type: String Allowed values: enforce, monitor


on_unpriced

Only for metric cost_usd. What an enforce quota does over a pricing blackout — block (the default) refuses generations with 409 QUOTA_UNENFORCEABLE, allow accepts the unmeasurable spend. See the quotas REST contract.

Required: No Type: String Allowed values: block, allow


meter_type

Only for metric cost_usd. The meter this cap answers for; omit it and the cap sums every priced meter. See the quotas REST contract.

Required: No Type: String Allowed values: llm_tokens, compute_execution, api_request, storage