⚡ API Rate Limit Calculator

Plan request budgets · avoid throttling · smart backoff
Typical: 60–1000 req/min
Average number of requests per day
1x10x
Includes network latency
Req/sec capacity
1.67
Daily budget (safe)
86,400
Time to limit @ peak
20.0 sec
Recommended retry (base)
1.2 sec
Request distribution (30s window) peak █
normalpeak

⏱ Exponential backoff schedule

AttemptDelay (sec)Jitter

Base delay = retry interval × (2^attempt) + random(0, 0.5)

📋 Code snippets

Python — token bucket / sleep📋 copy
import time, threading

# Token bucket (rate: 100 req/min)
rate = 100  # per minute
tokens = rate
last_refill = time.monotonic()

def allow_request():
    global tokens, last_refill
    now = time.monotonic()
    elapsed = now - last_refill
    tokens = min(rate, tokens + elapsed * (rate/60))
    last_refill = now
    if tokens >= 1:
        tokens -= 1
        return True
    return False

# Exponential backoff
def retry_with_backoff(attempt):
    delay = 1.2 * (2 ** attempt) + 0.2  # base 1.2s
    time.sleep(delay)
JavaScript — setTimeout / queue📋 copy
// Rate limiter with queue (100 req/min)
const queue = [];
let tokens = 100;
const refillRate = 100 / 60; // per second

setInterval(() => {
  tokens = Math.min(100, tokens + refillRate);
  processQueue();
}, 1000);

function processQueue() {
  while (queue.length && tokens >= 1) {
    tokens--;
    const req = queue.shift();
    req();
  }
}

// Exponential backoff (base 1.2s)
function backoff(attempt, callback) {
  const delay = 1.2 * Math.pow(2, attempt) + Math.random() * 0.5;
  setTimeout(callback, delay * 1000);
}