For the complete documentation index, see llms.txt. This page is also available as Markdown.

Scoped budgets

List Scoped Budgets

get

List the scoped budgets in the caller's organization, optionally filtered to one scope.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Query parameters
scope_typestring · enum · nullableOptionalPossible values:
scope_idstring · max: 255 · nullableOptional
skipintegerOptionalDefault: 0
limitinteger · min: 1 · max: 1000OptionalDefault: 100
Responses
200

Successful Response

application/json

One scoped ceiling and its live counters.

Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is enforced against current_spend + reserved_spend, so there is no rollup over users to compute.

Every limit, along with budget_duration_sec and reset_alignment, is read off the budget rather than stored here, and carried on the wire so a caller can render a ceiling without fetching every budget to resolve one id.

budget_duration_secinteger · nullableRequired
budget_idstringRequired
created_atstringRequired
current_requestsintegerRequired
current_spendnumberRequired
current_tokensintegerRequired
idstringRequired
max_budgetnumber · nullableRequired
namestring · nullableRequired
period_endstring · nullableRequired
period_startstring · nullableRequired
provider_key_idstring · nullableRequired
request_limitinteger · nullableRequired
reserved_requestsintegerRequired
reserved_spendnumberRequired
reserved_tokensintegerRequired
reset_alignmentstring · nullableRequired
scope_idstringRequired
scope_typestringRequired
token_limitinteger · nullableRequired
updated_atstringRequired
get/api/v1/scoped-budgets
GET /api/v1/scoped-budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
[
  {
    "budget_duration_sec": 1,
    "budget_id": "text",
    "created_at": "text",
    "current_requests": 1,
    "current_spend": 1,
    "current_tokens": 1,
    "id": "text",
    "max_budget": 1,
    "name": "text",
    "period_end": "text",
    "period_start": "text",
    "provider_key_id": "text",
    "request_limit": 1,
    "reserved_requests": 1,
    "reserved_spend": 1,
    "reserved_tokens": 1,
    "reset_alignment": "text",
    "scope_id": "text",
    "scope_type": "text",
    "token_limit": 1,
    "updated_at": "text"
  }
]

Create Scoped Budget

post

Create a scoped budget.

Answers 404 when the scope names nothing, rather than creating a ceiling that can never bind.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Body

Request model for creating a scoped budget.

budget_idstring · min: 1 · max: 255Required

The budget this ceiling enforces; its limit and period are read through it

namestring · max: 200 · nullableOptional

Admin-facing label for this ceiling

provider_key_idstring · min: 1 · max: 255 · nullableOptional

Narrow the cap to one provider instance; omit or null to cap spend across every provider. A blank value would store a ceiling that never binds, so it is refused; this does not check that the value names a configured provider instance

Pattern: ^\S+$
scope_idstring · min: 1 · max: 255Required

Id of the capped identity: an organization, workspace, membership row, or API key

scope_typestring · enumRequired

Which kind of identity this ceiling caps

Possible values:
Responses
200

Successful Response

application/json

One scoped ceiling and its live counters.

Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is enforced against current_spend + reserved_spend, so there is no rollup over users to compute.

Every limit, along with budget_duration_sec and reset_alignment, is read off the budget rather than stored here, and carried on the wire so a caller can render a ceiling without fetching every budget to resolve one id.

budget_duration_secinteger · nullableRequired
budget_idstringRequired
created_atstringRequired
current_requestsintegerRequired
current_spendnumberRequired
current_tokensintegerRequired
idstringRequired
max_budgetnumber · nullableRequired
namestring · nullableRequired
period_endstring · nullableRequired
period_startstring · nullableRequired
provider_key_idstring · nullableRequired
request_limitinteger · nullableRequired
reserved_requestsintegerRequired
reserved_spendnumberRequired
reserved_tokensintegerRequired
reset_alignmentstring · nullableRequired
scope_idstringRequired
scope_typestringRequired
token_limitinteger · nullableRequired
updated_atstringRequired
post/api/v1/scoped-budgets
POST /api/v1/scoped-budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 105

{
  "budget_id": "text",
  "name": "text",
  "provider_key_id": "text",
  "scope_id": "text",
  "scope_type": "organization"
}
{
  "budget_duration_sec": 1,
  "budget_id": "text",
  "created_at": "text",
  "current_requests": 1,
  "current_spend": 1,
  "current_tokens": 1,
  "id": "text",
  "max_budget": 1,
  "name": "text",
  "period_end": "text",
  "period_start": "text",
  "provider_key_id": "text",
  "request_limit": 1,
  "reserved_requests": 1,
  "reserved_spend": 1,
  "reserved_tokens": 1,
  "reset_alignment": "text",
  "scope_id": "text",
  "scope_type": "text",
  "token_limit": 1,
  "updated_at": "text"
}

Get Scoped Budget

get

Get one scoped budget.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
budget_idstringRequired
Responses
200

Successful Response

application/json

One scoped ceiling and its live counters.

Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is enforced against current_spend + reserved_spend, so there is no rollup over users to compute.

Every limit, along with budget_duration_sec and reset_alignment, is read off the budget rather than stored here, and carried on the wire so a caller can render a ceiling without fetching every budget to resolve one id.

budget_duration_secinteger · nullableRequired
budget_idstringRequired
created_atstringRequired
current_requestsintegerRequired
current_spendnumberRequired
current_tokensintegerRequired
idstringRequired
max_budgetnumber · nullableRequired
namestring · nullableRequired
period_endstring · nullableRequired
period_startstring · nullableRequired
provider_key_idstring · nullableRequired
request_limitinteger · nullableRequired
reserved_requestsintegerRequired
reserved_spendnumberRequired
reserved_tokensintegerRequired
reset_alignmentstring · nullableRequired
scope_idstringRequired
scope_typestringRequired
token_limitinteger · nullableRequired
updated_atstringRequired
get/api/v1/scoped-budgets/{budget_id}
GET /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
  "budget_duration_sec": 1,
  "budget_id": "text",
  "created_at": "text",
  "current_requests": 1,
  "current_spend": 1,
  "current_tokens": 1,
  "id": "text",
  "max_budget": 1,
  "name": "text",
  "period_end": "text",
  "period_start": "text",
  "provider_key_id": "text",
  "request_limit": 1,
  "reserved_requests": 1,
  "reserved_spend": 1,
  "reserved_tokens": 1,
  "reset_alignment": "text",
  "scope_id": "text",
  "scope_type": "text",
  "token_limit": 1,
  "updated_at": "text"
}

Update Scoped Budget

patch

Relabel a ceiling, or point it at a different budget.

The scope and the provider narrowing are not editable: changing either would move the ceiling to a different identity while carrying its spend, which is a delete and a create, not an update.

There is no limit or period to set here any more. Both are properties of the budget, so changing what a ceiling allows is either editing that budget, which moves every ceiling naming it, or naming a different one.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
budget_idstringRequired
Body

Request model for updating a scoped budget.

budget_idstring · min: 1 · max: 255 · nullableOptional
namestring · max: 200 · nullableOptional
Responses
200

Successful Response

application/json

One scoped ceiling and its live counters.

Unlike /api/v1/budgets, the counters are the row's own: a scoped ceiling is enforced against current_spend + reserved_spend, so there is no rollup over users to compute.

Every limit, along with budget_duration_sec and reset_alignment, is read off the budget rather than stored here, and carried on the wire so a caller can render a ceiling without fetching every budget to resolve one id.

budget_duration_secinteger · nullableRequired
budget_idstringRequired
created_atstringRequired
current_requestsintegerRequired
current_spendnumberRequired
current_tokensintegerRequired
idstringRequired
max_budgetnumber · nullableRequired
namestring · nullableRequired
period_endstring · nullableRequired
period_startstring · nullableRequired
provider_key_idstring · nullableRequired
request_limitinteger · nullableRequired
reserved_requestsintegerRequired
reserved_spendnumberRequired
reserved_tokensintegerRequired
reset_alignmentstring · nullableRequired
scope_idstringRequired
scope_typestringRequired
token_limitinteger · nullableRequired
updated_atstringRequired
patch/api/v1/scoped-budgets/{budget_id}
PATCH /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 34

{
  "budget_id": "text",
  "name": "text"
}
{
  "budget_duration_sec": 1,
  "budget_id": "text",
  "created_at": "text",
  "current_requests": 1,
  "current_spend": 1,
  "current_tokens": 1,
  "id": "text",
  "max_budget": 1,
  "name": "text",
  "period_end": "text",
  "period_start": "text",
  "provider_key_id": "text",
  "request_limit": 1,
  "reserved_requests": 1,
  "reserved_spend": 1,
  "reserved_tokens": 1,
  "reset_alignment": "text",
  "scope_id": "text",
  "scope_type": "text",
  "token_limit": 1,
  "updated_at": "text"
}

Delete Scoped Budget

delete

Delete a scoped budget.

A request holding a reservation against it settles into nothing afterwards, which is the right outcome: the ceiling no longer exists to be credited.

Authorizations
Otari-KeystringRequired

Enter your API key here (sent as Otari-Key header).

Path parameters
budget_idstringRequired
Responses
204

Successful Response

No content

delete/api/v1/scoped-budgets/{budget_id}
DELETE /api/v1/scoped-budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*

No content

Last updated

Was this helpful?