Read this article with your own numbers
Read this article with your own numbers
Enter your numbers below and the highlighted numbers in the article body will be recalculated as estimates based on your input. Leave the fields blank and the article keeps its original example numbers.
Your input is used only to display this page. It is not stored in your browser, and it is never sent to this site's servers or to advertising companies. It does not carry over to other articles.
While this setting is on, your input is kept in this browser's temporary storage. It is never sent to this site's servers or to advertising companies. Even after you close the tab, reopening a closed tab or restoring a previous session may bring the input back. You can remove it at any time with "Clear all input".
The highlighted numbers are mechanical estimates based on your on-screen input, or on the article's own examples where fields are blank. They are not a recommendation or individual advice. Official vendor prices and measured benchmark results are never rewritten.
"Matches your input" means the condition described by the input fields is currently true. It does not mean better, appropriate, or that you should switch.
The article is currently showing its original example numbers.
An AI API rate limit calculator should answer one operational question: how many requests can this workload complete per second without repeatedly colliding with a provider limit? The answer is not simply RPM divided by 60. A system can remain below its requests-per-minute allowance and still exceed its token budget, concurrency capacity, daily quota, or a provider-specific input/output token limit.
Calculate every applicable ceiling, take the lowest result, and reserve headroom for traffic variation and retries. This guide also turns that result into a worker-pool size.
All provider-specific terminology and header names in this article were checked against official documentation on 2026-07-23. Account limits change by model, usage tier, project, and contract, so enter the values shown in your own provider console or response headers rather than copying a generic limit table.
RPM, TPM, RPS, and concurrency
Four measurements describe different parts of the same capacity problem:
- RPM (requests per minute) limits how many API calls may be attempted in a minute.
- TPM (tokens per minute) limits token throughput. A provider may count total tokens, input only, or input and output in separate buckets.
- RPS (requests per second) is the arrival or completion rate your application needs. A nominal per-minute allowance does not necessarily permit an instant burst.
- Concurrency is the number of requests in flight at once. It is a property of your workload and latency, not a direct synonym for RPM.
The basic request ceiling is:
request-limited RPS = RPM / 60
The token ceiling for a combined TPM allowance is:
token-limited RPS = TPM / (60 × average counted tokens per request)
If input and output have separate limits, calculate both:
input-limited RPS = ITPM / (60 × average counted input tokens)
output-limited RPS = OTPM / (60 × average output tokens)
Provider accounting matters. Anthropic currently separates RPM, input TPM, and output TPM; for most current Claude models, cache reads do not count toward input TPM. Groq can use combined or separate input/output token limits. Google commonly uses RPM, input TPM, and RPD. These definitions are not interchangeable.
Concurrency follows a different equation:
required concurrency ≈ sustainable RPS × request latency in seconds
If a service completes 3 requests per second and each request occupies a worker for 4 seconds, it needs about 12 active slots. Streaming improves time to first token, but the request still occupies capacity until it ends.
Find the binding limit
The binding limit is the smallest capacity produced by all applicable ceilings:
raw sustainable RPS = min(RPM/60, TPM-based RPS, ITPM-based RPS, OTPM-based RPS, other quota-based RPS)
Then apply a planning utilization target:
planned RPS = raw sustainable RPS × utilization target
A utilization target such as 70% to 85% is an engineering choice, not a provider guarantee. The margin depends on arrival bursts, token variance, and whether multiple services share the quota.
Do not assume each API key gets an independent pool. OpenAI documents organization, project, model, and shared-family limits. Anthropic applies organization limits and can add lower workspace limits. Gemini applies limits per project, not per key. Separate keys inside the same scope may compete for capacity.
Groq adds another scope to check: a project can have a custom per-model limit below the organization’s ceiling. The organization limit still applies, so a project setting cannot create additional organization-wide capacity. Anthropic also exposes an administrative Rate Limits API for reading configured organization limits programmatically; use console or API values as inputs rather than hard-coding a provider’s public example.
Short windows also matter. Anthropic and OpenAI warn that 60 RPM may still be enforced as one request per second. Pace traffic instead of releasing the minute’s allowance at once.
The companion Rate Limit & Concurrency Planner for this article should use account-specific inputs and show which ceiling binds. Treat its result as a capacity estimate, then compare it with observed response headers and load-test telemetry.
Calculation summary
Use one row per applicable limit, then choose the lowest RPS result before adding headroom:
| Constraint or output | Calculation | What to measure or enter |
|---|---|---|
| Request ceiling | RPM / 60 | Account RPM for the exact model and scope |
| Combined-token ceiling | TPM / (60 × average counted tokens) | Counted input plus output tokens, if the provider combines them |
| Input-token ceiling | ITPM / (60 × average counted input tokens) | Uncached and cache-write tokens where required |
| Output-token ceiling | OTPM / (60 × average output tokens) | Completed output tokens |
| Planned fresh-request rate | lowest ceiling × utilization target | A documented target such as 70%–85%, chosen from observed variance |
| Attempted rate with retries | planned RPS × attempt multiplier | Measured retry probability and retry cap |
| Worker baseline | ceil(planned RPS × p95 latency) | p95 end-to-end latency in seconds |
This table produces a starting configuration, not a guaranteed throughput level. Validate it against live headers, 429s, queue age, and a controlled load test.
Use average tokens for throughput and p95 latency for workers
One average is rarely enough for production planning. Token consumption and latency have different distributions, so use each statistic for the decision it fits.
For steady-state throughput, use average counted tokens per successful request. Segment by model and endpoint; a blended average can hide an unusually large route.
For concurrency, average latency estimates the average number of occupied slots, but p95 latency is a safer starting point for sizing a bounded worker pool:
baseline workers = ceil(planned RPS × p95 end-to-end latency)
End-to-end latency should include queueing, provider processing, streaming completion, and synchronous post-processing. Time to first token alone is insufficient when the connection remains open.
Track at least these measurements by model and route:
| Measurement | Capacity use |
|---|---|
| Average counted input tokens | ITPM or combined TPM estimate |
| Average output tokens | OTPM or combined TPM estimate |
| p50 and p95 end-to-end latency | Typical experience and worker sizing |
| Requests receiving 429 | Rate-limit pressure |
| Retry attempts per original request | Extra offered load |
| Remaining/reset response headers | Live headroom and pacing |
Also test a p95-token scenario. It reveals whether a few large prompts can drain the bucket and block smaller requests.
For a broader production-control design, see Token Budgets and Circuit Breakers for AI Agents. Rate limiting controls traffic into the provider; a circuit breaker controls what the application does when failures or costs cross a defined threshold.
Budget retries and exponential backoff
Retries consume capacity. They should be included in the request and token budget rather than treated as free recovery.
With retry probability p and up to three retries, an approximate expected-attempt multiplier is:
attempt multiplier = 1 + p + p² + p³
At 2%, the multiplier is about 1.0204. This assumes independent failures; correlated outages can produce much worse retry storms.
For a 429 response:
- Honor a valid provider
Retry-Afteror reset signal when available. - Otherwise use exponential backoff with random jitter.
- Set a maximum retry count and an overall deadline.
- Retry only operations that are safe to repeat, or use idempotency controls where the API supports them.
- Stop admitting new optional work when the queue age or error rate exceeds its threshold.
OpenAI’s official rate-limit guide recommends random exponential backoff and warns that unsuccessful requests count toward per-minute limits. Anthropic returns retry-after with a 429 and says retries before that interval will fail. Google’s Gemini troubleshooting guide recommends exponential backoff for retryable 429 and 503 errors. Groq documents retry-after on rate-limited 429 responses.
Headers differ. OpenAI documents x-ratelimit-limit-*, x-ratelimit-remaining-*, and x-ratelimit-reset-*. Anthropic uses anthropic-ratelimit-* fields plus retry-after. Groq uses x-ratelimit-*, but its request headers currently refer to RPD while token headers refer to TPM. Do not assume identical semantics.
Log these headers with the model, endpoint, status code, and a request identifier, but never log API keys or sensitive prompt content.
Separate batch traffic from online traffic
Interactive and batch workloads have different objectives. Online traffic needs bounded tail latency; batch work usually needs eventual completion at controlled cost. Mixing both in one eager queue lets a large offline job consume the token budget needed for user requests.
Use separate queues even when the provider exposes one synchronous pool. Reserve RPM and TPM for interactive traffic, and slow batch dispatch when latency, 429 rate, or remaining-token headers cross a threshold.
Provider batch APIs may have separate capacity. OpenAI uses a per-model queue limit based on enqueued input tokens; Anthropic has separate Message Batches limits; Gemini documents concurrent-request and per-model enqueued-token limits. Verify the selected model and account.
Combining small tasks into one synchronous request can help when RPM binds but TPM remains. It is not an asynchronous Batch API and changes failure handling, latency, and parsing. Read OpenAI Batch vs. Claude Message Batches before choosing.
Worked capacity-planning example
Suppose a production route has these measured and account-specific inputs:
- 600 RPM
- 300,000 combined TPM
- 1,200 average counted tokens per request
- 2.4-second average latency
- 4.8-second p95 end-to-end latency
- 75% utilization target
- 2% independent retry probability, with at most three retries
Marked results below recalculate from the input panel; unmarked intermediate equations retain the original worked example.
First calculate the request ceiling:
600 / 60 = 10 RPS
Then calculate the token ceiling:
300,000 / (60 × 1,200) = 4.167 RPS
At the original example values, TPM binds, so raw sustainable throughput is about 4.167 RPS. Apply the 75% target:
4.167 × 0.75 = 3.125 planned fresh requests per second
The average in-flight count is:
3.125 × 2.4 = 7.5 requests
The p95-based worker baseline is:
ceil(3.125 × 4.8) = 15 workers
With the retry multiplier:
1 + 0.02 + 0.02² + 0.02³ = 1.020408
3.125 × 1.020408 = 3.189 attempted RPS
Retries raise planned token use from 225,000 TPM to about 229,592 TPM.
Any remaining margin does not cover arbitrary prompt growth or correlated failures.
A burst of 5 RPS would consume an estimated:
5 × 60 × 1,200 = 360,000 TPM
That exceeds TPM even though 5 RPS is half of the request-derived capacity. More workers cannot fix the binding constraint. Reduce counted tokens, pace traffic, route suitable work elsewhere, use beneficial caching, or obtain a higher limit.
If provider speed is also a selection factor, Groq vs. Cerebras API explains why headline throughput and production fit need separate evaluation.
Frequently asked questions
How do I calculate an AI API rate limit?
Calculate an RPS ceiling for every quota that applies, such as RPM / 60 and TPM / (60 × average counted tokens). Use the lowest ceiling, apply explicit headroom, and then size concurrency from planned RPS and measured end-to-end latency.
Why do I receive 429 errors when usage is below the listed RPM?
Another bucket may bind first, including TPM, ITPM, OTPM, a daily or spend limit, or a lower project/workspace limit. A short burst can also exceed a token-bucket window even when the full-minute average appears safe. Inspect the error body and rate-limit headers for the specific exhausted bucket.
Does streaming reduce rate-limit usage?
Streaming can improve time to first token, but it does not make the request disappear from RPM or token accounting. The connection also occupies a concurrency slot until generation ends, so worker sizing should use end-to-end completion latency rather than time to first token.
How many concurrent API requests should I allow?
Start with ceil(planned RPS × p95 end-to-end latency), then enforce a bounded queue and test it. If TPM is the binding limit, adding workers will increase contention rather than sustainable throughput.
Should retries be included in the calculator?
Yes. Failed attempts may still consume request capacity, and some providers count associated token work. Model retries as extra offered load, cap them, add jitter, and honor a valid Retry-After or reset header. If large prompts are driving the limit, Context Window Calculator provides a separate way to estimate prompt and output size.
Production checklist and verified sources
Before setting the limiter and worker pool:
- Read current limits from the account or project console for the exact model.
- Identify every applicable bucket: RPM, TPM, ITPM, OTPM, daily limits, batch queue, spend, and shared model pools.
- Measure counted input, output, average latency, and p95 latency from representative traffic.
- Calculate every ceiling and label the binding limit.
- Apply explicit headroom for bursts, token variance, and retries.
- Pace requests across short windows; do not release a minute’s quota at once.
- Bound concurrency, queue length, retry count, and total request deadline.
- Honor provider retry/reset headers and add jitter.
- Separate interactive and offline queues.
- Alert on remaining capacity, 429 rate, queue age, and token-size drift.
- Recalculate after a model, tier, prompt, output cap, or routing change.
- Load-test below the provider ceiling before increasing production traffic.
Official sources checked on 2026-07-24:
- OpenAI rate limits: scope, usage tiers, response headers, Batch queue limits, and exponential backoff.
- OpenAI 429 guidance: short-window enforcement and retry behavior.
- Anthropic rate limits: RPM/ITPM/OTPM terminology, token-bucket behavior, cache accounting, batch limits, and headers.
- Anthropic Rate Limits API: programmatic access to configured organization rate-limit groups and values.
- Gemini API rate limits: RPM/input TPM/RPD dimensions, per-project scope, tier variation, and batch limits.
- Gemini API troubleshooting: 429/503 handling and exponential backoff.
- Groq rate limits: limit dimensions, current header semantics, and 429 behavior.
- Groq projects: project-specific model limits and their relationship to organization ceilings.