promptgarten ๐ŸŒฑ
๐ŸŒ ES
Termโ—โ—‹โ—‹3 min ยท +20 XP

Rate Limits and Quotas: Why AI Tools Sometimes Say Slow Down

Every AI API and subscription caps how much you can use in a given time. Hit the ceiling, and you get a 429 instead of an answer.

Why limits exist at all

Running a large model costs real computing power. If one user could send unlimited requests per second, they could overload the service for everyone else, or run up a bill nobody expected. So providers cap usage - a rate limit caps how much you can send per minute, a quota caps how much you can use over a longer period like a day or a month.

What a rate limit actually looks like

Claude's API, for example, limits requests per minute, input tokens per minute, and output tokens per minute - separately, per model. Cross any one of them and the next request fails, even if the other two limits still have room left.

The error you'll see: 429

When you go over a limit, the API answers with HTTP status code 429, known as 'Too Many Requests.' The response often includes a retry-after header telling you exactly how many seconds to wait before trying again - so the fix is usually built right into the error.

Coping with limits in practice

Wait and retry: back off for a moment, ideally with a growing delay, instead of hammering the API again immediately. Batch: combine several small requests into fewer, larger ones where the API supports it. Downsize: route simple, high-volume tasks to a smaller, cheaper model with its own separate limit, saving your budget on the strong model for what actually needs it.

EXAMPLE

A 429 response you might see: status 429, header retry-after: 12 - meaning wait 12 seconds before sending your next request instead of retrying immediately.

๐Ÿ› ๏ธ EXERCISE โ€” TRY IT YOURSELF

Find and read the rate limit headers on a real API response.

  1. Make an API call to Claude or OpenAI, or check existing code/logs that call one.
  2. Look at the response headers for rate-limit fields, e.g. anthropic-ratelimit-requests-remaining or the OpenAI equivalent.
  3. Note how many requests or tokens you have left before hitting the limit.
  4. Optional: carefully trigger a 429 by sending a handful of fast requests and read the retry-after value - note the successful requests before it still cost tokens, so prefer a test key and stop after a few tries.

โœ… SELF-CHECK

  • โ˜ Does your code wait longer after a 429 error instead of retrying immediately?
  • โ˜ Does your code have a fixed upper limit on the number of retries?
  • โ˜ Does your code use the retry-after header instead of assuming a fixed wait time?

QUICK QUIZ

You keep getting HTTP 429 errors from an AI API. What's the recommended way to handle it?

SOURCES

RELATED TOPICS

What Is an API? (Explained Without Jargon) โ—โ—‹โ—‹Cost Control for AI Agents โ—โ—โ—‹Model Routing: The Right Model for the Right Task โ—โ—โ—‹