Skip to main content
A quota rule caps a measured quantity, such as tokens, requests, images, audio seconds, or spending, over a period. Quotas belong to your account, not a workspace, so there is no workspace_id. Reads need quotas:read and writes need quotas:write. Quotas cannot be created through the API. There is no POST /api/v1/quotas.

Targets and versions

A rule can target a model, an API key, a member of the workspace and a provider, in any combination. A request counts against a rule only when it matches every target that is set, and a rule with no targets caps the whole workspace. See console quotas for how targets are enforced. Targets arrived in API version 2026-09-15, which is also the latest version. A rule that 2026-07-14 cannot describe, such as a rule on an API key, a member, a provider or the whole workspace, does not appear in its lists, and reading, updating or deleting it under that version answers 404. Pin 2026-09-15 to manage those rules.

List quotas

string
ROLLING for a sliding window, or CALENDAR for a fixed window.
integer
The cap for the period. -1 means unlimited.
boolean
true for rules derived from your plan. System rules are read-only, and their id is prefixed with system_.
object
The model the rule applies to, as { id, name, display_name }, or null when the rule applies to any model.
object
Since 2026-09-15. The key the rule applies to, as { id, name, key_preview }, or null for any key. The full key is never returned.
object
Since 2026-09-15. The workspace member the rule applies to, as { id, username }, or null for anyone.
object
Since 2026-09-15. The provider the rule applies to, as { id, name }, or null for any provider.

Rule types

A rule’s type names what is being measured and over what period. Each prefix combines with a measure: INPUT_TOKENS, OUTPUT_TOKENS, TOTAL_TOKENS, CACHE_INPUT_TOKENS, CACHE_OUTPUT_TOKENS, CACHE_TOTAL_TOKENS (CACHE_TOKENS on TOTAL_), REQUESTS, IMAGES, AUDIO_SECONDS, and SPENDING. DAILY_SEARCHES and DAILY_DEEP_SEARCHES are also available. System rules additionally report RATE_LIMIT_PER_MINUTE, MAX_PROVIDERS, MAX_QUOTA_RULES, and MAX_MODELS. Those types appear only when is_system is true.

Get a quota

Update a quota

PATCH is a full replace. name, type and limit are required on every update. Under 2026-07-14 model_id is required too. Under 2026-09-15 every target is optional, and a target you leave out is cleared to any. Updating a system_ rule returns 403.
string
required
4 to 32 characters, letters, numbers, and underscores only. Stored lowercased.
string
required
One of the rule types above.
integer
required
Between -1 and 999000000. -1 means unlimited.
string
The model the rule applies to. Required under 2026-07-14. Under 2026-09-15, omit it or send null for any model.
string
Since 2026-09-15. The id of an API key in the rule’s workspace, or null for any key.
string
Since 2026-09-15. The user id of a workspace member, or null for anyone.
string
Since 2026-09-15. The id of a provider in the rule’s workspace, or null for any provider. When model_id is set too, the model must belong to this provider.
string
default:"ROLLING"
ROLLING or CALENDAR.
boolean
default:"true"
Whether the rule is enforced.

Delete a quota

Deleting a system_ rule returns 403.