Skip to content
Console

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. They are accepted in the chat or the console on first access.
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_minutoAccount requests-per-minute limit.
429limite_simultaneoAccount simultaneous-requests limit.
429muitas_falhasToo many attempts with an invalid key from the same IP. Includes Retry-After.
429modelo_sobrecarregadoModel overloaded. Try again shortly.
502modelo_indisponivelFailed 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

Safety filter, images and text size

HTTPCodeCause
400invalidoImage rejected: format other than png, jpeg, gif or webp; URL that is not https (port 443, no credentials, public address); failed URL download; or an image outside a user message. Nothing is reserved.
413muito_grandeText above the limit (messages, system, tools and arguments combined) or too many images in the request. Nothing is reserved or billed.
503filtro_indisponivelMessage with an image the safety filter could not check. Includes Retry-After; not billed.

In /v1/messages the same errors arrive as invalid_request_error (400), request_too_large (413) and overloaded_error (503), with the cause in error.message. Example of filtro_indisponivel:

OpenAI · /v1/chat/completions
{
  "error": {
    "message": "Verificação de segurança indisponível para esta mensagem. Tente de novo em instantes.",
    "type": "filtro_indisponivel",
    "code": "filtro_indisponivel"
  }
}
Anthropic · /v1/messages
{
  "type": "error",
  "error": {
    "type": "overloaded_error",
    "message": "Verificação de segurança indisponível para esta mensagem. Tente de novo em instantes."
  }
}

Limits

LimitValueWhen exceeded
Requests per account (all keys together)60 per minute429 limite_minuto
count_tokens requests per key60 per minute429 limite_minuto
Simultaneous requests per account (chat and API)5429 limite_simultaneo
Invalid-key attempts per IP20 in 10 minutes429 muitas_falhas
Request body4 MB413 grande
Text per request (messages, system, tools, arguments)600,000 characters413 muito_grande
Images per request16413 muito_grande
Image by https URL5 MB each, 16 MB per request, 5 s400 invalido
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 the account, over the API only (the chat has its own). A request counts as simultaneous until its answer ends. muitas_falhas returns the Retry-After header, in seconds.

Retries

  • 429, 502 and 503 filtro_indisponivel: 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.