Errors

When a request fails, the API returns an HTTP status and a JSON body with a stable code. Branch on code, never on message: messages are written for humans and can change.

Error shape

Error response

{
  "error": {
    "code": "BUDGET_EXCEEDED",
    "message": "Service pixora has spent $2.0004/$2 today (2026-09-12 UTC); the budget resets in 3600s",
    "requestId": "<upstream request id, when a model was reached>",
    "model": "google.gemma-3-12b-it"
  }
}

requestId and model are present when the error came from a model call. Include requestId when you report a problem.

Request and account errors

StatusCodeMeaningRetry
400INVALIDThe body failed validation — an unknown field, a missing maxTokens, a bad type.No
400USER_REQUIREDYour service meters credits and requires userId on every call.No
400MODEL_NOT_PRICEDA metered call named a model with no catalog price, so its cost can't be charged.No
401UNAUTHORIZEDThe key exists but isn't llm::<role>::<app>::<email> with customerId <app>.No
403NO_SERVICEThe key's service isn't registered.No
403DISABLEDYour service has been disabled.No
403MODEL_NOT_ALLOWEDYour service is restricted to a list of models and this isn't one of them.No
402INSUFFICIENT_CREDITSThe user's wallet can't cover the most this call could cost. Nothing was charged.After a top-up or the monthly reset
404NOT_FOUNDNo such route or method.No
409CREDITS_NOT_ENABLEDGET /v1/credits/{userId} on a service that doesn't meter credits.No
429BUDGET_EXCEEDEDYour service reached its daily budget.After midnight UTC
501NOT_IMPLEMENTEDThe route exists but isn't available yet (streaming).No
500INTERNALAn unexpected error in the API.Yes, with backoff
503WALLET_BUSYThe user's wallet kept changing under concurrent calls.Yes, with backoff

Model errors

These come from the model call. Throttling, server errors and network failures have already been retried inside the API before you see them.

StatusCodeMeaningRetry
400BAD_REQUESTThe model rejected the request — an unsupported parameter or schema.No
403AUTHThe model isn't enabled for the account — see unavailable models.No
404NOT_FOUNDThe model doesn't exist in this region.No
422TRUNCATEDOutput stopped at maxTokens before it was complete. Raise maxTokens; don't edit the prompt.With a larger maxTokens
429THROTTLEDThe model's tokens-per-minute quota is still exhausted after retries.Yes, later
499ABORTEDThe call was cancelled.
502BAD_OUTPUTThe model broke the contract: output wasn't valid JSON, or called the wrong tool.Maybe once
502SERVERMantle kept failing after retries.Yes, later
504TIMEOUTThe model call exceeded 26 seconds.With less output

Gateway errors

API Gateway answers these itself, so the body is {"message": "..."} rather than an error object.

StatusBodyMeaning
403{"message":"Forbidden"}Missing or unknown x-api-key.
429{"message":"Too Many Requests"}Over your plan's request rate. Retry after a backoff.
429{"message":"Limit Exceeded"}Over your plan's daily request quota, until midnight UTC.
504{"message":"Endpoint request timed out"}The request ran past API Gateway's 29-second limit.

The SDK retries the gateway's 429 and 5xx responses automatically, and never retries BUDGET_EXCEEDED or INSUFFICIENT_CREDITS. It also raises three codes of its own when no usable response arrives — TIMEOUT, NETWORK and BAD_RESPONSE — described on the SDK page.

Was this page helpful?