Budgets
List the deployment's budgets and the caller's organization's, with pagination.
Enter your API key here (sent as Otari-Key header).
0100Successful Response
Response model for budget information.
max_budget, token_limit and request_limit are the per-user
ceilings, each independent and each unlimited when null, and multiple users
can share one budget, so the usage rollup is an aggregate over the users
assigned to this budget: how many there are and their combined spend /
reserved.
Assigning users to a budget is done through the users API (dashboard support
lands with user management), so a fresh gateway reports zeros here.
'config' while config.yml declares this budget, in which case a start writes the declared values back over any change made through the API when the budget's entry in config.yml changed, and once on the first start after upgrading to a version that tracks this; null otherwise
000Validation Error
GET /api/v1/budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
[
{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"max_budget": 1,
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "text",
"request_limit": 1,
"reset_alignment": "text",
"rpm_limit": 1,
"token_limit": 1,
"total_reserved": 0,
"total_spend": 0,
"tpm_limit": 1,
"updated_at": "text",
"user_count": 0
}
]Create a new budget.
Enter your API key here (sent as Otari-Key header).
Request model for creating a new budget.
Budget duration in seconds (e.g., 86400 for daily, 604800 for weekly)
Maximum spending limit
Admin-facing label for the budget
Maximum requests over the period. Independent of max_budget; null is unlimited
Reset on a UTC calendar boundary instead of a fixed number of seconds, which is the only way to express a calendar month. Mutually exclusive with budget_duration_sec
Requests per minute for each user on this budget, across replicas; null is unlimited
Maximum tokens over the period. Independent of max_budget; null is unlimited
Tokens per minute for each user on this budget, counted on what requests used: a request is admitted while the user's minute is under the limit. Null is unlimited
Successful Response
Response model for budget information.
max_budget, token_limit and request_limit are the per-user
ceilings, each independent and each unlimited when null, and multiple users
can share one budget, so the usage rollup is an aggregate over the users
assigned to this budget: how many there are and their combined spend /
reserved.
Assigning users to a budget is done through the users API (dashboard support
lands with user management), so a fresh gateway reports zeros here.
'config' while config.yml declares this budget, in which case a start writes the declared values back over any change made through the API when the budget's entry in config.yml changed, and once on the first start after upgrading to a version that tracks this; null otherwise
000Validation Error
POST /api/v1/budgets HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 149
{
"budget_duration_sec": 1,
"max_budget": 1,
"name": "text",
"request_limit": 1,
"reset_alignment": "calendar_day",
"rpm_limit": 1,
"token_limit": 1,
"tpm_limit": 1
}{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"max_budget": 1,
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "text",
"request_limit": 1,
"reset_alignment": "text",
"rpm_limit": 1,
"token_limit": 1,
"total_reserved": 0,
"total_spend": 0,
"tpm_limit": 1,
"updated_at": "text",
"user_count": 0
}Get details of a specific budget.
Enter your API key here (sent as Otari-Key header).
Successful Response
Response model for budget information.
max_budget, token_limit and request_limit are the per-user
ceilings, each independent and each unlimited when null, and multiple users
can share one budget, so the usage rollup is an aggregate over the users
assigned to this budget: how many there are and their combined spend /
reserved.
Assigning users to a budget is done through the users API (dashboard support
lands with user management), so a fresh gateway reports zeros here.
'config' while config.yml declares this budget, in which case a start writes the declared values back over any change made through the API when the budget's entry in config.yml changed, and once on the first start after upgrading to a version that tracks this; null otherwise
000Validation Error
GET /api/v1/budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"max_budget": 1,
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "text",
"request_limit": 1,
"reset_alignment": "text",
"rpm_limit": 1,
"token_limit": 1,
"total_reserved": 0,
"total_spend": 0,
"tpm_limit": 1,
"updated_at": "text",
"user_count": 0
}Create a budget under an id you choose, or replace the one with that id.
Every field takes the value in the body, and a field left out is cleared, so the same request always leaves the same budget. Answers 201 when it created the budget. Users on a budget it replaces stay on it, and its ceilings follow a change of reset period. A budget an organization owns is not replaced.
Enter your API key here (sent as Otari-Key header).
An id you choose: up to 128 letters, digits, '.', '_' and '-', starting with a letter or digit
^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$Request model for creating a new budget.
Budget duration in seconds (e.g., 86400 for daily, 604800 for weekly)
Maximum spending limit
Admin-facing label for the budget
Maximum requests over the period. Independent of max_budget; null is unlimited
Reset on a UTC calendar boundary instead of a fixed number of seconds, which is the only way to express a calendar month. Mutually exclusive with budget_duration_sec
Requests per minute for each user on this budget, across replicas; null is unlimited
Maximum tokens over the period. Independent of max_budget; null is unlimited
Tokens per minute for each user on this budget, counted on what requests used: a request is admitted while the user's minute is under the limit. Null is unlimited
Successful Response
Response model for budget information.
max_budget, token_limit and request_limit are the per-user
ceilings, each independent and each unlimited when null, and multiple users
can share one budget, so the usage rollup is an aggregate over the users
assigned to this budget: how many there are and their combined spend /
reserved.
Assigning users to a budget is done through the users API (dashboard support
lands with user management), so a fresh gateway reports zeros here.
'config' while config.yml declares this budget, in which case a start writes the declared values back over any change made through the API when the budget's entry in config.yml changed, and once on the first start after upgrading to a version that tracks this; null otherwise
000The budget was created
Validation Error
PUT /api/v1/budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 149
{
"budget_duration_sec": 1,
"max_budget": 1,
"name": "text",
"request_limit": 1,
"reset_alignment": "calendar_day",
"rpm_limit": 1,
"token_limit": 1,
"tpm_limit": 1
}{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"max_budget": 1,
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "text",
"request_limit": 1,
"reset_alignment": "text",
"rpm_limit": 1,
"token_limit": 1,
"total_reserved": 0,
"total_spend": 0,
"tpm_limit": 1,
"updated_at": "text",
"user_count": 0
}Update a budget.
Enter your API key here (sent as Otari-Key header).
Request model for updating a budget.
Maximum requests over the period. Independent of max_budget; null is unlimited
Requests per minute for each user on this budget, across replicas; null is unlimited
Maximum tokens over the period. Independent of max_budget; null is unlimited
Tokens per minute for each user on this budget, counted on what requests used: a request is admitted while the user's minute is under the limit. Null is unlimited
Successful Response
Response model for budget information.
max_budget, token_limit and request_limit are the per-user
ceilings, each independent and each unlimited when null, and multiple users
can share one budget, so the usage rollup is an aggregate over the users
assigned to this budget: how many there are and their combined spend /
reserved.
Assigning users to a budget is done through the users API (dashboard support
lands with user management), so a fresh gateway reports zeros here.
'config' while config.yml declares this budget, in which case a start writes the declared values back over any change made through the API when the budget's entry in config.yml changed, and once on the first start after upgrading to a version that tracks this; null otherwise
000Validation Error
PATCH /api/v1/budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 149
{
"budget_duration_sec": 1,
"max_budget": 1,
"name": "text",
"request_limit": 1,
"reset_alignment": "calendar_day",
"rpm_limit": 1,
"token_limit": 1,
"tpm_limit": 1
}{
"budget_duration_sec": 1,
"budget_id": "text",
"created_at": "text",
"max_budget": 1,
"name": "text",
"organization_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "text",
"request_limit": 1,
"reset_alignment": "text",
"rpm_limit": 1,
"token_limit": 1,
"total_reserved": 0,
"total_spend": 0,
"tpm_limit": 1,
"updated_at": "text",
"user_count": 0
}Delete a budget the deployment owns.
Refused with 409 for an organization's budget: the operator may edit one (PATCH retimes its ceilings) but deleting it would take a budget the tenant defined out from under them.
Refused with 409, too, while anything still names this budget: a workspace handing it to its members, or a scoped ceiling enforcing it. The refusal says which, and where.
Gateway users assigned to the budget are left uncapped, as the dashboard's confirmation says, its reset history is deleted with it, and it is taken off every service key's end_user_budget_ids. A budget that is a key's end_user_budget_id is refused (409) until that key's default changes.
Enter your API key here (sent as Otari-Key header).
Successful Response
No content
Validation Error
DELETE /api/v1/budgets/{budget_id} HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
No content
List per-user reset events for a budget, newest first.
Enter your API key here (sent as Otari-Key header).
0100Successful Response
Response model for one budget reset event (per user).
Validation Error
GET /api/v1/budgets/{budget_id}/reset-logs HTTP/1.1
Otari-Key: YOUR_API_KEY
Accept: */*
[
{
"budget_id": "text",
"id": 1,
"next_reset_at": "text",
"previous_spend": 1,
"reset_at": "text",
"user_id": "text"
}
]Last updated
Was this helpful?
