The limits in one place
People searching for a grok api rate limit usually have one of two problems: they got a 429 and want to know why, or they are planning a project and want to know how much traffic a key can take. This article is about this service, an OpenAI-compatible API with the model ID uncensored. For the limits of xAI's own API, read their current documentation; numbers there change and are not covered here.
| Limit | Full key | Trial key |
|---|---|---|
| Concurrent requests | 8 | 2 |
| Requests per minute | 300 | 60 |
| Max request body | 8 MB | 8 MB |
| Context window | 100,000 tokens | 100,000 tokens |
A trial key is the one you get from the $0.50 trial claim. A full key is what you have once you have topped up. The context window and your prepaid credit are the other ceilings. Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens, which you can check on the pricing page.
Two kinds of 429
When you cross a limit, the API answers with HTTP 429. The JSON error carries a code that tells you which limit you hit, and the fix is different for each.
rate_limited: you sent more than the allowed number of requests in a minute. Spread requests out. Waiting a little before the next request is the fix.concurrency: you have too many requests in flight at once. Adding a delay between starts does not help if each request is slow; you need to wait for earlier ones to finish.
There is a third case. On temporary overload the API also returns 429, with a Retry-After: 5 header. That is not your fault and not a sign you broke a quota. Wait the five seconds and send the same request again.
Failed or refused requests are not charged, so a retry loop does not burn credit on the attempts that were turned away.
Why concurrency usually bites first
Most people compare their traffic to the per-minute number, but the concurrency limit is the one that stops real apps. The maximum steady throughput with N slots and an average request time of d seconds is N times 60 divided by d requests per minute. Here are the numbers for a full key with 8 slots.
| Average request time | Throughput ceiling | Binding limit |
|---|---|---|
| 1 second | 480 per minute | 300 per minute cap |
| 2 seconds | 240 per minute | 8 slots |
| 10 seconds | 48 per minute | 8 slots |
| 30 seconds | 16 per minute | 8 slots |
The timings are examples, not measurements of this service; your own prompts and output lengths decide them. The pattern is the useful part. Long creative replies take tens of seconds, so a chat product with a full key tops out at a few dozen replies per minute, far below 300.
Streaming makes this more visible. A streamed request occupies its slot until the last chunk arrives, not until the first one. If your users read slowly and your client reads slowly from the socket, you hold slots longer than you think. Read the stream as fast as it arrives and process it in a separate task.
On a trial key the same formula gives 2 times 60 divided by 5, or 24 requests per minute, for replies that take 5 seconds. Fine for testing, too small for a public bot.
Read the headers
Every response includes X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. The last two tell you which tier a key is on without guessing, and the balance header shows what is left. Log the request ID with every error; include it when you write to support.
curl -i https://api.nsfwgrok.cc/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "max_tokens": 5, "messages": [{"role": "user", "content": "ping"}]}'Look at the top of the output. You should see the limit headers next to the status line.
Code that stays under the limits
Two controls cover nearly every case: a semaphore sized to your concurrency allowance, and a retry that respects Retry-After. Leave a little headroom, so size the semaphore at 6 or 7 on a full key and 1 or 2 on a trial key.
import asyncio
import random
from openai import AsyncOpenAI, RateLimitError
client = AsyncOpenAI(base_url="https://api.nsfwgrok.cc/v1", api_key="YOUR_KEY", max_retries=0)
slots = asyncio.Semaphore(6)
async def ask(prompt: str, attempts: int = 5) -> str:
for attempt in range(attempts):
async with slots:
try:
resp = await client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": prompt}],
)
return resp.choices[0].message.content
except RateLimitError as err:
retry_after = err.response.headers.get("retry-after")
delay = float(retry_after) if retry_after else min(30, 2 ** attempt)
await asyncio.sleep(delay + random.random())
raise RuntimeError("still rate limited after retries")
async def main():
prompts = [f"Write one line of dialogue, take {i}." for i in range(40)]
results = await asyncio.gather(*(ask(p) for p in prompts))
print(len(results), "done")
asyncio.run(main())The sleep happens outside the async with block on purpose. If you sleep while holding the slot, your own retry blocks the queue behind it. Jitter, the small random addition, keeps many workers from retrying in the same instant.
The official OpenAI SDKs also retry on their own by default, and they read Retry-After. The snippet sets max_retries=0 so you can see the behaviour; in production you may prefer the built-in setting and a plain semaphore.
Debugging a limit you keep hitting
When 429s show up in logs, work through the causes in order of likelihood before you blame the service.
- Check which key you are using. The limit headers tell you whether the request ran on a trial key (2 concurrent, 60 per minute) or a full key (8 concurrent, 300 per minute). A leftover trial key in an environment variable is a common cause of puzzling errors after a top-up.
- Count in-flight calls. Add a counter around the request and log its peak. If it goes above your key's allowance, your own code is starting too many at once, often from a loop that fires every item without a gate.
- Look for retry storms. A client that retries immediately on every 429 multiplies the traffic that caused the error. Add backoff with jitter.
- Look at stuck streams. If a client opens a stream and never reads it to the end, the slot stays taken. Close streams in a finally block.
If the numbers still do not add up, send the request IDs from the X-Request-Id header with your report. A list of IDs and timestamps is far easier to investigate than a description.
Planning capacity and cost together
A limit is also a spending cap in disguise. Say every request carries 2,000 input tokens and 500 output tokens. One request costs 2,000 times $0.15 per 1M plus 500 times $0.50 per 1M, which is $0.0003 plus $0.00025, or $0.00055. If you ran flat out at 300 requests per minute, that is $0.165 per minute and $9.90 per hour. In practice the concurrency ceiling keeps you well under that.
Practical habits that keep traffic smooth:
- Put a queue between your users and the API, and drain it at a fixed rate.
- Set
max_tokenswhere short replies are enough; shorter outputs free slots sooner and cost less. - Do not poll. Use streaming so users see text early without extra requests.
- Use one key per environment, so a test script cannot starve production.
If you consistently need more than 8 slots, this service is probably not the right size for the job on a single key, and it is better to know that before launch. Setup steps are in the quickstart, and you can get a key from the key page.
