Budget Rules
The AI Gateway's own budget: the rules for all of its traffic, on top of the
budgets of its pools and apps. A project has exactly one AI Gateway, which
keeps its data in the project's production bucket, so its budget rules are a
singleton list, read and set as a whole at
/v4/buckets/{bucketId}/ai/budget-rules, never created or deleted. The
gateway's URL, and whether it serves a change yet, are the project's
production environment and its deployments
(/v4/projects/{projectId}/environments).
Get the gateway's budget rules
Returns the budget of the AI Gateway that keeps its data in this bucket: the
rules for all of its traffic, on top of the budgets of its pools and apps.
[] when the gateway has no budget of its own.
path Parameters
bucketIdThe bucket ID (bckt_…). Everything in a bucket is addressed under it.
Get the gateway's budget rules › Responses
The gateway's budget rules.
The gateway's own budget. A budgetBy: app rule limits the combined
traffic of every pool, app and user app. A budgetBy: expression rule
gives each distinct value its own budget across the whole gateway, for
example each person with request.user.sub. Empty when the gateway has
no budget of its own.
budgetByWhat one budget is counted for. app: one budget for all the traffic the
rule covers, that of an app or everything in a pool or the gateway.
expression: one budget per distinct value of expression, for example per
end user.
expressionFor budgetBy: expression, what to count separately, for example request.user.sub. Null otherwise.
The limits of this rule.
Set the gateway's budget rules
Sets the gateway's own budget, replacing the rules it had, so sending the
same request again changes nothing. The body is the complete list of rules,
and [] removes them. The gateway's budget applies in addition to the
budgets of its pools and apps: a request is blocked when any of them is
exhausted.
Returns 201 when the gateway had no budget rules and now has, and 200
otherwise.
path Parameters
bucketIdThe bucket ID (bckt_…). Everything in a bucket is addressed under it.
Set the gateway's budget rules › Request Body
The gateway's budget rules, replacing the ones it has. [] removes them.
budgetByWhat one budget is counted for. app: one budget for all the traffic the
rule covers, that of an app or everything in a pool or the gateway.
expression: one budget per distinct value of expression, for example per
end user.
The limits. At most one per meter, period and action; a warn value must be below the block value for the same meter and period.
expressionRequired for budgetBy: expression; must be omitted otherwise.
Set the gateway's budget rules › Responses
The gateway's budget rules were replaced.
The gateway's own budget. A budgetBy: app rule limits the combined
traffic of every pool, app and user app. A budgetBy: expression rule
gives each distinct value its own budget across the whole gateway, for
example each person with request.user.sub. Empty when the gateway has
no budget of its own.
budgetByWhat one budget is counted for. app: one budget for all the traffic the
rule covers, that of an app or everything in a pool or the gateway.
expression: one budget per distinct value of expression, for example per
end user.
expressionFor budgetBy: expression, what to count separately, for example request.user.sub. Null otherwise.
The limits of this rule.