← Blog

Claude API Rate Limiting Strategies for Production

2026-11-16 · 5 min read · SubToAPI Team

Rate limits are the single most common cause of production incidents for teams building on the Claude API. Anthropic enforces limits on requests per minute, tokens per minute, and tokens per day, and these limits vary by model and account tier. The moment your traffic scales past a handful of concurrent users, you will hit a 429 response, and how your application handles that moment determines whether users see a graceful retry or a broken feature.

The core strategies for handling this in production are: exponential backoff with jitter, client-side request queuing, token budgeting before you send a request, spreading load across multiple API keys or accounts, and monitoring usage so you upgrade tiers before you get throttled. None of these are exotic — they're the same patterns used for any rate-limited API — but Claude's token-based limits add a wrinkle that plain request-count limits don't have.

Why Claude rate limits are different

Most APIs limit you by request count. Claude limits you by both requests per minute and tokens per minute (input and output tokens counted separately in some tiers). This means a single request with a 50,000-token document attached can consume as much of your budget as fifty small chat messages. You can't reason about rate limits purely by counting calls — you need to estimate token usage per request type.

Practical implication: log token usage per endpoint or feature in your app from day one. If you don't know whether your "summarize document" feature uses 10x more tokens than your "chat" feature, you can't predict when you'll get throttled, and you can't prioritize which traffic to shed first when you do.

Exponential backoff with jitter

This is table stakes but worth getting right. When you receive a 429, read the retry-after header if present, and back off exponentially with randomized jitter to avoid thundering-herd retries across your fleet.

async function callWithBackoff(fn, maxRetries = 5) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await fn();
    } catch (err) {
      if (err.status !== 429 || attempt === maxRetries - 1) throw err;
      const base = Math.min(1000 * 2 ** attempt, 30000);
      const jitter = Math.random() * base * 0.5;
      await new Promise(r => setTimeout(r, base + jitter));
    }
  }
}

Cap your max retries. A request that fails five times with backoff has already cost you 30+ seconds — at that point it's usually better to return a "try again" response to the user than to keep blocking a worker thread.

Client-side request queuing

Backoff handles occasional bursts, but if your sustained traffic exceeds your rate limit, retries alone will create a death spiral — every retry adds more load that gets throttled again. The fix is a queue in front of the API calls that enforces your known rate limit proactively, rather than discovering it reactively.

A simple token-bucket or leaky-bucket queue per API key works well:

class RateLimitedQueue {
  constructor(requestsPerMinute) {
    this.interval = 60000 / requestsPerMinute;
    this.queue = [];
    this.lastRun = 0;
  }

  enqueue(fn) {
    return new Promise((resolve, reject) => {
      this.queue.push({ fn, resolve, reject });
      this.process();
    });
  }

  async process() {
    if (this.processing) return;
    this.processing = true;
    while (this.queue.length) {
      const wait = Math.max(0, this.interval - (Date.now() - this.lastRun));
      if (wait > 0) await new Promise(r => setTimeout(r, wait));
      const { fn, resolve, reject } = this.queue.shift();
      this.lastRun = Date.now();
      try { resolve(await fn()); } catch (e) { reject(e); }
    }
    this.processing = false;
  }
}

This keeps you under your limit instead of constantly bouncing off it. It also gives you a single place to prioritize requests — put interactive user-facing calls ahead of background batch jobs in the queue.

Token budgeting before you send

Since Claude's limits are token-based, estimate the token cost of a request before sending it, especially for anything involving long documents, conversation history, or tool results. If your estimate puts you over your remaining per-minute budget, delay or chunk the request rather than sending it and eating a 429.

A cheap heuristic (roughly 4 characters per token for English text) is good enough for budgeting decisions — you don't need exact tokenization, just enough precision to avoid blowing past your ceiling.

Spreading load across keys and tiers

If a single account's rate limit genuinely can't cover your peak traffic, the next lever is horizontal: multiple API keys (if your plan supports it) with a router that distributes requests round-robin or by least-recently-used. This adds operational complexity — key rotation, separate usage tracking, separate billing reconciliation — so it's worth doing only after you've exhausted queuing and backoff.

This is also where a layer like SubToAPI helps: it sits in front of Claude and gives each application or team member its own sub_live_ key with usage metadata per key, so you can see exactly which key or team is consuming your rate limit budget without building that attribution logic yourself. See /docs/quickstart for setup and /docs/messages for the request format.

Monitoring and alerting

You want to know you're approaching a rate limit before your users do. At minimum, track:

Alert when you're sustained above 70–80% of your known limit. That gives you lead time to either throttle non-critical traffic, queue more aggressively, or request a tier increase before an incident happens.

Degrade gracefully, don't just retry forever

For production UX, decide in advance what happens when retries exhaust. Options, roughly in order of user experience quality:

  1. Return cached or previously generated content if available
  2. Fall back to a smaller/faster model for that request
  3. Queue the request and notify the user asynchronously when it's ready
  4. Show a clear "service busy, retry in N seconds" message

Silent failures or generic 500s are the worst option — users can't distinguish a rate limit from a bug.

If you're integrating Claude directly, these patterns are things you build and maintain yourself. If you use SubToAPI as the layer between your app and Claude, streaming, tool use, and usage metadata are handled consistently per key, and plans range from Solo at €9 up through Team and Scale seats — see /pricing for details and start with a free trial via /signup.

Questions

Does exponential backoff alone solve rate limiting in production? No. Backoff handles occasional bursts, but if sustained traffic exceeds your limit, retries compound the problem. Pair backoff with a proactive request queue that enforces your rate limit before you hit a 429.

Are Claude's rate limits based on requests or tokens? Both. You're limited by requests per minute and by tokens per minute (sometimes split into input/output). A single large-context request can consume as much budget as many small ones, so budget by tokens, not just call count.

When should I use multiple API keys instead of just queuing? Only after queuing and backoff are in place and you've confirmed a single account's limit genuinely can't cover peak traffic. Multiple keys add rotation and tracking overhead, so treat it as a scaling step, not a first fix.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →