Errors

Errors use OpenAI's shape: {"error": {"message", "type", "code", "param"}}. Retry 429, 502, 503 and 504 with exponential backoff. Don't retry 400, 401, 402, 403, 404 or 413.

HTTPCodeWhen
400invalid_requestBad body or unsupported parameter (message names it)
400unsupported_contentImage or audio parts
400context_length_exceededinfrastructure partner rejects for length, or estimate clearly too large
401invalid_api_keyMissing, unknown or revoked key
402insufficient_creditsAvailable balance can't cover the reservation
403organization_suspendedSuspended
404model_not_foundUnknown model or not allowed for this key
413request_too_largeBody over 10 MB
429rate_limit_exceededOur key or organisation limit, with `Retry-After`
500internal_errorOur fault
502upstream_errorThe infrastructure partner failed
503model_unavailableModel paused or no eligible deployment
504upstream_timeoutThe infrastructure partner timed out