What Is Changing
Rate Limiting V1, the singlegateway-rate-limiting-config document holding an ordered rules list, is deprecated. Rate Limiting V2 replaces it with one named limit per config.
Both systems currently run in parallel: V1 is checked first, and V2 is consulted only when no V1 rule blocks the request. Existing V1 rules continue to be enforced during the transition, but new rate limits should be created in V2.
Why This Change
V1 enforced only the first matching rule in a list, so which limit applied to a request depended on rule order, and usage was still counted against every rule the request matched. This made limits hard to reason about and led to shared buckets being saturated by traffic that was never blocked by them. V2 addresses these gaps:- Predictable evaluation: every matching limit must allow a request, so limits compose without depending on order.
- Richer limits: several windows (requests and tokens, per minute, hour, and day) on one limit,
NOT INexclusions, provider account filters, and per-entity overrides. - Safe rollout:
auditandsoft_enforcemodes let you validate a limit before enforcing it. - MCP coverage: rate limit
tools/callrequests through the MCP Gateway.
What You Need to Do
1
Audit your existing V1 rules
List every rule in your
gateway-rate-limiting-config: its when filters, limit_to and unit, and rate_limit_applies_per. Note which rules depended on ordering, where a specific rule was placed above a generic one.2
Recreate each rule in V2 in audit mode
Go to AI Gateway → Policies → Rate Limiting v2 and create an equivalent limit for each V1 rule, using Apply as YAML if you prefer to paste the config. Start with
mode: audit to confirm the limit matches the traffic you expect. See the field mapping below.3
Account for the change in matching behavior
In V1, only the first matching rule blocks a request. In V2, every matching limit is enforced. If a generic V1 rule sat below a specific one, narrow the V2 limit with
NOT IN filters, or use per-entity overrides, so the specific traffic is not capped twice.4
Switch to enforce, then delete the V1 rule
Once a V2 limit behaves correctly in audit mode, set
mode: enforce and delete the corresponding V1 rule. V2 counters start from zero and do not inherit V1 usage, and a request matching both a V1 rule and a V2 limit is counted and blockable by both until you remove the V1 rule.Field Mapping
Example
A V1 rule that gives every user in thebackend team 1,000,000 tokens per day on gpt-4o in production:
Timeline
References
If you have questions about the migration or run into anything unexpected, reach out to support@truefoundry.com.