GLM-5.2, MiniMax M3 and Opus 5 are now live. Try them now
EUrouter

Error handling

Handle API errors, retries, and rate limits safely.

OpenAPI JSON

EUrouter uses standard HTTP status codes. Read the response body for the error message and keep the request ID from the response headers when contacting support.

StatusMeaningRecommended action
400Invalid requestFix the request; do not retry unchanged.
401Missing or invalid API keyCheck the Authorization header and key.
402Insufficient creditsAdd credits or change your billing setup.
404Resource or model not foundCheck the endpoint and live model catalog.
408Request timed outRetry with backoff if the operation is safe to replay.
429Rate limit reachedWait, honor Retry-After when present, then retry.
5xxTemporary service or provider errorRetry with exponential backoff and jitter.

Retry example

async function requestWithRetry(url, options, maxAttempts = 4) {
  for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
    const response = await fetch(url, options);

    if (response.ok) return response;

    const retryable = response.status === 408 || response.status === 429 || response.status >= 500;

    if (!retryable || attempt === maxAttempts) {
      const body = await response.text();
      throw new Error(`EUrouter error ${response.status}: ${body}`);
    }

    const retryAfter = Number(response.headers.get("retry-after"));
    const delay = Number.isFinite(retryAfter) ? retryAfter * 1_000 : 500 * 2 ** (attempt - 1) + Math.random() * 250;

    await new Promise((resolve) => setTimeout(resolve, delay));
  }
}

Only retry operations that are safe to replay. For streaming requests, retry only before the first response token arrives.

Was this page helpful?

Still stuck? Contact support

On this page