Skip to content

Errors

An error comes back as JSON with an HTTP status:

{
  "error": {
    "type": "invalid_request",
    "code": "invalid_request",
    "param": "input",
    "message": "The request body isn't a valid request: ..."
  }
}

Beta.

StatustypeWhat it meansWhat to do
400invalid_requestThe request is malformed, or asks for something the API doesn't do (such as store: true)Fix the field named in param
401unauthorizedThe key is missing, wrong, or revokedCheck the Authorization header
402insufficient_balanceYour balance can't cover the requestTop up, then retry
402payment_requiredYou sent no key, so the request must be paid forPay the invoice in PAYMENT-REQUIRED and send the request again (Pay per request), or use a key
403limit_reachedA limit you set was hit; param names itRaise the limit, or wait for it to reset
404not_foundNo such model or routeCheck the model name against GET /v1/models
429too_many_requestsToo many requests at onceRetry after a short wait
500server_error, model_errorSomething broke on our side or the model'sRetry; tell us if it keeps happening
502upstream_failedEvery provider we tried failed before answeringRetry, or name another model
503no_routeNo provider meets your request's needs, privacy setting, or price capLoosen route, privacy, or max_price

Every answer has an x-request-id header. Include it when you ask us about a request.

Errors mid-answer

Once an answer has started, an error can't change the status code. A stream ends with a response.failed event, and a full answer comes back with "status": "failed". Either way the error object carries a code and a message.