Skip to main content
PUT
/
admin
/
budgets
/
{id}
Update a token budget
curl --request PUT \
  --url https://{organization_id}.platform.barndoor.ai/api/llm-gateway/admin/budgets/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "token_limit": 123,
  "alert_thresholds": [
    123
  ],
  "enabled": true,
  "cost_limit": 123,
  "traffic_type": "all"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "Engineering monthly tokens",
  "token_limit": 50000000,
  "alert_thresholds": [
    80,
    90
  ],
  "traffic_type": "all",
  "currency": "USD",
  "enabled": true,
  "scope_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "scope_value": "<string>",
  "cost_limit": 123,
  "target_provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "target_upstream_model": "<string>",
  "target_model_alias": "<string>"
}

Authorizations

Authorization
string
header
required

JWT obtained through Barndoor's authentication flow. Pass the token verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's loginInteractive() helper to obtain a token in scripts and notebooks.

Path Parameters

id
string<uuid>
required

Body

application/json

All fields optional; sent fields replace the existing value.

name
string
token_limit
integer<int64>
alert_thresholds
integer[]
enabled
boolean
cost_limit
number | null
period
enum<string>
Available options:
daily,
weekly,
monthly,
quarterly,
yearly
action_on_exhaust
enum<string>
  • block — refuse new requests until the next period
  • alert — emit alerts at the configured thresholds but keep serving
Available options:
block,
alert
traffic_type
enum<string>
default:all

Whether the policy applies to LLM, MCP, or both kinds of traffic

Available options:
all,
llm,
mcp

Response

The updated budget

id
string<uuid>
required
org_id
string<uuid>
required
name
string
required
Example:

"Engineering monthly tokens"

scope_type
enum<string>
required

Who the rate limit applies to

Available options:
org,
team,
user,
role,
group,
api_key,
mcp_server,
agent,
project,
llm_provider,
model,
model_alias
period
enum<string>
required
Available options:
daily,
weekly,
monthly,
quarterly,
yearly
token_limit
integer<int64>
required
Example:

50000000

alert_thresholds
integer[]
required
Required range: 0 <= x <= 100
Example:
[80, 90]
action_on_exhaust
enum<string>
required
  • block — refuse new requests until the next period
  • alert — emit alerts at the configured thresholds but keep serving
Available options:
block,
alert
traffic_type
enum<string>
default:all
required

Whether the policy applies to LLM, MCP, or both kinds of traffic

Available options:
all,
llm,
mcp
currency
string
default:USD
required
enabled
boolean
required
scope_id
string<uuid> | null
scope_value
string | null
cost_limit
number | null

Optional spend ceiling in currency

target_provider_id
string<uuid> | null

Restrict to traffic served by a specific provider

target_upstream_model
string | null

Restrict to traffic that ends up at this upstream model

target_model_alias
string | null

Restrict to requests that used this client-facing alias