Skip to content
Docs

Upsert AI Gateway budget

PUThttps://api.vercel.com/ai-gateway/budgets
Create or update a team-, project-, or user-scope AI Gateway budget.
https://api.vercel.com/ai-gateway/budgets
const response = await fetch('https://api.vercel.com/ai-gateway/budgets?teamId=string&slug=string', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"scopeType": "team",
"projectId": "example_id",
"userId": "example_id",
"limitAmount": "123",
"refreshPeriod": "daily",
"includeByokInQuota": "true",
"alertThresholds": []
}),
});
const data = await response.json();
console.log(data);
Response
{
"active": "false",
"alertThresholds": [],
"archived": "false",
"createdAt": "123",
"currentByokSpend": "123",
"currentSpend": "123",
"includeByokInQuota": "false",
"limitAmount": "123",
"name": "Example Name",
"quotaEntityId": "example_id",
"refreshPeriod": "daily",
"scopeId": "example_id",
"scopeType": "api-key",
"source": "default",
"updatedAt": "123"
}
AuthorizationbearerToken

Default authentication mechanism

teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
scopeTypestringRequired
projectIdstringOptional
Required when scopeType is "project".
userIdstringOptional
Required when scopeType is "user".
limitAmountnumberRequired
Budget limit in dollars.
refreshPeriodstringOptional
includeByokInQuotabooleanOptional
Whether BYOK usage counts toward this budget.
alertThresholdsarrayOptional
200Success
activebooleanRequired
alertThresholdsarrayOptional
archivedbooleanRequired
createdAtnumberRequired
currentByokSpendnumberRequired
currentSpendnumberRequired
includeByokInQuotabooleanRequired
limitAmountnumberRequired
namestringOptional
quotaEntityIdstringRequired
refreshPeriodstringRequired
scopeIdstringRequired
The native Vercel id of the scoped entity. Team/project ids already carry their prefix, so this equals quotaEntityId (team_… / prj_…); for the api-key scope it is the api key id (the api_key_id_ prefix stripped).
scopeTypestringRequired
sourcestringOptional
Set when the row is inherited from the team's budget default.
updatedAtnumberRequired
400One of the provided values in the request body is invalid.
401The request is not authorized.
403You do not have permission to access this resource.
404Error
410Error
500Error