Gate Rate Limiting
Gate/AI enforces limits at the edge, before a request reaches your provider key. A gate-wide ceiling protects your bill from spikes; per-device budgets stop one user from spending everyone's allowance; tier overrides turn "you've hit your limit" into an upgrade moment.
Two kinds of limits
Gate rate limit
Core and ProA hard ceiling on requests per minute across every device using the gate. It's the circuit breaker: a scripted client, a runaway retry loop, or a viral moment can't run up your provider bill past the number you chose.
Configure it from the gate page → Gate node → Gate rate limit. Blank means no cap (system ceilings still apply).
Device usage limits
ProA budget each device gets over a reset period — requests and/or tokens — plus an optional daily burst cap, with overrides per user tier. This is the limit your users feel, so it comes with usage headers and informative errors your app can turn into meters and upgrade prompts.
Configure it from the gate page → Quotas node.
Setting up device limits
The Quotas panel walks through the policy top to bottom and restates it in English before you save.
-
1
Pick a reset period
Calendar month resets for everyone on the 1st (UTC) and is the easiest to explain. Rolling 30 days has no cliff at month end but is harder to show in a meter. User's billing cycle resets on each user's renewal day and lines up with your paywall — it needs the app to report the renewal day (see below). A device is measured against one period; pick the one that matches how you sell.
-
2
Set the budget per device
Requests and tokens for that period. Turn a metric off to leave it uncapped. Presets are there so you don't count zeros.
-
3
Optionally cap each day
A burst limit on top of the budget so one device can't spend a month's allowance in an afternoon. Resets at midnight UTC.
-
4
Add tier overrides
For each userTier your app sends, choose per metric: same as default, a custom amount, or unlimited. Names must match the client value exactly (case-sensitive).
-
5
Save
Limits take effect on the next request. The strip on the gate page shows the policy and how many devices were throttled today.
How enforcement counts. The request that crosses a quota is allowed; requests after it are rejected until the window resets. Rejected requests consume no budget. All windows are UTC. A device is identified by the SDK's device identifier, falling back to IP address when it isn't sent.
Billing-cycle periods
To measure a device against the user's own subscription month, the app reports the day of month their subscription renews (from StoreKit, Play Billing, or RevenueCat). Days 29–31 clamp to short months automatically. Requires SDK 1.1.0+. Devices that never report a day still accrue usage from their first request, so nobody is exempt.
Swift
gateAIClient.quotaAnchorDay = renewalDayOfMonth // 1–31
Kotlin
gateAIClient.quotaAnchorDay = renewalDayOfMonth // 1–31
Tiers: the cap as your paywall
Set a modest default budget, then give paying tiers more — or no limit at all. When a free user hits the cap, the 429 tells your app exactly which window closed and when it reopens, which is the moment to show the upgrade screen.
| Example policy | Requests / month | Tokens / month |
|---|---|---|
| Default (no tier, or an unknown tier) | 200 | 100,000 |
pro
|
5,000 | Unlimited |
team
|
Same as default | 2,000,000 |
The app sets gateAIClient.userTier = "pro" after a purchase (see the analytics guide). Tier is an enforcement key, so keep names stable; use userStatus for anything free-form.
What your app sees
Quota headers on every response
Remaining budget for the tightest configured window, per metric, so you can render a meter without a separate call:
- X-Quota-Requests-Remaining · X-Quota-Requests-Limit · X-Quota-Requests-Reset
- X-Quota-Tokens-Remaining · X-Quota-Tokens-Limit · X-Quota-Tokens-Reset
The SDKs parse these into GateAIQuotaStatus (Swift) / QuotaStatus (Kotlin) with used-fraction helpers.
A structured 429 when a limit is hit
{ "error": "rate_limited",
"code": "device_monthly_requests_exceeded",
"window": "monthly", "limit": 200, "used": 200,
"resets_at": "2026-10-01T00:00:00.000Z" }
Exposed as GateAIError.rateLimitInfo / GateApiException.rateLimitInfo.
| Code | Meaning |
|---|---|
| device_daily_requests_exceeded / device_daily_tokens_exceeded | The daily burst cap for this device. |
| device_monthly_requests_exceeded / device_monthly_tokens_exceeded | Calendar-month budget. |
| device_rolling_30d_requests_exceeded / device_rolling_30d_tokens_exceeded | Rolling 30-day budget. |
| device_cycle_requests_exceeded / device_cycle_tokens_exceeded | User's billing-cycle budget. |
| gate_requests_per_minute_exceeded | The gate-wide ceiling; nothing to do with this particular device. |
| account_unique_clients_exceeded | Your plan's monthly unique-device allowance is used up (Free: 25). |
| global_rpm_exceeded | A platform-wide safety ceiling; contact support if you see this. |
Rate-limited requests appear in Logs with an RL badge and in the Analytics tab's rate-limit offenders, and the strip on the gate page counts devices throttled today.