Skip to content

API reference

Errors and limits

Error format

Errors use the format of the route that was called. In /v1/chat/completions, type and code carry the same code. Messages are in Portuguese.

OpenAI · /v1/chat/completions
{
  "error": {
    "message": "Saldo insuficiente.",
    "type": "sem_saldo",
    "code": "sem_saldo"
  }
}
Anthropic · /v1/messages
{
  "type": "error",
  "error": {
    "type": "billing_error",
    "message": "Saldo insuficiente."
  }
}

Error codes

HTTPCodeCause
400invalidoInvalid JSON, missing messages, n other than 1, or a parameter rejected by the model.
400sem_visaoImage sent to a model without vision.
401chave_invalidaMissing, malformed or unknown key.
401chave_revogadaKey revoked in the console.
401chave_expiradaKey past its expiration date.
402sem_saldoBalance lower than the request reserve.
402teto_chaveKey daily or monthly cap reached.
403termosTerms of use not yet accepted in the console.
403restritoAccount without API access yet. Until launch, the API serves the team only.
403modelo_nao_permitidoModel not in the key's allowed list.
403conta_bloqueadaAccount blocked.
404modeloModel not found. The message lists the available IDs.
413grandeRequest body above the limit.
429limite_minutoKey requests-per-minute limit.
429muitas_falhasToo many attempts with an invalid key from the same IP. Includes Retry-After.
429limite_provedorModel overloaded. Try again shortly.
502provedorFailed to reach the model, or invalid response.
503indisponivelService unavailable.

Types in the Anthropic format

In /v1/messages, error.type follows the HTTP status:

HTTPerror.type
400invalid_request_error
401authentication_error
402billing_error
403permission_error
404not_found_error
413request_too_large
429rate_limit_error
502api_error
503overloaded_error

Limits

LimitValueWhen exceeded
Requests per key60 per minute429 limite_minuto
Invalid-key attempts per IP20 in 10 minutes429 muitas_falhas
Request body4 MB413 grande
Request duration300 seconds—
Responses per request (n)1400 invalido
Key spendDaily and monthly cap, optional402 teto_chave
BalanceReserve per request402 sem_saldo

The per-minute limit counts the last 60 seconds of each key. muitas_falhas returns the Retry-After header, in seconds.

Retries

  • 429 and 502: try again with an increasing wait.
  • 400, 401, 403, 404 and 413: fix the request before trying again.
  • 402: add balance or raise the key cap in the console.
A request the model answers with an HTTP error, or that never reaches the model, is not billed. See Billing.