Rate limits and quotas

A limit per minute and a quota per day, both visible on every response.

Every key has two limits:

  • Requests per minute, over a sliding window.
  • Model tokens per day, reset at 00:00 UTC. The quota is checked before each request: a request that starts within quota finishes, even if it goes over.

The limits of your key depend on your plan. See pricing, or talk to sales for higher ones.

Headers

Every response carries:

Header
X-RateLimit-LimitRequests allowed per minute.
X-RateLimit-RemainingRequests left in the current window.
X-Request-IdThe request id.
Retry-AfterOn 429 rate_limited: seconds to wait.

When you hit a limit

codeWhat happenedWhat to do
rate_limitedToo many requests this minute.Wait Retry-After seconds. The SDKs do it for you.
quota_exceededDaily token quota used.Wait until 00:00 UTC, or raise your quota. Not retried.

Checking your usage

const usage = await ts.usage();
console.log(usage.today.remaining_tokens, usage.limits.requests_per_minute);

See GET /v1/usage.

On this page