X-RateLimit-Limit header.
When you hit the limit
Exceeding the limit returns429 Too Many Requests with a rate_limit_error:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Per-key request limits and how to back off
X-RateLimit-Limit header.
429 Too Many Requests with a rate_limit_error:
{
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Too many requests. Slow down."
}
}
let delay = 1000;
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(url, opts);
if (res.status !== 429) return res;
await new Promise((r) => setTimeout(r, delay));
delay *= 2;
}
Was this page helpful?