API Rate Limit, Token Bucket & Backoff Calculator
Interactive API Rate Limit, Token Bucket & Backoff Calculator
?
Requests per minute the provider allows for your key. Read it from the provider's rate-limit documentation or the rate-limit response headers. Range: 10 to 60,000 RPM, step 10.?
Largest number of requests the token bucket holds at once (the burst allowance). Read it from the provider's documentation, or use the size of your own client-side bucket. Range: 1 to 5,000.?
Requests that arrive together during a traffic spike. Read it from access logs or queue depth at the busiest minute. Range: 10 to 50,000, step 10.?
Delay T0 in milliseconds before the first retry; each later retry waits twice as long as the one before (T0, 2 T0, 4 T0 and so on). Read it from your client's retry settings. Range: 50 to 5,000 ms, step 50.?
Maximum number of retries k before the request is reported as failed. Read it from your client's retry settings. Range: 1 to 10.Use the API Rate Limit, Token Bucket & Backoff Calculator to evaluate r_refill = RPM / 60 | T_drain = (N_spike − B_cap) / r_refill | t_k = T_0 · 2^(k−1) for Stripe/Shopify/OpenAI API client rate limiters, webhook ingestion gateways. With the defaults (Provider Quota Limit = 600, Token Bucket Burst Capacity = 100 Reqs, Incoming Traffic Spike = 450 Requests) it returns Token bucket refill & safe rate: Refill = 10 req/s · Safe rate = 8.50 req/s (85 % planning margin) · Whole safe requests per second = 8.
Governing equationr_refill = RPM / 60 | T_drain = (N_spike − B_cap) / r_refill | t_k = T_0 · 2^(k−1) (IETF RFC 6585 §4 (HTTP 429). Token bucket and full-jitter backoff are model assumptions.)
Model assumptions
The safe rate is a request rate; the requests in flight at that rate equal the rate times the upstream latency (Little's law, see the webhook queue calculator). Full jitter draws each wait uniformly between zero and T0 × 2^(j−1), so the expected total is half the cumulative maximum. The retry verdict assumes every request above the bucket starts retrying together; clients that honor Retry-After wait differently, and no delay cap is modeled.
Why Synchronized Retries Turn a Short 429 Into a Retry Storm
An HTTP 429 response means the client has sent too many requests in a given amount of time (RFC 6585, section 4). A token bucket is a common way to enforce that limit: tokens arrive at a steady rate r per second, the bucket holds at most b tokens, and a request that finds no token is not sent (Wikipedia, token bucket). When every worker in a pool retries on the same fixed schedule, they all wake at the same moment and collide again.
The calculator sets the refill rate to r = RPM / 60. At the default 600 RPM that is 10 requests per second. The drain time for a spike is T_drain = (N_spike - B) / r: 450 requests against a 100-token bucket need (450 - 100) / 10 = 35.0 seconds to clear.
| Quota Tier (RPM) | Refill Rate (req/s) | Burst Bucket (B), model assumption | Drain Time (450 Reqs) | Safe Steady Rate (85 % of refill) |
|---|---|---|---|---|
| 60 RPM | 1.0 req/s | 20 reqs | 430.0 s | 0.85 req/s |
| 300 RPM | 5.0 req/s | 50 reqs | 80.0 s | 4.25 req/s |
| 600 RPM | 10.0 req/s | 100 reqs | 35.0 s | 8.50 req/s |
| 1,200 RPM | 20.0 req/s | 200 reqs | 12.5 s | 17.00 req/s |
| 3,000 RPM | 50.0 req/s | 400 reqs | 1.0 s | 42.50 req/s |
| 6,000 RPM | 100.0 req/s | 500 reqs | 0.0 s | 85.00 req/s |
How to Evaluate Exponential Backoff and Full Jitter Math?
The deterministic wait before retry k is T0 x 2^(k-1): T0 for the first retry, 2 T0 for the second, 4 T0 for the third. The calculator reports the cumulative maximum wait over k retries as the geometric sum T0 x (2^k - 1). With T0 = 500 ms and k = 5, the waits are 0.5, 1, 2, 4 and 8 seconds, and the total is 0.5 x 31 = 15.5 seconds.
Full jitter draws each wait uniformly between zero and the exponential ceiling, so the expected wait is half of that ceiling, and the expected total over all retries is half the cumulative maximum. The calculator reports that figure as 15.5 / 2 = 7.75 seconds at k = 5, or 1.55 seconds per retry. Against the 35-second drain of the default spike, a 15.5-second window runs out first. AWS's architecture article on exponential backoff and jitter is the reference for this approach. The model has no delay cap: AWS's full jitter draws each wait between zero and min(cap, base x 2^attempt), and this calculator leaves out the cap, so with T0 = 5 s and k = 10 the cumulative maximum is 5 x 1,023 = 5,115 seconds. Set a cap in the real client.
| Retry Attempt (k) | Step Multiplier (2^(k−1)) | Cumulative Max Wait | Full-Jitter Expected Total Wait |
|---|---|---|---|
| Attempt 1 | 1x | 0.50 s | 0.25 s |
| Attempt 2 | 2x | 1.50 s | 0.75 s |
| Attempt 3 | 4x | 3.50 s | 1.75 s |
| Attempt 4 | 8x | 7.50 s | 3.75 s |
| Attempt 5 | 16x | 15.50 s | 7.75 s |
| Attempt 6 | 32x | 31.50 s | 15.75 s |
| Attempt 7 | 64x | 63.50 s | 31.75 s |
Worked Examples: Two Presets Calculated with r_refill = RPM / 60 | T_drain = (N_spike − B_cap) / r_refill | t_k = T_0 · 2^(k−1)
Worked Example 1 (Free-tier AI API at 60 RPM, 150-request burst): This preset sets Provider Quota Limit = 60, Token Bucket Burst Capacity = 20 Reqs, Incoming Traffic Spike = 150 Requests, Initial Retry Base Delay T₀ = 1000 ms, Maximum Retry Attempts = 4. Evaluating r_refill = RPM / 60 | T_drain = (N_spike − B_cap) / r_refill | t_k = T_0 · 2^(k−1) gives: refill rate = 1.0 req/s, spike drain time = 130.0 s, maximum cumulative wait = 15.0 s, expected total full-jitter wait = 7.5 s, safe request rate = 0.85 req/s. Related in the Cloud, API, LLM & Automation Hub: LLM API Token Cost & Prompt Caching Calculator and Webhook Queue & Worker Concurrency Calculator (Little's Law).
Worked Example 2 (Partner API at 120 RPM, 300-request spike, 1 s base): This preset sets Provider Quota Limit = 120, Token Bucket Burst Capacity = 30 Reqs, Incoming Traffic Spike = 300 Requests, Initial Retry Base Delay T₀ = 1000 ms, Maximum Retry Attempts = 6. The calculator returns: refill rate = 2.0 req/s, spike drain time = 135.0 s, maximum cumulative wait = 63.0 s, expected total full-jitter wait = 31.5 s, safe request rate = 1.7 req/s. You can compare these limits with other calculators in the Engineering Studio.
How to Evaluate Sizing the Client: Safe Rate and Retry Settings?
Set the bucket size and refill rate from the provider's documented limits, then pace outgoing requests below the refill rate. The tier table uses bucket sizes of 20 to 500 requests as model assumptions, not the published limits of any provider. The calculator's safe rate is 85 % of the refill rate, shown two ways: in requests per second as floor(0.85 x r x 100) / 100 (8.50 req/s at 600 RPM) and as whole requests per second as floor(0.85 x r) (8 at 600 RPM). This is a rate, not a worker count: the requests in flight at 8.50 req/s are the rate times the upstream latency, about 0.85 at 100 ms. Below one request per second there is no whole request per second: at 60 RPM the safe rate is 0.85 req/s and at 10 RPM it is 0.14 req/s, so the whole-request figure shows as none and the client has to space requests at least 1 / safe rate seconds apart. The 85 % margin is a planning assumption; RFC 6585 defines the 429 status but sets no percentage. Honor a Retry-After header when the provider sends one, because it overrides the calculated wait.
Sources
- IETF · RFC 6585, Additional HTTP Status Codes (429)Section 4 defines 429 Too Many Requests: the user has sent too many requests in a given amount of time (rate limiting). Basis of the 429 handling in the calculator.
- Wikipedia · Token bucket General definitionTokens are added at rate r per second; the bucket holds at most b tokens (burst); a request without enough tokens is non-conformant. Basis of refill = RPM / 60 and drain time = (N − B) / r.
- AWS Architecture Blog · Exponential Backoff and JitterReference for capped exponential backoff with jitter and for comparing full and equal jitter. Basis of the full-jitter note (expected wait is half the ceiling).
Method and test suite: Calculation Methodology.
Frequently Asked Questions: API Rate Limit, Token Bucket & Backoff Calculator
Why does a 450-request spike take 35 seconds to drain at 600 RPM?
The bucket holds 100 tokens, so 350 requests are excess. At 10 tokens per second, 350 excess requests take 35 seconds to clear.
What does the 85 % safe rate protect against?
The refill is shared by every client that uses the same key. Pacing at 85 % leaves headroom for other services and for timing variation, and at 60 RPM it gives 0.85 requests per second rather than a rounded-up 1. The 85 % value is a planning assumption, not a standard.
Why is full jitter better than a fixed delay plus a small random offset?
A fixed delay keeps workers synchronized. Full jitter draws the whole wait from zero to the ceiling, so retries arrive across the window instead of in one burst.
Does the backoff model have a maximum delay?
No. The waits keep doubling, so T0 = 5 s with k = 10 retries gives a cumulative maximum of 5 x 1,023 = 5,115 seconds. AWS's full-jitter formula uses min(cap, base x 2^attempt); fix a cap in the real client, because an uncapped schedule is rarely what a production worker should wait.
Is it safe to retry a POST after a 429?
Usually, because a 429 means the request was refused for rate reasons. A timeout is different: the server may already have processed the request, so retried mutations need an idempotency key that the server honors.