Rate Limit

Rate Limit

All https://api.zeroweight.ai/api/v1/* routes are rate-limited by client IP.

Limit

  • 200 requests per minute per IP

When the limit is exceeded, the API returns:

{
  "detail": "Rate limit exceeded"
}

Recommendations

  • Cache avatar bundle requests on your server where appropriate.
  • Avoid polling for tokens or bundle metadata.
  • Reuse a room for a session instead of repeatedly reconnecting.
  • Add retry logic with backoff for 429 responses.

Example backoff strategy

async function withBackoff<T>(fn: () => Promise<T>, retries = 3): Promise<T> {
  let delay = 500;
 
  for (let attempt = 0; attempt < retries; attempt += 1) {
    try {
      return await fn();
    } catch (error) {
      if (attempt === retries - 1) {
        throw error;
      }
 
      await new Promise((resolve) => setTimeout(resolve, delay));
      delay *= 2;
    }
  }
 
  throw new Error("unreachable");
}