Skip to content
mathbehind

API Rate Limits: Converting RPM to RPS and Leaving Headroom

Rate limits are quoted per second, minute, hour or day. Converting them to one unit and adding a safety buffer tells you how fast your code can safely send requests.

By Muhammad Ahmad. Published . 2 min read.

Want to run your own numbers?API Rate Limit ConverterOpen the calculator

Every API documents its rate limit in whatever unit suits it: 10 requests per second, 60 per minute, 10,000 per day. To write code that stays inside the limit, you need it in one unit, and you need to know the delay to leave between calls.

Convert to requests per second

Requests per second (RPS) is the easiest unit to work with, because it converts directly into a delay between requests. Divide the limit by the number of seconds in its period: 60 for a minute, 3,600 for an hour, 86,400 for a day.

Add a safety buffer

Running at exactly the documented limit is asking for errors. Clocks drift, requests retry, and some APIs count a request when it starts while others count when it ends. Leaving 10 to 20% headroom avoids most of that trouble.

60 requests per minute with a 15% buffer
  1. Requests per second

    60 ÷ 60 sequals1

  2. With safety buffer

    1 × (1 − 15%)equals0.85/s

  3. Gap between requests

    1,000 ms ÷ 0.85equals1,176.5 ms

So instead of sending one request every 1,000 ms, send one roughly every 1,177 ms.

Daily limits are slower than they look

10,000 requests a day sounds like a lot. Spread evenly, it is only about 0.12 requests per second. With a 15% buffer, that means one request roughly every 10.2 seconds. If your job needs to finish in an hour, a daily limit like this is the real constraint, not the per-minute one.

Faster limits

At 500 requests per minute with a 10% buffer, the safe rate is 7.5 requests per second, or one every 133 ms. At this speed you are usually sending requests in parallel rather than one after another, so think of it as 7.5 requests in flight each second.

Other limits to check

  • Token limits: AI APIs often limit tokens per minute as well as requests, and the token limit is frequently the one you hit first.
  • Per-endpoint limits: some APIs give each endpoint its own limit. Convert each one separately.
  • Burst limits: an API may allow short bursts above the average rate. Do not plan around bursts.
  • Response headers: many APIs report your remaining quota in each response. Read them if they are there.

Tip: When you do get a 429 Too Many Requests error, wait before retrying and increase the wait each time. Retrying immediately just uses up more of the limit.