Home/Guide
Llama API Usage Limits: Rate, Concurrency, Context
Four numbers decide whether your app runs smoothly: concurrency, requests per minute, the context window and the request size. Here they are, with the arithmetic and the code to stay inside them.
Updated

- Full key: 8 concurrent requests, 300 per minute. Trial key: 2 concurrent, 60 per minute.
- Context is 100,000 tokens for prompt plus completion; the request body is capped at 8 MB.
- With slow requests, concurrency becomes the binding limit long before the per-minute cap.
- 429 errors come as rate_limited, concurrency or temporary overload with Retry-After: 5.
The limits in one table
This is the full list of llama api usage limits that apply to the API at https://api.llamaapis.com/v1. The model behind it is one open-weight model with the ID uncensored, not an official service of Meta.
| Limit | Full key | Trial key |
|---|---|---|
| Concurrent requests | 8 | 2 |
| Requests per minute | 300 | 60 |
| Context window | 100,000 tokens | 100,000 tokens |
| Max request body | 8 MB | 8 MB |
The context window counts the prompt and the completion together. The max_tokens parameter is optional: without it, the reply can use whatever the prompt leaves free. There are no daily or monthly caps listed here, and nothing expires on the account side, since credit never expires. A new user can claim the trial key with one click on the key page; it carries $0.50, lasts 7 days and is limited to one per person.
Which limit you will hit first
People expect the per-minute cap to be the bottleneck. Usually it is concurrency. A request that takes longer holds its slot longer, and a streamed request holds it until the last token arrives. The throughput you can sustain is roughly the number of slots times 60, divided by the average seconds per request. These durations are made-up inputs to show the arithmetic, not measurements.
| Average request time | Full key (8 slots) | Trial key (2 slots) |
|---|---|---|
| 5 seconds | 96 per minute | 24 per minute |
| 10 seconds | 48 per minute | 12 per minute |
| 30 seconds | 16 per minute | 4 per minute |
Each cell is slots x 60 / seconds. For example, 8 x 60 / 10 = 48. To reach the full 300 requests per minute with 8 slots, the average request would have to finish in 8 x 60 / 300 = 1.6 seconds. Long generations with big prompts will not do that, so for most workloads the concurrency number is the one to plan around, and the per-minute cap acts as a backstop for very short requests.
How errors look
When a limit is exceeded, the API returns HTTP 429. There are three flavors:
rate_limited: too many requests in the last minute.concurrency: too many requests in flight at once.- Temporary overload: a 429 with a
Retry-After: 5header.
The first two mean your own traffic is above your key's ceiling. The third is not your fault and clears by itself, so wait five seconds and send the same request again. Failed or refused requests are not charged, so retries do not double your bill.
Each response also carries X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency, which tell your client the ceilings that apply to the key it used, plus X-Request-Id and X-Balance-USD. Log the request ID with every error; it is the thing to quote in a support message.
Staying inside the limits in code
The simplest control is a semaphore that matches your concurrency, plus a retry that honors Retry-After. This Python version uses threads and keeps two slots free as headroom on a full key:
import os, time, threading
from concurrent.futures import ThreadPoolExecutor
from openai import OpenAI, RateLimitError
client = OpenAI(
base_url="https://api.llamaapis.com/v1",
api_key=os.environ["LLAMAAPIS_KEY"],
max_retries=0, # we handle retries ourselves
)
slots = threading.BoundedSemaphore(6)
def ask(prompt, tries=5):
for attempt in range(tries):
with slots:
try:
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": prompt}],
max_tokens=300,
)
return r.choices[0].message.content
except RateLimitError:
pass
time.sleep(5 * (attempt + 1))
raise RuntimeError("still rate limited")
prompts = ["Summarize item %d in one sentence." % i for i in range(40)]
with ThreadPoolExecutor(max_workers=6) as pool:
results = list(pool.map(ask, prompts))
Releasing the slot before sleeping, as the with block does, keeps a waiting thread from blocking others. On a trial key, change both 6 values to 2. The same idea in curl form, for a quick manual test of the headers:
curl -i https://api.llamaapis.com/v1/models \
-H "Authorization: Bearer $LLAMAAPIS_KEY"
The -i flag prints response headers, so you can read your limits and your balance directly.
Streaming and long generations
Streaming changes how you think about slots. A non-streamed call holds a slot while the server generates the whole reply, then frees it. A streamed call holds the slot until the final chunk, so a user who closes the tab mid-stream may leave the slot busy until your server closes the connection. Close the response in your code when the client disconnects, and set a sensible timeout for any single call.
Long generations deserve a cap. If you leave max_tokens unset, a reply can run to the end of the window, which ties up a slot and spends output tokens at $0.50 per 1M. Set a cap that matches the job: 300 for a summary, 1,500 for an article section, higher only when you need it. A runaway reply of 50,000 output tokens would cost 50,000 x $0.50 / 1,000,000 = $0.025, which is small once, but a loop that repeats it a thousand times costs $25.
Use stop sequences to end replies where your format ends, and use JSON mode when you want a bounded structured answer. Both reduce wasted output and shorten the time a slot is held.
Budgeting the 100,000-token window
The window is shared by input and output. If you send 90,000 tokens, at most 10,000 are left for the reply. Count tokens with a tokenizer before you send long documents instead of guessing from character counts, and leave a margin. Chat history grows every turn, since each request resends earlier messages, so long sessions should summarize or drop old turns before they approach the cap.
Filling the window is cheap per call but not free. A prompt of 100,000 input tokens costs 100,000 x $0.15 / 1,000,000 = $0.015 before any output. Add a 4,000-token reply at 4,000 x $0.50 / 1,000,000 = $0.002 and the call costs $0.017. Hold in mind that the sum of prompt and completion cannot pass 100,000, so a full 100,000-token prompt leaves no room for a reply. A more realistic long call, 80,000 tokens in and 4,000 out, costs $0.012 + $0.002 = $0.014.
The body cap is 8 MB, which is larger than any text prompt that fits in the window, so you will reach the token limit first unless you embed very large JSON payloads.
What the trial credit gets you
The trial credit of $0.50 is enough to measure your own traffic. A request with 1,000 input tokens and 500 output tokens costs 1,000 x $0.15 / 1,000,000 + 500 x $0.50 / 1,000,000 = $0.00015 + $0.00025 = $0.0004. Dividing $0.50 by $0.0004 gives 1,250 such requests. At the trial ceiling of 60 per minute, you could spend all of it in about 21 minutes, and with only 2 concurrent requests you will spend it slower than that in practice.
When you move to a funded key, you can add any whole amount from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200. Payment is by crypto (USDT on TRC20, USDC on Base). A $100 top-up becomes $110 of credit. See the pricing page for the table and the docs for request details.
Planning capacity for a real app
Start from your peak, not your average. If your app has 200 users online and each sends a message every two minutes at peak, that is 100 requests per minute. This sits under the 300 cap, but with 15-second replies you need 100 x 15 / 60 = 25 slots at once, which is more than the 8 a full key gives you. In that case, you queue on your side, shorten replies, or accept longer waits.
Put a queue in front of the API and size its workers to your concurrency. Show the user a short waiting state instead of retrying blindly, because a pile of retries makes the congestion worse. Measure the real average duration of your requests for a day, then redo the slot arithmetic with true numbers. The facts page keeps the current figures in one place, and the docs describe the headers you can read to adapt automatically.
More guides
Questions and answers
How many requests can I send at once?
A full key allows 8 concurrent requests and a trial key allows 2. A streamed request counts until the stream ends.
What is the maximum context length?
The context window is 100,000 tokens for the prompt and the completion combined. The request body can be up to 8 MB.
What does a 429 response mean?
You exceeded a limit. The code rate_limited means too many requests per minute and concurrency means too many at once. A 429 with Retry-After: 5 is temporary overload; wait and retry.
Are rejected requests billed?
No. Failed or refused requests are not charged, so retrying after a 429 does not cost extra.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.