Errors

SmartAPI returns standard HTTP status codes. Error bodies follow the format of the endpoint you called: OpenAI-style on /chat/completions and /responses, Anthropic-style on /messages.

Every response — including errors — includes an X-Request-Id header. Include this value when reporting an issue so it can be traced quickly.

Status codes#

HTTPError typeWhen it happens
400invalid_request_errorMalformed JSON or a missing model field.
400unsupported_protocolThe model does not support this endpoint/protocol.
401invalid_api_keyMissing, malformed, disabled, or expired API key.
402insufficient_quotaAccount balance is depleted.
404model_not_foundThe model is unknown or has been delisted.
429rate_limit_exceededA per-key rate limit or the total quota was exceeded.
502upstream_errorUpstream returned an error; retries across channels did not succeed.
503service_unavailableThe model is listed but no routing channel is currently available.
504upstream_timeoutUpstream response timed out; retries across channels did not succeed.
500internal_errorAn unexpected internal error.

OpenAI-style error body#

Returned by /chat/completions:

{
  "error": {
    "message": "Invalid, missing, disabled or expired API key.",
    "type": "invalid_api_key",
    "code": "invalid_api_key",
    "param": null
  }
}

Anthropic-style error body#

Returned by /messages:

{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Invalid, missing, disabled or expired API key."
  }
}

Handling errors#

  • 401 / 402 — Check that your key is active and your account has a positive balance. See Authentication and Billing.
  • 404 / 400 (unsupported_protocol) — Verify the model identifier and that you are calling the correct endpoint for that model. See Models.
  • 429 — Slow down or raise your key’s limits. See Rate Limits & Quotas.
  • 502 / 503 / 504 — Transient upstream issues. SmartAPI retries across channels automatically; retry the request after a short backoff.