Skip to contentSkip to content

Error handling

The data API returns an OpenAI-compatible error body: {"error":{"type":"…","code":"…","message":"…","param":null}}. It does not use the control-plane envelope.

codeHTTPMessageRecommended action
invalid_api_key401The key is invalid, revoked, or expiredCheck the key, then create or rotate it from API Keys
insufficient_credits402The available balance is insufficient or negativePurchase a top-up or renew the current plan
entitlement_expired403The plan has expiredRenew the plan
entitlement_model_not_allowed403The current plan or key does not allow this modelReview the plan and key model allowlist, then select an allowed model
rate_limited429An RPM, TPM, or concurrency limit was exceededReduce the request rate, retry with backoff, and review key and plan limits
settlement_degraded503The service is busyTry again later and check the status page
upstream_error502The model service is temporarily unavailableRetry with backoff or select another model, and check the status page
invalid_request_error400The request parameters are invalidCorrect the request using the safe error message and documentation

Do not log a full error response, key, prompt, or response. For diagnosis, retain only the HTTP status, safe error code, and X-Request-Id.