Zuplo API v4
Zuplo Developer API

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

GET
https://dev-api-v4-main-a471234.zuplo.app
/v4/buckets/{bucketId}/ai/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.

Get the gateway's budget rules › path Parameters

bucketId
​string · maxLength: 64 · required

The 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.

A set of limits counted per app, or per value of an expression (for example per end user).
budgetBy
​BudgetBy · enum · required

What 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.

Enum values:
app
expression
expression
​string | null · required

For budgetBy: expression, what to count separately, for example request.user.sub. Null otherwise.

​BudgetLimit[] · required

The limits of this rule.


Set the gateway's budget rules

PUT
https://dev-api-v4-main-a471234.zuplo.app
/v4/buckets/{bucketId}/ai/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.

Set the gateway's budget rules › path Parameters

bucketId
​string · maxLength: 64 · required

The bucket ID (bckt_…). Everything in a bucket is addressed under it.

Set the gateway's budget rules › Request Body

​BudgetRuleInput[] · maxItems: 5

The gateway's budget rules, replacing the ones it has. [] removes them.

A budget rule.
budgetBy
​BudgetBy · enum · required

What 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.

Enum values:
app
expression
​BudgetLimitInput[] · maxItems: 24 · required

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.

expression
​string | null · maxLength: 512

Required 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.

A set of limits counted per app, or per value of an expression (for example per end user).
budgetBy
​BudgetBy · enum · required

What 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.

Enum values:
app
expression
expression
​string | null · required

For budgetBy: expression, what to count separately, for example request.user.sub. Null otherwise.

​BudgetLimit[] · required

The limits of this rule.