Budget Limiting V2 shipped in v0.158.0. See the v0.158.0 migration announcement for the V1 deprecation timeline and migration steps.
How budget limiting works
Budget limiting consists of a set of independent rules. Each rule defines which requests it applies to and how much they can spend. During evaluation:- Every matching rule is checked. The gateway finds all rules whose scope and filters match the incoming request.
- All matching rules must allow the request. If any matching rule has exceeded its budget and is in enforcement mode, the request is blocked.
- Cost is tracked against every matching rule. When a request matches multiple rules, usage increments on each of them.
Think of matching rules as an AND across budgets: a request proceeds only when every rule it touches is within its limit.


Tenant and team scopes
Budget rules are created at one of two scopes:
To create a rule, go to AI Gateway → Policies → Budget Limiting and click Add Rule. Select Tenant Budget or Team Budget as the scope, then configure the rule.
Setting up a budget rule
The rule form has two steps: Select a scope and Configure.Scope filters
Define which requests the rule applies to. Filters use AND logic — a request must match every filter you add.
Use + Add Filters to combine subjects, models, provider accounts, and metadata on the same rule.

If you leave all filters empty, the rule matches every request within its tenant or team scope. This is useful for default budgets that apply broadly.
Budget limits
Set one or more spending limits on the same rule using + Add Period. Each limit has an amount and a reset period:
Apply limit as
Controls how the budget is partitioned across matching requests:Overrides
When you choose any per-entity option (per user, per model, per virtual account, or per metadata), you can set overrides — per-entity exceptions that replace the base limits for specific entities. Every other matching entity keeps the base limits; only the listed entities use their override values.
Overrides are only available for per-entity rules. Aggregate (shared) rules use a single pool, so there are no individual entities to override.
Enforcement mode
Block If Usage Limit Exceeded controls whether the rule enforces the budget or runs in warn-only mode:- ON (enforcement mode): Requests are rejected with a budget-exceeded error once usage crosses the limit. In YAML, this is
mode: enforce. - OFF (warn-only mode): Requests are allowed through even when the budget has been exceeded. Usage is still tracked and alerts still fire.
Budget milestone alerts
Enable Send Alerts On Budget Milestones to notify your team when usage crosses percentage thresholds. Select thresholds (75%, 90%, 95%, 100%) and choose a notification channel (email, Slack webhook, or Slack bot).Alert configuration details
Alert configuration details
Available thresholds:
75%, 90%, 95%, 100%Each threshold triggers once per budget period. When a new period starts (or for lifetime budgets, once per threshold crossing), alerts can fire again. Alerts are checked every 20 minutes.Notification channels:-
Email — Send alerts to one or more email addresses via a configured email notification channel
To notify the user who breached the budget, add the placeholder
{{user.email}}to the email target’sto_emails. It’s replaced with that user’s email when the alert fires. This placeholder is only valid for per-user budgets. - Slack Webhook — Send alerts to a Slack channel via a webhook notification channel
- Slack Bot — Send alerts to specific Slack channels via a bot notification channel
Viewing budget usage
Each rule card on the Budget Limiting page shows:- Current usage amount and percentage per limit period
- Budget limit and remaining budget
- Period start time (when the current budget period began)
- Active use breakdown for per-user, per-model, or per-metadata rules
Practical examples
Each example shows both the UI configuration and the equivalent YAML. Click Apply as YAML in the rule form to paste or edit YAML directly.Model spend cap for specific users
Model spend cap for specific users
Cap monthly spending on a specific model for a set of users. Every matching request must stay under the limit.
- UI
- YAML
How it works: Any request from the specified user to the specified model counts against a single shared $1/month pool. If usage exceeds $1, matching requests are blocked.
Per-user daily limits with a team budget
Per-user daily limits with a team budget
A team manager sets a $10/day per-user limit for their team without affecting other teams.
- UI
- YAML
How it works: Each member of
fe-team-mini gets an independent $10/day budget. Any tenant-wide rule that also matches is evaluated separately — both must pass.Per-user budget with overrides
Per-user budget with overrides
Set a low per-user base limit, then raise it for specific users with overrides.
- UI
- YAML
Overrides:
abhishek.choudhary@truefoundry.com → $1/day, $5/month. Every other user stays on the base $0.01/day and $0.10/month limits.Multi-period limits on one rule
Multi-period limits on one rule
Enforce daily, monthly, and quarterly caps in a single rule.
- UI
- YAML
How it works: Usage is tracked against all three periods simultaneously. A request is blocked if any period on this rule is exceeded.
Lifetime budget with warn-only mode
Lifetime budget with warn-only mode
Set a spend cap that never resets — useful for pilot programs or one-time allocations.
- UI
- YAML
How it works: Usage accumulates from rule creation and never resets. With Block If Usage Limit Exceeded off, requests are never blocked — alerts still fire at each threshold so you can monitor the pilot’s spend.
Metadata-based project budgets
Metadata-based project budgets
Track spending per project using metadata sent in the Each unique
X-TFY-METADATA header.- UI
- YAML
Requests must include the header:
project_id value gets its own $100/day budget.Independent safety nets
Independent safety nets
Combine a per-user default with a model-wide cap. Both rules apply to every matching request.
- UI
- YAML
How it works: A user calling GPT-4 is checked against both rules. The per-user $10/day limit and the $500/month model-wide cap must both be satisfied for the request to proceed.
YAML configuration reference
YAML structure reference
YAML structure reference