Rate Limits
Rate limits depend on your subscription plan. Check your Usage page for current consumption. Limits reset based on your plan's billing cycle.
Rate Limit Response
When you hit a rate limit, the API returns 429 Too Many Requests.
📋429 Too Many Requests
1{
2 "error": {
3 "message": "Rate limit exceeded. Please try again later.",
4 "type": "rate_limit_error"
5 }
6}Best Practices
- Implement exponential backoff when you receive a 429 response.
- Use per-key quotas to prevent a single key from consuming all credits.
- Monitor your usage from the dashboard to avoid unexpected limits.
- Consider upgrading your plan if you consistently hit rate limits.
Retry Example
📒Exponential Backoff
1async function callWithRetry(fn, maxRetries = 3) {
2 for (let attempt = 0; attempt <= maxRetries; attempt++) {
3 try {
4 return await fn();
5 } catch (err) {
6 if (err.status !== 429 || attempt === maxRetries) throw err;
7 const delay = Math.pow(2, attempt) * 1000;
8 await new Promise(r => setTimeout(r, delay));
9 }
10 }
11}