Rate limiting
Rate limiting controls how many requests a gateway or an individual auth token accepts within a time window. The gateway enforces rate limits before any upstream call is made, so blocked requests never reach the AI provider.
How rate limiting works
Each limit counts the requests of a trailing window of window_sec seconds — exactly for limits of up to 64 requests, with a two-bucket approximation above that. Only admitted requests use up the window, X-RateLimit-Remaining says how many more are admissible right now, and a rejection's Retry-After says when the next one will be.
Window semantics
requestsup to 64: exact. The gateway keeps the admission time of every request in the trailing window. A request is admitted only while fewer thanrequestsadmitted requests are younger thanwindow_sec. A client that sends exactly at the limit is never refused.requestsabove 64: approximated from two buckets, the previous window and the current one:previous × (1 − elapsed / window_sec) + current. For uneven traffic this can admit earlier or later than an exact count. In the worst case, close to twice the limit can pass within one trailing window.- Per node: each gateway node counts its own traffic in node memory. A restart, or memory pressure that evicts an idle entry, starts that window again. A change of
requestsacross 64 also starts the window again once. - Heavy concurrent load: a request that cannot get the lock of its limit at once is decided by a stricter rule that holds back capacity, so the limit is not exceeded. Such a request can be refused slightly early, and its
Retry-Aftercan be longer than necessary. - Memory full: if the node cannot store the count, a limit of up to 64 refuses the request (
429). A larger limit decides on the stored counts and admits the request without recording it. Each case is logged as an error.
Two independent limit levels exist:
- Gateway-level rate limit — applies to the aggregate of all requests through the gateway.
- Per-token rate limit — applies only to requests authenticated with a specific auth token.
Both levels are evaluated independently. A request can be blocked by the gateway-level limit even if the limit of the token has not been reached, and vice versa.
Rate limit configuration fields
| Field | Type | Description |
|---|---|---|
requests |
integer | Maximum number of requests allowed in the window. Whole number from 1 to 1000000000. |
window_sec |
integer | Length of the sliding window in seconds. Whole number from 1 to 31536000 (one year). |
The gateway rejects a zero, negative, decimal, non-numeric or too-large value with 400. The token forms check the same limits before they send the request and show the error in your language.
Response headers
When a request is rate limited, the gateway returns HTTP 429 with the following headers:
| Header | Description |
|---|---|
X-RateLimit-Limit |
The configured request limit for the window. |
X-RateLimit-Remaining |
Requests still admissible right now in the trailing window (0 when blocked). Also sent on admitted responses. |
Retry-After |
Whole seconds (rounded up) until a request would be admitted again. |
⭐ Example:
429response body:
The message is dynamic and states the observed count, the limit, and the window
(Token rate limit: … when a per-token limit is the one exceeded). Branch on the stable
code, never on the message text.
⚠️ Caution: Clients must implement backoff and retry logic. The
Retry-Afterheader gives the seconds until the next request would be admitted — waiting at least this long before sending one request is sufficient unless other requests on the same limit take the freed capacity first.
Configuring a gateway-level rate limit
The gateway-level rate limit applies to the aggregate of all requests through the gateway.
Before you begin, ensure the following conditions are met:
- ☑ You have the
tenant_adminoradminrole.

Proceed as follows to configure a gateway-level rate limit:
- Open Organisation › AI setup › Gateways.
- Click on the Open → button of the gateway.
- The gateway page opens on the Endpoint & keys tab.
- Click on the Edit button in the Gateway card header.
- The gateway settings page opens (
…/gateways/<gateway>/settings).
- The gateway settings page opens (
- Enter the request count in the Rate Limit (req) text field.
- Enter the window duration in seconds in the Rate Window (s) text field.
- Click on the Save Changes button in the bar at the bottom of the page.
-> The gateway enforces the new rate limit on every subsequent request.
A gateway has no rate limit until you set one, and an empty Rate Limit (req) field means exactly that — no limit, not a hidden default. Clearing the field and saving removes the limit.
💡 Note: The
100requests per60seconds fallback mentioned in older documentation is not a default for an empty field. It applies only to a stored rate limit that is missing its request count — for example one written directly through the API — and never to a gateway that simply has no rate limit configured.⚠️ Caution: An absent rate limit and a malformed one are handled differently. Absent means "no limit". A malformed stored rate-limit configuration (a value of the wrong shape, not merely a missing one) is not silently ignored: the gateway fails closed and refuses every request on that scope with
configuration_error(HTTP500) until the value is corrected. Fix the stored configuration to restore traffic.
Configuring a per-token rate limit
A per-token rate limit applies only to requests authenticated with a specific auth token. Attach it to a token at creation time.
Before you begin, ensure the following conditions are met:
- ☑ You have the
tenant_adminoradminrole.

Proceed as follows to configure a per-token rate limit:
- Open the Members view.
- Click the open action icon on the user's row.
- The user detail view opens.
- Click on the New Token button in the Tokens card.
- The New Token for
<email>dialog opens.
- The New Token for
- Select the gateway, then enter the request count in the first input of the Rate limit (req/window) field.
- Enter the window duration in seconds in the second input of the same field. It stays disabled until you enter a request count.
- Leave the request count blank to create the token without its own rate limit. The gateway-level rate limit, if set, still applies.
- Leave only the window blank to use a window of 60 seconds.
- Click on the Create Token button.
-> The token rate limit applies to every request authenticated with the new token.
API
Rate limits are part of the gateway config object and the token creation request. See Tenants & Gateways API and Users & Tokens API for examples.
See also
- Rate limiting — what rate limiting is and why
- Gateway Configuration
- Budget & Quota Enforcement
- Authentication & Tokens