Skip to content
Koit Academy
AI Guides·

5 min read

LLM API Rate Limits Explained: RPM, TPM and Planning

How LLM API rate limits on requests and tokens per minute work, why max_tokens counts, how long a large job takes, and how to handle 429 errors.

By Koit Academy

Every AI model API limits how much you can send it in a given time. Hit the limit and requests start failing with errors until the window resets. For a chat app that is an occasional nuisance; for a job that processes thousands of documents, the limits decide how long the job takes. They are easy to plan around once you know which limit applies and how the providers count tokens.

The limits

Using OpenAI’s rate limit guide as a reference, which is typical of how these APIs work, usage is measured in several ways:

  • RPM: requests per minute;
  • RPD: requests per day;
  • TPM: tokens per minute;
  • TPD: tokens per day.

Some models also have limits on images or audio. The key rule: whichever limit you hit first applies. A few requests with very long prompts can use up the token limit while the request limit still has plenty of room.

How tokens are counted

Here is the detail that surprises people. OpenAI’s guide says the tokens counted against your limit are based on the larger of max_tokens and the estimated number of tokens in the request. So a request with a 1,200-token prompt and max_tokens set to 400 counts as 1,600 tokens towards TPM, even if the answer is only 150 tokens long.

That makes max_tokens a planning lever. Setting it close to the length of answer you actually need lets more requests fit in each minute.

A worked example

A job of 20,000 requests, each with 1,200 input tokens and max_tokens of 400, against limits of 500 RPM and 200,000 TPM:

  • each request counts as 1,200 + 400 = 1,600 tokens;
  • the token limit allows 200,000 ÷ 1,600 = 125 requests a minute;
  • the request limit allows 500 a minute, so tokens are the binding limit;
  • 20,000 requests at 125 a minute is 160 minutes, about 2.7 hours.

How max_tokens changes it:

max_tokensRequests a minuteTime for 20,000
2001432.3 hours
4001252.7 hours
8001003.3 hours
1,600714.7 hours

If the account also had a daily cap of 10,000 requests, the job would have to spread over two days, whatever the per-minute limits.

The LLM rate limit calculator works out which limit binds, how many requests a minute you can send and how long the job will take, from your own limits and token counts.

Measuring your tokens

To plan, you need the input tokens per request. The token counter estimates them for a sample prompt; our guide on what tokens are explains how text becomes tokens. Measure a few real requests rather than one, because documents vary in length.

Usage tiers

Limits are not fixed for an account. OpenAI, for example, moves organisations up through usage tiers as their total spending grows, and higher tiers generally have higher limits. Other providers work similarly. A job that is slow on a new account can be much faster later, so check the limits shown in your account rather than assuming.

When you hit the limit: 429 errors

A request that exceeds a limit returns HTTP status 429. OpenAI’s guide describes:

  • a Retry-After header giving the minimum number of seconds to wait;
  • headers such as x-ratelimit-remaining-requests and x-ratelimit-remaining-tokens, showing how much capacity is left.

The recommended response is exponential backoff: wait briefly, retry, and double the wait after each further failure, with a little random jitter so many clients do not retry at the same moment. Cap the number of retries. Failed requests still count against the per-minute limit, so hammering the API makes things worse.

Pacing in practice

At 125 requests a minute, a steady pace is one request about every 0.48 seconds. If each request takes around 6 seconds to complete, you need about 13 requests in flight at once to keep that pace: 125 a minute × 6 seconds ÷ 60. Fewer and the job runs below the limit; many more and you burst past it and start getting errors.

A simple approach is a fixed number of workers, each sending a request, waiting for its answer, and sending the next, with a short pause added if the remaining-tokens header gets low.

Planning a large job

  1. Measure input tokens per request on a sample.
  2. Set max_tokens to what the answers need, not the maximum.
  3. Work out the binding limit and the requests per minute it allows.
  4. Pace requests to stay a little under it, rather than sending as fast as possible and handling errors.
  5. Use a batch interface for work that does not need an immediate answer. OpenAI’s Batch API runs without using your normal per-minute limits.
  6. Estimate the cost at the same time: the AI API cost calculator works it out from tokens and prices, and our guide on how to reduce AI API costs covers ways to bring it down.

Common questions

What is TPM? Tokens per minute: the total tokens your requests may use in a minute, counting input and the allowance for output.

Why am I rate limited when I have sent few requests? Probably the token limit. Long prompts, or a high max_tokens, use it up quickly.

Does max_tokens affect the rate limit? With OpenAI, yes: the limit uses the larger of max_tokens and the estimated tokens.

What is the difference between RPM and RPD? RPM caps requests in any minute; RPD caps them across a day. A job can stay well within RPM and still be stopped by RPD, which then spreads it over several days.

Do retried requests count? Yes. A request that fails still counts towards the per-minute limit, which is why retrying immediately and repeatedly makes the problem worse.

How do I avoid 429 errors? Pace requests under the limit, set max_tokens sensibly, and retry with exponential backoff when they happen.

Limits of this guide

This uses OpenAI’s published rate limit rules as the reference. Other providers count and enforce limits in their own ways and change them over time. Check your provider’s documentation and your account’s current limits.

Sources, read November 15, 2026:

  • OpenAI, Rate limits: RPM, RPD, TPM and TPD, whichever limit is hit first, max_tokens in the token count, usage tiers, 429 errors and headers, exponential backoff and the Batch API.