multi-router.aidocs

Budgets & Spend Control

Rules and AlertsEnterprise

Notifying people and blocking requests at the points of a cap you choose.

A rule says what happens when spend reaches a point of a cap, such as an email at 80% of the total or a block at 100%. Rules are set in the Rules card of a budget, up to 50 per budget, and a budget's caps only track spend until a rule says what happens at a line.

Kinds of rules

A rule either notifies or blocks:

RuleActionEffect
Notifysend an email toEmails a person in the organization once per period.
Notifypost toSends a webhook to an endpoint once per period.
Blockblock requestsOn the total cap: refuses every request the budget covers until the period resets.
Blockblock that routerOn router caps: refuses the router that crossed its line, while the others keep serving.
Blockblock that modelOn model caps: refuses that model only, while the others keep serving.

When a rule acts

Each rule watches one cap and acts at a percentage of it:

SettingValues
WatchesThe total cap, each per-router cap, each model cap, or one model's cap.
When spend reachesA percentage of the cap, from 0.01% to 200%. New rules start at 80%.
When projected to reachOn the total cap: when the current pace reaches the percentage within a chosen number of minutes, 30 by default, up to a week.

A projected rule warns before the line is crossed, such as an alert when the total is projected to reach 100% within 60 minutes. A rule can hold several actions, such as an email, a webhook and a block together.

Firing

A notification fires once per period for each subject it watches, such as each router: the rule shows Firing while it delivers, then Fired this period. A delivery that fails shows Fired · failed, and the rule fires again in a later period when spend reaches the line again. A block holds for as long as spend stays over its line, and the rule shows Holding; raising the cap or the period resetting lifts it.

Email notifications

An email notification goes to the address entered on the rule, which belongs to a person active in the organization, with the subject Production API has reached 80% of its budget and a link to the budget. The Rules card offers email and webhook actions when the installation can send them.

Example

A typical set of rules on a monthly budget:

RuleWatchesAtAction
1Total cap80%Email the team lead.
2Total capProjected 100% within 120 minutesPost to the on-call webhook.
3Each per-router cap100%Block that router.
4Total cap110%Block requests.
Creating a BudgetWebhooks
Was this helpful?