← Blog

Claude API Rate Limit Error: How to Fix It Fast

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

If you're seeing a 429 status code or a message like rate_limit_error from the Claude API, your application has hit one of Anthropic's limits: requests per minute, tokens per minute, or tokens per day, depending on your usage tier. The fix is almost never "wait and hope" — it's a combination of retry logic with backoff, smarter request shaping, and knowing which limit you're actually hitting.

This article walks through how to diagnose the specific limit you're bumping into, how to implement retries that actually work, and how to restructure your traffic so you stop getting rate limited in the first place.

Step 1: Identify which limit you're hitting

Claude's API returns rate limit errors with headers that tell you exactly what's constrained. Before writing any retry code, log these headers on every response:

curl -i https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-opus-4","max_tokens":100,"messages":[{"role":"user","content":"hi"}]}'

Look at the response headers:

If requests-remaining hits zero, you're sending too many calls per minute — usually a concurrency problem. If tokens-remaining hits zero, your prompts or outputs are too large relative to your tier, which is a sizing problem, not a frequency problem. These two cases need different fixes, so don't just slap a generic retry on everything and call it done.

Step 2: Implement exponential backoff with jitter

A 429 response almost always includes a retry-after header. Respect it. If it's missing, fall back to exponential backoff with jitter so you don't create a thundering herd of retries that all land at the same moment.

async function callWithRetry(fn, maxRetries = 5) {
  let attempt = 0;
  while (true) {
    try {
      return await fn();
    } catch (err) {
      if (err.status !== 429 || attempt >= maxRetries) throw err;
      const retryAfter = err.headers?.get("retry-after");
      const base = retryAfter ? Number(retryAfter) * 1000 : 2 ** attempt * 500;
      const jitter = Math.random() * 300;
      await new Promise((r) => setTimeout(r, base + jitter));
      attempt++;
    }
  }
}

This handles transient spikes, but it won't save you if your steady-state traffic consistently exceeds your limit. For that, you need to control concurrency, not just retry after failure.

Step 3: Cap concurrency instead of firing requests in parallel

A very common cause of rate limit errors is code that fans out requests with Promise.all without any ceiling. If you're processing a batch of 200 documents and fire 200 concurrent Claude calls, you will get throttled almost immediately, no matter how generous your tier is.

Use a concurrency limiter:

import pLimit from "p-limit";

const limit = pLimit(5); // tune to your tier's RPM
const results = await Promise.all(
  documents.map((doc) => limit(() => callWithRetry(() => sendToClaude(doc))))
);

Start conservatively (5 concurrent requests) and increase gradually while watching the ratelimit-remaining headers. This single change eliminates the majority of rate limit errors reported by teams doing batch processing.

Step 4: Reduce token volume, not just request count

If you're hitting the tokens per minute limit rather than the requests limit, backoff and concurrency control won't help much — you need to send fewer tokens per call. Common fixes:

If your use case genuinely needs high throughput, the real fix is requesting a higher tier or usage limit increase from Anthropic directly — retry logic can't manufacture capacity that doesn't exist.

Step 5: Queue and smooth bursty traffic

Rate limits are per-minute windows, so bursty traffic patterns (e.g., a cron job that fires 50 requests at second zero of every minute) will hit limits even if your average usage is well under the cap. Smooth these bursts with a queue that spreads requests evenly across the window rather than firing them all at once. A simple token-bucket or leaky-bucket implementation in front of your Claude calls solves this without touching your retry logic at all.

Step 6: Separate concerns if you're building for a team

If multiple services, environments, or team members are calling the Claude API with the same key, rate limit errors become hard to debug — you can't tell whose traffic triggered the throttle. This is one of the problems SubToAPI solves: it sits on top of your existing Claude access and issues separate sub_live_... API keys per application or environment, with usage metadata per key so you can see exactly which service is consuming tokens and requests. You still implement backoff and concurrency control in your code, but you get visibility into which key is responsible for a spike instead of guessing. Check the quickstart or docs for setup, and pricing for plan details.

Quick checklist

FAQ

What does a Claude API rate limit error actually mean?

It means you've exceeded one of three caps on your account tier: requests per minute, tokens per minute, or tokens per day. The response includes headers showing which limit and how much time remains before it resets.

Does retrying automatically fix rate limit errors?

Retrying with exponential backoff fixes transient spikes, but if your steady-state traffic exceeds your limit, retries will just keep failing in a loop. You need to reduce concurrency, cut token usage, or request a higher limit.

How do I know if it's a request limit or a token limit problem?

Check the anthropic-ratelimit-requests-remaining and anthropic-ratelimit-tokens-remaining headers on the response. If requests hit zero first, it's a frequency problem; if tokens hit zero first, your prompts or outputs are too large for your tier.

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 →