Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / QuotaRule

Interface: QuotaRule

Defined in: packages/core/dist/index.d.ts

One shared-quota rule. The dimension fields select which requests the rule governs (an absent dimension matches every value); EVERY matching rule must admit a request, and a grant consumes capacity from each of them. The counters are rule-scoped: one rule matching two models pools them under one cap; write one rule per model for per-model buckets.

Window semantics, named as the deliberate compromise it is (RV708): every PerMinute cap counts over FIXED epoch-aligned 60 s windows (QUOTA_WINDOW_MS), not a sliding minute. Each fixed window enforces its cap exactly, and a burst placed astride a boundary can therefore consume up to TWO caps inside one sliding 60 s; that bounded burst is the price of cross-process parity (every reference limiter in every process computes the same window from the same clock with no shared sliding state), and provider-side minute windows are themselves fuzzy. Size caps with the boundary burst in mind; the semantics are pinned as intended, not scheduled to change.

Properties

PropertyTypeDescriptionDefined in
account?stringScope-dimension pins (RV4205): a rule naming any of these matches only reservations whose run scope carries the same value, so a host caps by billing account, project, legal domain, region, or provider account without a limiter fork. A reservation with no scope (an unscoped run) matches none of them, exactly the tenant rule's semantics.packages/core/dist/index.d.ts
legalDomain?string-packages/core/dist/index.d.ts
model?string-packages/core/dist/index.d.ts
project?string-packages/core/dist/index.d.ts
provider?stringAdapter id, as in concurrency.perProvider keys.packages/core/dist/index.d.ts
providerAccount?string-packages/core/dist/index.d.ts
region?string-packages/core/dist/index.d.ts
requestsPerMinute?numberWire attempts admitted per window; the exact, hard cap.packages/core/dist/index.d.ts
sponsor?stringThe sponsoring principal (RV4408), the newest scope dimension.packages/core/dist/index.d.ts
tenant?string-packages/core/dist/index.d.ts
tokensPerMinute?numberInput plus output tokens admitted per window: estimated at admission, reconciled to actual usage.packages/core/dist/index.d.ts