Rate Limit in WAF vs API Rate Limits: What Applies
A rate limit in WAF rules counts requests per client and blocks the excess before it reaches your app. An LLM API has its own limits on top. Here is how the two layers differ and how to size both.

Key points
- A WAF rate rule counts requests per client over a time window and acts at the edge of your own app.
- This API limits per key: 8 concurrent requests and 300 per minute on a full key, 2 and 60 on a trial key.
- Concurrency usually bites before requests per minute, because long generations hold their slot.
- Prepaid billing caps spend; it is separate from the rate limits.
What a rate limit in a WAF does
A web application firewall sits in front of a web app and inspects each request. One of its common jobs is rate limiting. A rate limit in WAF configuration says: for each client, count requests that match a pattern over a time window, and when the count passes a threshold, take an action. The action might be to block, to serve a challenge, to log only, or to slow the client down.
The parts of such a rule are the same across products, even though the names differ:
- Key. What counts as one client: usually an IP address, sometimes a header, a cookie, an API key or an authenticated user ID.
- Match. Which requests are counted, such as a path like
/api/chator a method like POST. - Window and threshold. For example, 60 requests per 60 seconds. Some systems use fixed windows, others slide the window, and the difference shows up at boundaries: a fixed window lets a client send a full burst at the end of one window and another at the start of the next.
- Action and duration. Block for a minute, challenge, or only record the event.
The purpose is protection of your own service from abuse, scraping, credential stuffing and runaway scripts. Check your WAF vendor's documentation for exact rule syntax, because the fields and the available windows vary.
How an API rate limit differs
An API provider's limit looks similar but sits at a different place. It protects the provider's model servers from any single customer taking too much capacity. It is applied per API key, not per visitor IP, and it comes with a response format meant for programs.
For this API the limits are:
| Key type | Requests per minute | Concurrent requests |
|---|---|---|
| Full key | 300 | 8 |
| Trial key | 60 | 2 |
The maximum request body is 8 MB. Responses carry X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency headers so a client can read its own ceiling, plus X-Request-Id and X-Balance-USD. When you go over, the API returns HTTP 429. The error code is rate_limited if you exceeded requests per minute and concurrency if you had too many requests in flight. A 429 with a Retry-After: 5 header signals temporary overload and means: wait five seconds.
The key difference is the second dimension. Most WAF rules count requests over time. Concurrency, the number of requests running at the same instant, is a separate limit that a typical edge rule does not track.
Why concurrency binds first
Take a full key: 300 requests per minute is 5 per second. That sounds like the real ceiling, but language model calls are slow compared with ordinary web requests, because the server generates text token by token. A streamed request holds its concurrency slot until the stream ends.
The relationship is simple. With 8 slots, the maximum sustainable throughput is 8 divided by the average request duration. The durations below are assumptions for illustration; measure your own.
| Average time per request | Max throughput with 8 slots | Binding limit |
|---|---|---|
| 20 seconds | 24 requests per minute | Concurrency |
| 5 seconds | 96 requests per minute | Concurrency |
| 1.6 seconds | 300 requests per minute | Both at once |
The arithmetic: 8 slots x 60 seconds / 20 seconds = 24, and 8 x 60 / 5 = 96. Only if replies finish in under about 1.6 seconds does the 300 per minute cap come into play. For long outputs, the 8-slot limit is the one you will meet. For a trial key with 2 slots, the same 20-second replies give 2 x 60 / 20 = 6 requests per minute.
A practical consequence: capping max_tokens shortens generations and frees slots sooner. It is optional on this API, since the completion can use the rest of the 100,000-token window, but a cap makes capacity predictable.
Using both layers together
If your own app sits in front of the API, for instance a chat site that forwards user messages, you can use a WAF rule to protect that app and an in-app limiter to protect your key. The layers do different jobs.
- WAF rule per IP or user. Stops one visitor from flooding your chat route. A rule like 10 requests per minute per IP on the chat path is typical. An illustrative shape, not any vendor's syntax:
{
"match": {"path": "/api/chat", "method": "POST"},
"key": "client_ip",
"window_seconds": 60,
"threshold": 10,
"action": "block",
"block_seconds": 60
}
- In-app semaphore. Keeps your total in-flight calls at or below 8 (or 2 on a trial key), so a burst from many users queues instead of failing.
- Retry on 429. Handles the occasional overload response.
The sizing question follows from the numbers above. If each user is allowed 10 requests per minute and the key allows 300, then 30 users can run at their ceiling at once. Beyond that, you queue or you add keys, within the terms of the service. The WAF threshold should sit comfortably under what your key can serve, otherwise the API limit becomes your real rule and your users see 429 errors you did not design.
Handling 429 correctly in code
Treat a 429 as a signal, not a failure. Honour the Retry-After header when present, back off with jitter when it is not, and give up after a few tries. Failed or refused requests are not charged, so retrying costs nothing extra.
import random
import time
import requests
URL = "https://api.wannsfw.com/v1/chat/completions"
def chat(payload, key, tries=5):
for attempt in range(tries):
r = requests.post(
URL,
headers={"Authorization": "Bearer " + key},
json=payload,
timeout=120,
)
if r.status_code == 429:
wait = float(r.headers.get("Retry-After", 2 ** attempt))
if "concurrency" in r.text:
wait = max(wait, 1.0)
time.sleep(wait + random.random())
continue
r.raise_for_status()
return r.json()
raise RuntimeError("still rate limited after retries")
reply = chat(
{"model": "uncensored", "messages": [{"role": "user", "content": "Say hello."}]},
key="paste-your-key-here",
)
print(reply["choices"][0]["message"]["content"])
For many parallel jobs, cap your own concurrency instead of relying on retries. In Python, asyncio.Semaphore(8) or a thread pool with 8 workers does it. In Node, a small queue library or a manual counter works. Retrying is for the rare overload; a semaphore prevents the normal case from ever returning a 429.
Context window, body size and billing
Three other limits get mixed up with rate limits, so it helps to separate them.
Context window. 100,000 tokens, prompt plus completion. This is about tokens, not requests. A request that does not fit is rejected, and no waiting will fix it. The fix is shorter history.
Body size. 8 MB maximum. This is about bytes, so it rarely binds for text. It can if you paste huge documents or send many base64 blobs inside messages, though this API is text only.
Billing. Prepaid credit at $0.15 per 1M input tokens and $0.50 per 1M output tokens. Your balance is a spending cap, not a rate limit: when it reaches zero, requests stop being served until you top up, and the X-Balance-USD header lets you watch it fall. Top-ups range from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200, paid in USDT on TRC20 or USDC on Base. Credit never expires.
A worked check: a 50,000-token prompt with a 2,000-token answer costs 50,000 x $0.15 / 1M = $0.0075 plus 2,000 x $0.50 / 1M = $0.001, so $0.0085. At the 24 requests per minute from the 20-second example, that stream of calls costs $0.204 per minute, or $12.24 per hour of continuous use. Large prompts burn credit faster than they hit any request limit, which is a good reason to trim context.
For the request format see the quickstart, for amounts the pricing page, and to try the limits yourself, claim the trial on the key page: $0.50, valid for 7 days, no payment method.
More guides
Questions and answers
Is a WAF rate limit the same as an API rate limit?
No. A WAF rule protects your own application and usually counts requests per IP or client over a window. An API limit is applied by the provider per key and here also includes a concurrency cap.
What does HTTP 429 with code concurrency mean?
You had too many requests running at once. A full key allows 8 and a trial key 2, and a streamed request keeps its slot until the stream ends. Wait for some to finish and retry.
Does my balance change the rate limits?
Billing and limits are separate. The limits depend on the key type, full or trial. Your balance only decides whether requests can be served and is shown in the X-Balance-USD header.
Should I retry when I get a 429?
Yes, with a pause. Use the Retry-After value when given, otherwise back off with jitter. Failed requests are not charged.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.