Rate Limits
Zihin API enforces rate limits to ensure fair usage and platform stability.
Limits by Plan
| Plan | Requests/min | Requests/day | Max Tokens/request |
|---|---|---|---|
| Free | 10 | 100 | 4,096 |
| Basic | 60 | 5,000 | 8,192 |
| Pro | 300 | 50,000 | 32,768 |
| Enterprise | Custom | Custom | Custom |
Rate Limit Headers
Every response includes rate limit information:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1708200000
Retry-After: 30
| Header | Description |
|---|---|
X-RateLimit-Limit | Max requests per window |
X-RateLimit-Remaining | Remaining requests |
X-RateLimit-Reset | Unix timestamp when limit resets |
Retry-After | Seconds to wait (only on 429) |
Handling Rate Limits
When you receive a 429 Too Many Requests:
- Read the
Retry-Afterheader - Wait the specified duration
- Retry the request
async function callWithRetry(payload, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const res = await fetch(url, { method: 'POST', body: JSON.stringify(payload) });
if (res.status !== 429) return res;
const wait = parseInt(res.headers.get('Retry-After') || '5');
await new Promise(r => setTimeout(r, wait * 1000));
}
throw new Error('Rate limit exceeded after retries');
}