Corion

Errors and retries

API errors use an OpenAI-compatible JSON shape where possible:

{
  "error": {
    "message": "A human-readable explanation",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_request"
  }
}

During MVP integration, clients should tolerate an additional request identifier or provider metadata and should not depend on exact message text.

StatusMeaningRetry?
400Invalid JSON, unsupported parameter, or request validation failureNo; correct the request.
401Missing, malformed, revoked, or invalid API keyNo; verify or rotate the key.
402Account credit is depletedNo; add credit or contact the account owner.
403Authenticated but not permitted for this resource or modelNo; verify account access.
413Request body is larger than the endpoint acceptsNo; reduce the prompt or payload.
429A rate or concurrency limit was reachedYes; obey Retry-After when present.
500Unexpected Corion application or gateway errorUsually; retry cautiously.
502An upstream provider returned an unusable responseUsually; retry after backoff.
503No provider capacity is currently availableYes; retry after backoff.

Status mapping can vary while the public gateway contract is finalized. Clients should primarily branch on the HTTP status class and stable machine-readable error.code values once published.

Retry strategy

Retry 429, 500, 502, and 503 with exponential backoff and random jitter. Honor Retry-After; otherwise begin near one second and cap the delay. Use a small attempt limit and surface a failure rather than retrying indefinitely.

Do not automatically retry 400, 401, 402, 403, or 413. A retry without changing the request or account state is unlikely to succeed.

For non-streaming requests, send an application-level idempotency identifier if a future API revision documents one. The MVP does not yet guarantee idempotency for chat completions.

For streaming requests, preserve the partial response and ask the user before restarting when duplicate text would be harmful. A dropped stream does not prove the provider performed no work, and metered usage may still have occurred.