Documentation

Errors

Error shape, codes, and which ones to retry.

Every error uses one shape. retryable says whether the same request may succeed if repeated.

{
  "error": {
    "message": "Rate limit reached (60 requests per minute). Retry in 12s.",
    "type": "friday_error",
    "code": "rate_limited",
    "retryable": true,
    "request_id": "req_..."
  }
}

429 responses include a Retry-After header in seconds. 503 upstream_busy sends Retry-After: 5. Quote the request_id when you contact support. If a stream fails after it started, the error object arrives as a data line, followed by [DONE].

StatusCodeRetryableWhen
400invalid_requestNoMalformed or missing field (model, messages, input, prompt, file, ...).
400invalid_jsonNoThe body is not valid JSON.
400unsupported_parameterNoA parameter this endpoint does not support yet (for example tools or response_format), or n other than 1 on images.
400wrong_endpointNoThe model does not belong to this endpoint (for example a chat model on /images/generations).
400max_tokens_too_largeNomax_tokens is above the model's maximum output tokens.
400invalid_idempotency_keyNoIdempotency-Key is longer than 200 characters.
400upstream_rejectedNoThe model provider rejected the parameters or input. Not charged.
401missing_api_keyNoNo Authorization: Bearer header.
401invalid_api_keyNoUnknown key.
401api_key_revokedNoThe key was revoked.
401api_key_expiredNoThe key passed its expiry.
402insufficient_balanceNoAvailable balance is below the worst-case reservation. Add funds or lower max_tokens.
402org_budget_exceededNoWould pass the organization's monthly hard cap.
402project_budget_exceededNoWould pass the project's monthly hard cap.
402key_budget_exceededNoWould pass the key's spend cap.
403account_suspendedNoThe organization or key owner is suspended.
403api_pausedNoAPI access is paused for the organization.
403project_archivedNoThe key's project is archived.
403model_not_allowedNoThe key's allowed-models list excludes this model.
404model_not_foundNoUnknown or inactive model id.
404agent_not_foundNoThe agent is not in this organization.
409duplicate_requestNoThis Idempotency-Key already ran with the same body. Not run or charged again.
413request_too_largeNoJSON body larger than 2 MB.
413input_too_largeNoChat input is larger than 400,000 characters.
413file_too_largeNoAudio file larger than 25 MB.
415unsupported_media_typeNoWrong Content-Type (send application/json, or an audio file for transcription).
422idempotency_key_reusedNoThis Idempotency-Key was used with a different body.
429rate_limitedYesPer-key or per-organization requests per minute reached. See Retry-After.
429concurrency_limitYesToo many requests in progress for the organization.
499client_cancelledNoThe request was cancelled by the client.
500internal_errorYesSomething went wrong on our side.
502model_unavailableYesThe model could not complete the request, or returned nothing. Not charged.
502gateway_unavailableYesThe model service is not reachable. Not charged.
503upstream_busyYesThe model is at capacity (Retry-After: 5). Not charged.
503price_unavailableNoThe model has no active price yet.
504upstream_timeoutYesThe model did not answer within 120 seconds. Not charged.