Errors and retries

    Error codes returned by the Ertas AI Gateway, what each one means, which ones to retry, and how to use the Retry-After header.

    Ask AI about this page
    On this page

    Errors from the gateway itself use this shape:

    { "error": { "type": "ertas", "code": "credits_exhausted", "message": "You're out of Ertas credits. Top up on the Billing page." } }

    Errors from the model, such as a context that is too long, keep the model server's status and come back in the OpenAI error shape.

    Error codes

    StatusCodeMeaningWhat to do
    401missing_tokenNo API key was sentSend Authorization: Bearer $ERTAS_API_KEY
    401invalid_tokenThe key isn't recognisedCheck the value and the base URL
    401ertas_token_revoked / ertas_token_expiredThe key was revoked or expiredCreate a new key
    400invalid_jsonThe request body isn't valid JSONFix the body
    400invalid_model / unknown_modelmodel is missing or isn't on your endpointCopy the ID from the Models page
    400unsupported_for_providerA Responses API feature that needs stored responses, such as previous_response_idSend earlier turns in input
    402ertas_endpoint_inactiveAPI access isn't activatedVerify a card or make a purchase
    402credits_exhaustedNot enough credits for this API callTop up, or set a lower max_tokens
    413request_too_largeThe request is larger than the model can acceptSend less
    429rate_limit_errorOver your plan's rate limitBack off and retry
    503ertas_endpoint_provisioningYour endpoint is still being set upRetry after Retry-After
    503deployment_starting / deployment_waking / deployment_unavailableThe model is starting, restarting or at capacityRetry after Retry-After
    503ertas_billing_unavailableYour balance couldn't be checkedRetry after Retry-After
    502upstream_unreachableThe model couldn't be reachedRetry
    500internal_errorA problem on our sideContact support with the Ray ID

    Retrying

    • Retry 429, 502 and 503. Wait for the number of seconds in Retry-After when it's present, and back off exponentially otherwise.
    • Don't retry 400, 401, 402 or 413 unchanged. The response carries x-should-retry: false where retrying can't help.
    • OpenAI SDKs retry 429 and 5xx responses by default. Raise max_retries if you want them to ride out a model restart, which can take a few minutes during the beta.

    When you contact support, include the Ray ID from the cf-ray response header.