API rate limits
Each API key may send 1,000 requests a minute by default and may send all 1,000 at once. Every response carries three X-RateLimit-* headers that say how much is left. Over the limit the answer is 429 with code rate_limit_exceeded and a Retry-After header, and that request is not billed. A higher limit is set for the account by support.
Last updated:
The default limit
| What | Value |
|---|---|
| Limit per key | Value:1,000 requests a minute |
| Burst | Value:1,000 requests |
| Counted | Value:Separately per key: each key of an account has its own bucket |
| Routes | Value:/v1/* (the account API included), /anthropic/* and /gemini/* |
| Concurrent requests | Value:No separate limit |
The limit is a token bucket: up to the limit may be sent at once, and the bucket refills evenly over the minute. A request refused by this limit is not sent to a model vendor and is not billed. The limit shapes speed only, never spend.
Response headers
Every answer on those routes, served or refused, carries these headers. They describe your key on 1xAi.
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Meaning:The requests a minute this key is held to |
X-RateLimit-Remaining | Meaning:Whole requests left in the bucket after this one |
X-RateLimit-Reset | Meaning:Seconds until the bucket is full again; zero when it is full |
Retry-After | Meaning:On a 429 only: seconds until one more request is possible |
HTTP/1.1 200 OK X-RateLimit-Limit: 1000 X-RateLimit-Remaining: 999 X-RateLimit-Reset: 1 X-Request-Id: gw_01JD3Z5T8Q0V6W4M2K9R7N1PXA
A vendor's own rate-limit headers (x-ratelimit-*, anthropic-ratelimit-*) are not forwarded, because they describe our account with the vendor, not your key.
Over the limit: the 429 response
HTTP/1.1 429 Too Many Requests
Retry-After: 1
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 60
Content-Type: application/json; charset=utf-8
{
"error": {
"message": "…",
"type": "rate_limit_exceeded",
"code": "rate_limit_exceeded"
}
}Wait for Retry-After seconds and send again. The official OpenAI and Anthropic SDKs recognise this answer and retry by that header on their own. If you send requests yourself:
import time, httpx
def call(payload, key):
while True:
r = httpx.post(
"https://1xai.ir/v1/chat/completions",
headers={"Authorization": f"Bearer {key}"},
json=payload,
timeout=600,
)
if r.status_code != 429:
return r
# Retry-After is in seconds, on both kinds of 429.
time.sleep(int(r.headers.get("Retry-After", "1")))Two kinds of 429: your limit, or the vendor being busy
Not every 429 is your key's limit. Sometimes the model's vendor refuses the request because it is busy. The response itself tells which one it is:
| Sign | Your key's limit | The vendor is busy |
|---|---|---|
| Error code | Your key's limit:rate_limit_exceeded | The vendor is busy:upstream_capacity on the OpenAI-shaped routes; on /anthropic and /gemini the vendor's own error body (rate_limit_error, RESOURCE_EXHAUSTED) |
X-RateLimit-Remaining | Your key's limit:Zero | The vendor is busy:Usually above zero |
Retry-After | Your key's limit:Ours: until one more request | The vendor is busy:The vendor's, relayed as sent |
| Billed | Your key's limit:No | The vendor is busy:No |
| Does a higher limit help? | Your key's limit:Yes | The vendor is busy:No. Send again shortly, or choose another model |
Other limits on a request
| What | Value | When exceeded |
|---|---|---|
| Request body size | Value:25 MiB | When exceeded:413 |
Body size on /v1/audio/speech | Value:1 MiB | When exceeded:413 |
| Time allowed for the vendor's answer | Value:10 minutes | When exceeded:504 with code upstream_error; not billed when nothing was delivered |
On /anthropic and /gemini, when the vendor answers 429, 503 or 529 and nothing has been sent to you yet, the gateway tries up to 3 times before returning the answer.
A higher limit
If 1,000 requests a minute is not enough, open the API keys page of the dashboard (it is in Persian), choose "request a higher limit" («درخواست سقف بالاتر») and state the limit you need and what you are building. That opens a support ticket. Support sets the limit for the account, and it applies to every key of the account at once, with no change to the keys. There is no self-service raise.
Every error code is listed in the error reference.
1xAi is an independent gateway. It is not affiliated with, endorsed by, or a reseller for OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot AI, Z.ai, Alibaba Qwen, MiniMax or Tencent Hunyuan. Requests are relayed upstream rather than answered by models of our own, so each provider's own usage policies apply to what their models will and will not do, and their model availability is theirs to change. Current reachability is published on the status page.