Skip to content
mentoor

Topic 1 of 5 · 4 min read

Provider rate limits and usage tiers

Goal: From a traffic forecast and a provider's limits, work out whether a launch fits and which limit binds first.

Every model endpoint has several limits at once, and the one that binds first sets your real capacity. Capacity planning starts by finding that limit before launch, not by reading a 429 error in production.

Check yourself · 1 of 3

A service sends 500 requests a minute, each with a 6,000-token prompt. Which limit is most likely to bind first?

Choose one answer

Why it matters

Providers cap how much you can send. A launch that looks fine on requests can still fail on tokens. Limits also differ per model, and they rise with your usage tier, which is tied to spend or account age. Check the current numbers in the provider's docs and your console, because they change.

The limits to know

  • Requests per minute (RPM): how many calls you start.
  • Input tokens per minute (ITPM): prompt size summed over calls.
  • Output tokens per minute (OTPM): generated text summed over calls. Some providers count the reserved max_tokens against this up front, not the text actually returned.
  • Concurrency: how many requests may be in flight at once, which matters for long streaming answers.
  • Daily caps: some tiers also cap requests or tokens per day.

Most providers meter with a token bucket: capacity refills continuously, so a burst can fail even when the minute average is fine.

How to do it

  1. Forecast peak load, not average load: peak requests per minute, average input tokens and average output tokens.
  2. Multiply: tokens per minute = requests per minute x tokens per request, for input and output separately.
  3. Divide each by the matching limit. The largest ratio is the binding limit.
  4. Add headroom. Plan to run at 60-70% of the limit so retries and bursts fit.
  5. Read the response headers. They report remaining requests and tokens and when they reset, so your client can slow itself before a 429.

Before and after

Weak: "We expect 2,000 requests a minute and the limit is 4,000 RPM, so we are fine."

Better: "2,000 requests a minute with 3,000 input tokens each is 6,000,000 input tokens a minute. Our limit is 2,000,000 ITPM, so input tokens bind at 3x over. We need a higher tier, shorter prompts, prompt caching where the provider excludes cached tokens from the limit, or a second provider."

What goes wrong

  • Checking one limit. Teams compare RPM only, then hit the token limit with long prompts.
  • Planning on averages. A morning spike uses ten times the quota of the daily mean.
  • Ignoring the reserved output. A large max_tokens on every call can use up output quota that the real answers never needed.
  • Retrying instantly. Retries on a 429 add load. Wait for the retry-after value, add random jitter and cap the attempts.

Examples

Which limit binds

A support bot expects 600 requests a minute at peak. Each call sends about 4,000 input tokens and returns about 300 output tokens.

Limit Peak need Example limit Ratio
RPM 600 1,000 0.6
Input tokens/min 2,400,000 2,000,000 1.2
Output tokens/min 180,000 400,000 0.45

Input tokens bind at 120% of the limit. More RPM would not help. Shorter prompts or a higher tier would.

A client that reads the headers

resp = client.call(prompt)
remaining = int(resp.headers.get("x-ratelimit-remaining-tokens", 0))
if remaining < 50_000:
    time.sleep(2)  # slow down before the provider says no

Header names differ by provider, so read the docs for the exact names. The idea is the same: slow down on low remaining quota instead of waiting for a 429.

Key points

  • Several limits apply at once (requests, input tokens, output tokens, concurrency), and the first one you reach is the real limit.
  • Convert forecast traffic into tokens per minute and divide by each limit; the largest ratio is the binding one.
  • Plan from peak traffic with headroom, because token buckets refill continuously and bursts can fail inside a safe-looking minute.
  • Limits are per model and rise with usage tier, so check the provider docs and your console instead of remembering numbers.
  • Response headers show remaining quota and reset time; use them and the retry-after value to slow down before and after a 429.

Common mistakes

  • Comparing the forecast to the RPM limit only and never converting it to tokens per minute.
  • Sizing for the daily average while the traffic arrives in a two-hour peak.
  • Setting a large max output on every call and burning output quota the answers never use.
  • Retrying a 429 immediately and in lockstep, which adds load and keeps the limit hit.

Check yourself · 2 of 3

Your client gets a 429 from the provider. What is the best handling?

Choose one answer

Check yourself · 3 of 3

Why can a burst of traffic trigger a 429 even when the per-minute average is under the limit?

Choose one answer

Practice items, not counted towards your mastery.

Start here