Budgets API
Manage the same spend, request and token budgets that the Policy Engine's Budgets & Usage Limits card configures, from scripts and internal tools. For what a budget counts, how it resets and what happens at the limit, see Rate, token and budget limits.
Try every operation with your own key in the Management API playground.
Before you start
- The Policy Engine must be on for the LLM Gateway. Budgets live in the active policy. With it off,
GET /budgetsreturns an empty list withnote: "policy_engine_disabled", and writes are refused. - Issue a key with budget scopes. In Settings > AI Gateway > LLM Gateway > Management API, pick the scopes below. Budget scopes are independent of
read: a key with onlybudgets:readcan read budgets but not apps.
GET /budgets also returns caller, describing what the calling key may do, so a tool can hide actions it cannot perform.
How writes work
- Preview first. Budget, pricing and exemption writes accept
?dry_run=trueand return the policy diff, diagnostics and the impact on current usage (subjects newly over the limit, newly blocked or unblocked) without publishing. Grant and alert-destination writes do not supportdry_run. - Versions. Read a budget or grant to get its ETag, then send it quoted in
If-Match. Budget ETags look like"r<revision>-<budget_id>", so any publish can make them stale (412). - Creates take an
Idempotency-Key. Budget, batch, exemption and grant creation replay the original result for the same key. - API-managed vs hand-written. Budgets created here go into an API-managed policy. Budgets written by hand in the policy editor can have their limit, label, mode, alerts and adjustments changed, but cannot be deleted or re-scoped (
409 budget_not_api_managed). The same applies to exemptions (409 exemption_not_api_managed). - Identity fields are fixed.
id,metric, grouping (per) andwindowcannot change (422 identity_field_immutable), because usage is tracked against them. Create a new budget instead.
Usage, grants and prices
- Amounts. Spend amounts are decimal USD strings such as
"12.50". Request and token amounts are numbers. - Usage is a snapshot. Usage responses carry
as_ofandstale; the snapshot refreshes periodically.periodselectscurrent(default),previousor the start of a past calendar window. Rolling and lifetime windows only show the current period. - Row state. Each usage row is
blocked(at the hard stop),overflow(in the soft band),alerting(past the lowest alert threshold),grantedorok. - Grants need an adjustable budget. A budget accepts grants only when it has an
adjustmentsceiling (409 budget_not_adjustableotherwise), and a grant cannot exceed that ceiling (422 grant_above_ceiling). A new grant for the same subject supersedes the active one; the response returns it assuperseded. - Subjects. Name a grant subject by
user(email),app,smart_groupormodel, or by the budget's grouping field. Every grouping field of the budget must be supplied (422 subject_unresolved). - Prices.
GET /budget-pricingshows where each price comes from:policy(a tenant-wide rate set here),provider(the provider's model costs),catalog(QuilrAI catalog),mixedorunpriced. A tenant-wide rate wins over the provider's cost, which wins over the catalog.
Endpoints
/budget-alert-destinationsRead budget alert destinations
Webhooks that receive budget alerts. Targets are redacted on read.
budgets:readNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-alert-destinations' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-alert-destinationsReplace budget alert destinations
Replaces the whole destination list. Omit `target` (or send the redacted read value) to keep a stored URL. Optional If-Match with the etag from the read.
budgets:policyPath, query & header parameters 1
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
destinationsarray<object>requiredArray item specification
enabledbooleanoptionalidstringrequiredkindobjectrequired"webhook"targetstring | nulloptionalhttps URL; omit, null or the redacted read value to keep the stored target
Unknown fields are rejected in this object.
Unknown fields are rejected in this object.
curl --request PUT \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-alert-destinations' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Content-Type: application/json' \
--data '{
"destinations": [
{
"enabled": true,
"id": "ops-webhook",
"kind": "webhook",
"target": "https://hooks.example.com/services/budget"
}
]
}'
Authentication, errors & retry rules Try it in the playground
/budget-alertsList budget alerts
Alerts that fired, newest first. Filter by since, until, subject and quota_id (budget id).
budgets:readPath, query & header parameters 6
limit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
since (query)stringoptionalISO timestamp (default: 30 days before until).
until (query)stringoptionalISO timestamp (default: now).
subject (query)stringoptionalSubject bucket or a value inside it.
quota_id (query)stringoptionalBudget id.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-alerts?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-eventsList budget events
Grant changes and budget policy edits made through the API, oldest first after `after` (a next_cursor or an ISO timestamp), so a client can poll for new events. Filter by type, budget_id, grant_id and subject.
budgets:readPath, query & header parameters 6
limit (query)integeroptionalPage size.
after (query)stringoptionalnext_cursor of the previous page, or an ISO timestamp.
type (query)stringoptionalEvent type, for example grant.created.
budget_id (query)stringoptionalBudget id.
grant_id (query)stringoptionalGrant id.
subject (query)stringoptionalSubject bucket or a value inside it.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-events?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-exemptionsList budget exemptions
Exemptions of the active policy: which users, apps or smart groups skip which budgets, until when.
budgets:readNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-exemptions' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-exemptionsCreate a budget exemption
Exempts users, apps or smart groups from all or listed budgets, optionally until expires_at. Publishes a policy revision (201; 200 with dry_run).
budgets:policyPath, query & header parameters 3
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Idempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result for 24 hours; the same key with a different body is a 409. Not needed with dry_run=true.
Full request body specification application/json
applies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringusersarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
expires_atstringoptionalAny RFC 3339 instant; stored as rule.expires_at in UTC second precision (YYYY-MM-DDTHH:MM:SSZ), fractional seconds rounded up.
familiesarray<string>optionalArray item specification
stringkindsarray<object>optionalArray item specification
objectValues: "budget""rate"
messagestringoptionalquotasone of 2 variantsrequiredVariant 1 "all"
"all"Variant 2 array<string>
array<string>reasonstringrequiredUnknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-exemptions' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Idempotency-Key: create-support-bot-001' \
--header 'Content-Type: application/json' \
--data '{
"applies_to": {
"users": [
"ceo@example.com"
]
},
"expires_at": "2026-12-31T23:59:59Z",
"quotas": "all",
"reason": "Executive access"
}'
Authentication, errors & retry rules Try it in the playground
/budget-exemptions/{exemption_id}Delete a budget exemption
Removes an exemption and publishes a policy revision.
budgets:policyPath, query & header parameters 3
exemption_id (path)stringrequireddry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
messagestringoptionalRecorded with the policy revision.
Unknown fields are rejected in this object.
curl --request DELETE \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-exemptions/ex_3e1f0a9b8c7d' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"'
Authentication, errors & retry rules Try it in the playground
/budget-grantsList budget grants
Grants across budgets. Filter by budget_id, bucket, status, expires_before and subject.
budgets:readPath, query & header parameters 10
limit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
budget_id (query)stringoptionalBudget id.
bucket (query)stringoptionalCanonical subject bucket.
status (query)stringoptionalactive, revoked, superseded or expired.
expires_before (query)stringoptionalISO timestamp.
subject.user (query)stringoptionalUser email.
subject.app (query)stringoptionalApp name.
subject.smart_group (query)stringoptionalSmart group name.
subject.model (query)stringoptionalModel id.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-grants?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-grants/{grant_id}Revoke a budget grant
Revokes a grant; the subject returns to the base limit. A reason may be sent in the body or the reason query parameter. Requires the grant etag in If-Match.
budgets:grantPath, query & header parameters 3
grant_id (path)stringrequiredreason (query)stringoptionalWhy the grant is revoked.
If-Match (header)stringrequiredBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
reasonstringoptionalUnknown fields are rejected in this object.
curl --request DELETE \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-grants/grt_4f9a2c1b7e3d' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"'
Authentication, errors & retry rules Try it in the playground
/budget-grants/{grant_id}Read a budget grant
One grant and its etag, used as If-Match on grant writes.
budgets:readPath, query & header parameters 1
grant_id (path)stringrequiredNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-grants/grt_4f9a2c1b7e3d' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-grants/{grant_id}Update a budget grant
Changes the limit, expiry or reason of an active grant. Requires the grant etag in If-Match.
budgets:grantPath, query & header parameters 2
grant_id (path)stringrequiredIf-Match (header)stringrequiredBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
expires_atstringoptionallimitone of 2 variantsoptionalVariant 1 string
stringVariant 2 number
numberreasonstringoptionalUnknown fields are rejected in this object.
curl --request PATCH \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-grants/grt_4f9a2c1b7e3d' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Content-Type: application/json' \
--data '{
"limit": "30",
"reason": "Extended surge"
}'
Authentication, errors & retry rules Try it in the playground
/budget-pricingRead budget pricing
Every provider and model configured for the tenant with its effective price and where it comes from (policy rate, provider cost, Quilr catalog, mixed or unpriced), the tenant-wide rate items and how unpriced models are charged. Use it to render a full price table.
budgets:readNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-pricing' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-pricingUpdate unpriced model handling
Sets how requests to models with no known price are treated: `zero` (count as free) or `block`; null removes the setting. Publishes a policy revision.
budgets:policyPath, query & header parameters 2
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
unpriced_modelsstring | nullrequired"zero""block"nullUnknown fields are rejected in this object.
curl --request PATCH \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-pricing' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Content-Type: application/json' \
--data '{
"unpriced_models": "block"
}'
Authentication, errors & retry rules Try it in the playground
/budget-pricing/rates/{provider}/{model}Remove a model rate
Removes a tenant-wide rate; the model falls back to provider or catalog pricing. provider_label selects a label-specific rate.
budgets:policyPath, query & header parameters 5
provider (path)stringrequiredmodel (path)stringrequiredModel id; may contain `/`.
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
provider_label (query)stringoptionalRemove the rate of one provider label only.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
messagestringoptionalRecorded with the policy revision.
Unknown fields are rejected in this object.
curl --request DELETE \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-pricing/rates/openai/gpt-4.1-mini' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"'
Authentication, errors & retry rules Try it in the playground
/budget-pricing/rates/{provider}/{model}Set a model rate
Sets the tenant-wide price of one provider and model (model IDs may contain `/`). Rates are USD per 1M tokens, as numbers or decimal strings; tiers and cache rates are optional. Publishes a policy revision.
budgets:policyPath, query & header parameters 4
provider (path)stringrequiredmodel (path)stringrequiredModel id; may contain `/`.
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
One pricing.token_rates item (provider/model come from the path). Rates are USD per 1M tokens (*_usd_per_1m), tool fees USD per 1k calls / hour / session, multipliers > 0; each a number or a decimal string ("0.15"). At least one rate, fee, multiplier, tiers or cache_write_default_ttl.
audio_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringaudio_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_read_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_1h_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_5m_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_default_ttlobjectoptional"5m""1h""unpriced"cache_write_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcode_execution_usd_per_hourone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcontainer_usd_per_sessionone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringfile_search_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringgrounding_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringinput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringmessagestringoptionalmodelstringoptionalOptional; must equal the path value
output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringproviderstringoptionalOptional; must equal the path value
provider_labelstring | nulloptionalreasoning_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringregional_multipliersobjectoptionalObject fields
data_residencyone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringgeoone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringregionalone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringus_onlyone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
service_tier_multipliersobjectoptionalObject fields
fastone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringflexone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringpriorityone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
tiersarray<object>optionalArray item specification
above_input_tokensintegerrequiredaudio_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringaudio_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_read_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_1h_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_5m_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringinput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringoutput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringreasoning_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
web_fetch_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringweb_search_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
curl --request PUT \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-pricing/rates/openai/gpt-4.1-mini' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Content-Type: application/json' \
--data '{
"input_usd_per_1m": "0.40",
"message": "Negotiated rate",
"output_usd_per_1m": "1.60"
}'
Authentication, errors & retry rules Try it in the playground
/budget-subjectsList budget subjects
One row per subject (user, app, key or smart group) across all budgets, with the tightest budget first. Filter with q (substring), kind, budget_id, min_pct and state; include_idle=true adds members with no usage.
budgets:readPath, query & header parameters 10
limit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
period (query)stringoptionalcurrent (default), previous, or the ISO start of a past calendar window.
q (query)stringoptionalCase-insensitive substring of the subject.
kind (query)stringoptionalFilter by kind.
budget_id (query)stringoptionalBudget id.
min_pct (query)stringoptionalOnly subjects at or above this percent of their limit.
state (query)stringoptionalok, alerting, granted, overflow or blocked.
sort (query)stringoptionalSort order, for example pct, used or remaining.
include_idle (query)stringoptionalAlso list smart-group members and key owners with no usage (true or false).
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-subjects?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-subjects/{kind}/{value}Read a budget subject
Every budget that would count this subject (kind user, app, key or smart_group), including budgets with no usage yet, and whether each rule depends on request details. `app` narrows rules that depend on the app.
budgets:readPath, query & header parameters 4
kind (path)stringrequireduser, app, key or smart_group.
value (path)stringrequiredperiod (query)stringoptionalcurrent (default), previous, or the ISO start of a past calendar window.
app (query)stringoptionalApp name, for rules that depend on the app.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-subjects/user/alice%40example.com' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budget-usage-summaryRead budget usage summary
One row per budget: subjects tracked, total used, subjects over 80 percent, in overflow, at the limit or blocked, and active grants. `period` selects a past calendar window.
budgets:readPath, query & header parameters 1
period (query)stringoptionalcurrent (default), previous, or the ISO start of a past calendar window.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budget-usage-summary' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budgetsList budgets
Budgets (spend, request or token limits) of the active policy, with `caller` describing what the key may do and `policy_engine` status. When QuilrQL is not enabled for the tenant the list is empty. Filters: kind, metric, managed, adjustable.
budgets:readPath, query & header parameters 6
limit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
kind (query)stringoptionalFilter by kind.
metric (query)stringoptionalspend_usd, requests or a token metric.
managed (query)stringoptionaltrue lists only API-managed budgets.
adjustable (query)stringoptionaltrue lists only budgets that accept grants.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budgetsCreate a budget
Adds a budget to the API-managed budgets policy and publishes a new policy revision (201). With dry_run=true returns the diff, diagnostics and impact without publishing (200). An id is generated when omitted.
budgets:policyPath, query & header parameters 2
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
Idempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result for 24 hours; the same key with a different body is a 409. Not needed with dry_run=true.
Full request body specification application/json
adjustmentsone of 2 variantsoptionalBudgetAdjustments object
auto_approveobjectoptionalObject fields
max_countintegeroptionalperobjectoptional"day""week""month"smart_groupsarray<string>optionalArray item specification
stringup_to_pctintegeroptionalUnknown fields are rejected in this object.
ceilingone of 2 variantsrequiredHighest grant limit (USD for spend); >= limit
Variant 1 string
stringVariant 2 number
numbermax_durationstringoptional1h..366d (default 366d)
overflowobjectoptionalObject fields
add_pctintegerrequiredUnknown fields are rejected in this object.
requestablebooleanoptionalUnknown fields are rejected in this object.
Also accepts null.
alertsarray | nulloptionalapplies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
familystring | nulloptionalidstringoptionalkindstring | nulloptional"budget""rate"nulllabelstring | nulloptionallimitone of 2 variantsrequiredVariant 1 string
stringVariant 2 number
numbermessagestringoptionalmetricstringrequiredmodestring | nulloptional"enforce""alert""paused"nullperarray<string>optionalArray item specification
stringwindowobjectrequiredUnknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets' \
--header 'Authorization: Bearer <management-key>' \
--header 'Idempotency-Key: create-support-bot-001' \
--header 'Content-Type: application/json' \
--data '{
"kind": "rate",
"limit": 1000,
"metric": "requests",
"per": [
"application.name"
],
"window": {
"kind": "rolling",
"unit": "hour"
}
}'
Authentication, errors & retry rules Try it in the playground
/budgets/_batchApply budget changes in a batch
Up to 100 budget, rate and exemption operations published as ONE policy revision, all or nothing. Each op may carry its own if_match.
budgets:policyPath, query & header parameters 3
dry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringoptionalBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Idempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result for 24 hours; the same key with a different body is a 409. Not needed with dry_run=true.
Full request body specification application/json
messagestringoptionalopsarray<object>requiredArray item specification
budgetobjectoptionalObject fields
adjustmentsone of 2 variantsoptionalBudgetAdjustments object
auto_approveobjectoptionalObject fields
max_countintegeroptionalperobjectoptional"day""week""month"smart_groupsarray<string>optionalArray item specification
stringup_to_pctintegeroptionalUnknown fields are rejected in this object.
ceilingone of 2 variantsrequiredHighest grant limit (USD for spend); >= limit
Variant 1 string
stringVariant 2 number
numbermax_durationstringoptional1h..366d (default 366d)
overflowobjectoptionalObject fields
add_pctintegerrequiredUnknown fields are rejected in this object.
requestablebooleanoptionalUnknown fields are rejected in this object.
Also accepts null.
alertsarray | nulloptionalapplies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
familystring | nulloptionalidstringoptionalkindstring | nulloptional"budget""rate"nulllabelstring | nulloptionallimitone of 2 variantsrequiredVariant 1 string
stringVariant 2 number
numbermessagestringoptionalmetricstringrequiredmodestring | nulloptional"enforce""alert""paused"nullperarray<string>optionalArray item specification
stringwindowobjectrequiredUnknown fields are rejected in this object.
changesobjectoptionalIdentity fields (id, metric, per/group_by, window) are immutable (422 identity_field_immutable); applies_to only on API-managed budgets.
Object fields
adjustmentsone of 2 variantsoptionalBudgetAdjustments object
auto_approveobjectoptionalObject fields
max_countintegeroptionalperobjectoptional"day""week""month"smart_groupsarray<string>optionalArray item specification
stringup_to_pctintegeroptionalUnknown fields are rejected in this object.
ceilingone of 2 variantsrequiredHighest grant limit (USD for spend); >= limit
Variant 1 string
stringVariant 2 number
numbermax_durationstringoptional1h..366d (default 366d)
overflowobjectoptionalObject fields
add_pctintegerrequiredUnknown fields are rejected in this object.
requestablebooleanoptionalUnknown fields are rejected in this object.
Also accepts null.
alertsarray | nulloptionalapplies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
familystring | nulloptionalkindstring | nulloptional"budget""rate"nulllabelstring | nulloptionallimitone of 2 variantsoptionalVariant 1 string
stringVariant 2 number
numbermessagestringoptionalmodestring | nulloptional"enforce""alert""paused"nullexemptionobjectoptionalObject fields
applies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringusersarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
expires_atstringoptionalAny RFC 3339 instant; stored as rule.expires_at in UTC second precision (YYYY-MM-DDTHH:MM:SSZ), fractional seconds rounded up.
familiesarray<string>optionalArray item specification
stringkindsarray<object>optionalArray item specification
objectValues: "budget""rate"
messagestringoptionalquotasone of 2 variantsrequiredVariant 1 "all"
"all"Variant 2 array<string>
array<string>reasonstringrequiredUnknown fields are rejected in this object.
exemption_idstringoptionalidstringoptionalif_matchstringoptionalmodelstringoptionalopobjectrequired"patch""create""delete""put_rate""delete_rate""set_unpriced_models""create_exemption""delete_exemption"providerstringoptionalprovider_labelstring | nulloptionalrateobjectoptionalOne pricing.token_rates item (provider/model come from the path). Rates are USD per 1M tokens (*_usd_per_1m), tool fees USD per 1k calls / hour / session, multipliers > 0; each a number or a decimal string ("0.15"). At least one rate, fee, multiplier, tiers or cache_write_default_ttl.
Object fields
audio_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringaudio_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_read_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_1h_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_5m_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_default_ttlobjectoptional"5m""1h""unpriced"cache_write_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcode_execution_usd_per_hourone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcontainer_usd_per_sessionone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringfile_search_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringgrounding_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringinput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringmessagestringoptionalmodelstringoptionalOptional; must equal the path value
output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringproviderstringoptionalOptional; must equal the path value
provider_labelstring | nulloptionalreasoning_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringregional_multipliersobjectoptionalObject fields
data_residencyone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringgeoone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringregionalone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringus_onlyone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
service_tier_multipliersobjectoptionalObject fields
fastone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringflexone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringpriorityone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
tiersarray<object>optionalArray item specification
above_input_tokensintegerrequiredaudio_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringaudio_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_read_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_1h_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_5m_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringcache_write_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_input_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringimage_output_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringinput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringoutput_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringreasoning_usd_per_1mone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
web_fetch_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringweb_search_usd_per_1kone of 2 variantsoptionalVariant 1 number
numberVariant 2 string
stringUnknown fields are rejected in this object.
valuestring | nulloptional"zero""block"nullUnknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/_batch' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12"' \
--header 'Idempotency-Key: create-support-bot-001' \
--header 'Content-Type: application/json' \
--data '{
"message": "Raise support budget and price gpt-4.1-mini",
"ops": [
{
"changes": {
"limit": "20"
},
"id": "support_spend",
"op": "patch"
},
{
"model": "gpt-4.1-mini",
"op": "put_rate",
"provider": "openai",
"rate": {
"input_usd_per_1m": "0.40",
"output_usd_per_1m": "1.60"
}
}
]
}'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}Delete a budget
Removes an API-managed budget and publishes a new revision. Budgets written by hand in policy return 409 budget_not_api_managed. Requires the budget etag in If-Match.
budgets:policyPath, query & header parameters 3
budget_id (path)stringrequireddry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringrequiredBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
messagestringoptionalRecorded with the policy revision.
Unknown fields are rejected in this object.
curl --request DELETE \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12-support_spend"'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}Read a budget
One budget and its etag (`r<revision>-<id>`), used as If-Match on budget writes.
budgets:readPath, query & header parameters 1
budget_id (path)stringrequiredNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}Update a budget
Changes limit, label, mode, alerts, adjustments or (API-managed budgets only) applies_to, and publishes a new revision. id, metric, per and window are immutable (422 identity_field_immutable). Requires the budget etag in If-Match. dry_run=true previews diff and impact.
budgets:policyPath, query & header parameters 3
budget_id (path)stringrequireddry_run (query)booleanoptionalReturn the policy diff, diagnostics and impact without publishing.
If-Match (header)stringrequiredBudget etag "r<revision>-<id>" (required on PATCH/DELETE of a budget); grant etag "<version>" (required on PATCH/DELETE of a grant); optional policy etag "r<revision>" on pricing, exemption and batch writes; optional alert-destinations etag on PUT /budget-alert-destinations.
Full request body specification application/json
Identity fields (id, metric, per/group_by, window) are immutable (422 identity_field_immutable); applies_to only on API-managed budgets.
adjustmentsone of 2 variantsoptionalBudgetAdjustments object
auto_approveobjectoptionalObject fields
max_countintegeroptionalperobjectoptional"day""week""month"smart_groupsarray<string>optionalArray item specification
stringup_to_pctintegeroptionalUnknown fields are rejected in this object.
ceilingone of 2 variantsrequiredHighest grant limit (USD for spend); >= limit
Variant 1 string
stringVariant 2 number
numbermax_durationstringoptional1h..366d (default 366d)
overflowobjectoptionalObject fields
add_pctintegerrequiredUnknown fields are rejected in this object.
requestablebooleanoptionalUnknown fields are rejected in this object.
Also accepts null.
alertsarray | nulloptionalapplies_toobjectoptionalObject fields
appsarray<string>optionalArray item specification
stringsmart_groupsarray<string>optionalArray item specification
stringUnknown fields are rejected in this object.
familystring | nulloptionalkindstring | nulloptional"budget""rate"nulllabelstring | nulloptionallimitone of 2 variantsoptionalVariant 1 string
stringVariant 2 number
numbermessagestringoptionalmodestring | nulloptional"enforce""alert""paused"nullcurl --request PATCH \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "r12-support_spend"' \
--header 'Content-Type: application/json' \
--data '{
"adjustments": {
"ceiling": "50",
"max_duration": "90d"
}
}'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}/grantsIssue a budget grant
Gives one subject of an adjustable budget a time-boxed limit (higher or lower than the base, at most the budget's ceiling). A new grant supersedes the subject's active one. Grants do not change policy.
budgets:grantPath, query & header parameters 2
budget_id (path)stringrequiredIdempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result for 24 hours; the same key with a different body is a 409. Not needed with dry_run=true.
Full request body specification application/json
expires_atstringrequiredlimitone of 2 variantsrequiredVariant 1 string
stringVariant 2 number
numbermessagestringoptionalreasonstringoptionalstarts_atstringoptionalsubjectobjectrequiredOne bucket of the budget: {"user": email}, {"app": name}, {"smart_group": g}, {"model": m}, raw {"<group_by field>": value}, or {"bucket": "<canonical>"}; every group_by field must be supplied (422 subject_unresolved / subject_not_in_budget).
Unknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend/grants' \
--header 'Authorization: Bearer <management-key>' \
--header 'Idempotency-Key: create-support-bot-001' \
--header 'Content-Type: application/json' \
--data '{
"expires_at": "2026-10-31T23:59:59Z",
"limit": "25",
"reason": "Quarter-end ticket surge",
"subject": {
"user": "alice@example.com"
}
}'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}/grants/_bulkIssue budget grants in bulk
Issues up to 1000 grants, listed in `grants` or expanded from every member of a smart group (`subjects_from`). Each item succeeds or fails independently; failures are listed in `errors`. 201 when at least one grant was issued, otherwise 200.
budgets:grantPath, query & header parameters 2
budget_id (path)stringrequiredIdempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result for 24 hours; the same key with a different body is a 409. Not needed with dry_run=true.
Full request body specification application/json
expires_atstringoptionalgrantsarray<object>optionalArray item specification
objectlimitone of 2 variantsoptionalVariant 1 string
stringVariant 2 number
numbermessagestringoptionalreasonstringoptionalstarts_atstringoptionalsubjects_fromobjectoptionalObject fields
smart_groupstringrequiredUnknown fields are rejected in this object.
Unknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend/grants/_bulk' \
--header 'Authorization: Bearer <management-key>' \
--header 'Idempotency-Key: create-support-bot-001' \
--header 'Content-Type: application/json' \
--data '{
"expires_at": "2026-10-31T23:59:59Z",
"limit": "25",
"reason": "Launch week",
"subjects_from": {
"smart_group": "support-team"
}
}'
Authentication, errors & retry rules Try it in the playground
/budgets/{budget_id}/usageRead budget usage
Usage of one budget per subject in the current (or a past calendar) window: used, base and effective limits, remaining, percent, state, grant and overflow. Filter by subject, min_pct and state; sort by pct, used or remaining. Usage is a cached snapshot refreshed every few seconds (`as_of`, `stale`).
budgets:readPath, query & header parameters 12
budget_id (path)stringrequiredlimit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
period (query)stringoptionalcurrent (default), previous, or the ISO start of a past calendar window.
min_pct (query)stringoptionalOnly subjects at or above this percent of their limit.
state (query)stringoptionalok, alerting, granted, overflow or blocked.
sort (query)stringoptionalSort order, for example pct, used or remaining.
include_idle (query)stringoptionalAlso list smart-group members and key owners with no usage (true or false).
subject.user (query)stringoptionalUser email.
subject.app (query)stringoptionalApp name.
subject.smart_group (query)stringoptionalSmart group name.
subject.model (query)stringoptionalModel id.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/budgets/support_spend/usage?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
Related
- Rate, token and budget limits - how budgets count usage and what happens at the limit.
- Management API - authentication, errors and retry rules for every endpoint.
- Providers and configuration API - provider model costs that price spend budgets.
- QuilrQL behavior - how the management API behaves while the Policy Engine is on.