Skip to content

Anthropic API errors

Anthropic error 429: rate_limit_error

This one is usually on your side: your organization passed one of its rate limits, and Anthropic asked it to wait before sending more.

What the error says

HTTP status 429, type rate_limit_error, with the message:

Your account has hit a rate limit.

Is the Anthropic API down right now?

Our live reading did not load here. The Anthropic outage page has it, with Anthropic's own status beside it.

What it means

Anthropic limits each organization's requests per minute, input tokens per minute and output tokens per minute, per model, by usage tier. When a request would pass one of them, the API answers 429 with the type rate_limit_error and a retry-after header giving the seconds to wait. The anthropic-ratelimit-* response headers show what is left. A sharp rise in usage can also be limited for a short time even under the stated limits.

Is it you or them? Usually yours: Anthropic uses this code for limits and billing on your account, which no outage checker can see.

Common causes

  • Requests or tokens per minute above the organization's tier for that model.
  • Bursts: many requests at once, which the limiter counts over short intervals.
  • A sharp increase in usage on a new or quiet organization.
  • Several apps sharing one organization's limits.

How to fix it

  1. Wait for the seconds in the retry-after header, then retry with backoff, as in the snippet below.
  2. Spread requests out and ramp usage up gradually.
  3. Use prompt caching: cached input tokens do not count toward the input tokens per minute limit on most models.
  4. Use the Message Batches API for work that does not need an answer right away.
  5. Check your tier in the console's limits page; it rises with spend.

Retry with backoff

A retry loop that waits as long as Anthropic asks, else doubles the wait with random jitter so many clients do not retry in step:

// Retry Anthropic 429 errors with backoff and jitter.
const RETRYABLE = new Set([429, 500, 502, 503, 504, 529]);

async function withRetry(call: () => Promise<Response>, maxAttempts = 5): Promise<Response> {
  for (let attempt = 1; ; attempt++) {
    const response = await call();
    if (!RETRYABLE.has(response.status) || attempt === maxAttempts) return response;
    // Wait as long as the provider asks, else 1s, 2s, 4s... with full jitter.
    const retryAfter = Number(response.headers.get("retry-after"));
    const delayMs = retryAfter > 0 ? retryAfter * 1000 : Math.random() * 1000 * 2 ** (attempt - 1);
    await new Promise((resolve) => setTimeout(resolve, delayMs));
  }
}

See these errors grouped, and know when the API is down

RealUptime Errors takes errors from any Sentry SDK. Tag each failed call with the provider, status and model, and errors from the same code group into one issue with its count and first and last time seen, so a run of 429s shows up as one rising issue instead of a flood:

import * as Sentry from "@sentry/node";

// The DSN from your RealUptime Errors project settings.
Sentry.init({ dsn: process.env.REALUPTIME_ERRORS_DSN });

if (!response.ok) {
  Sentry.captureException(new Error(`Anthropic ${response.status}`), {
    tags: { ai_provider: "anthropic", ai_status: response.status, ai_model: model },
    fingerprint: ["anthropic", String(response.status)],
  });
}

RealUptime Monitor can check an API endpoint from several regions every minute and alert you when it fails, and the Anthropic outage page can alert you when Anthropic reports an incident. Both are free to start.

Start Errors free

Related errors

Anthropic's own reference: docs.anthropic.com/en/api/errors. How our checks work: methodology.