Rate limits
nokai.studio utiliza un limitador token-bucket con scope por API key y por cliente.
Valores por defecto
- 60 de burst -- un bucket lleno contiene 60 tokens.
- ~1 solicitud/segundo sostenido -- el bucket se recarga a 1 token/segundo.
Existen sobrescrituras por plan. Los headers de respuesta siempre reflejan tus límites reales.
Headers de respuesta
Cada respuesta incluye:
| Header | Significado |
|---|---|
X-RateLimit-Limit | Capacidad del bucket. |
X-RateLimit-Remaining | Tokens restantes después de esta solicitud. |
X-RateLimit-Reset | Timestamp Unix (segundos) cuando el bucket se recarga. |
En 429 Too Many Requests:
| Header | Significado |
|---|---|
Retry-After | Segundos a esperar antes de reintentar. Respeta esto -- es exacto. |
Verificar límites sin consumir
GET /v1/limits devuelve la capacidad disponible actual en todos los buckets sin gastar un token. Consulta Referencia de la API -> Limits.
Patrón de backoff
async function callApi(url: string, init: RequestInit): Promise<Response> {
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(url, init);
if (res.status !== 429) return res;
const wait = Number(res.headers.get('Retry-After') ?? 1) * 1000;
await new Promise((r) => setTimeout(r, wait + Math.random() * 250));
}
throw new Error('Rate limited after 5 retries');
}Usa Retry-After para 429 -- es autoritativo. Reserva el backoff exponencial para 5xx.
Qué cuenta como una solicitud
Una solicitud HTTP = un token, independientemente del tamaño del payload. Los callbacks del servicio de generación se originan en la plataforma; no cuentan contra tu límite.
¿Necesitas un límite mayor?
Abre un ticket de soporte (POST /v1/support/tickets) o envía un email a hello@nokai.studio. Límites más altos están disponibles en planes Pro y personalizados.