Errors

Every error comes back as JSON with a status, a reason and a message.

Errors come back as JSON: {"error": {"code": 401, "reason": "invalid_token", "message": "..."}}.

StatusReasonWhat to do
401missing_token, invalid_tokenThe key is missing, wrong or revoked. Make a new one.
402api_balance_emptyAdd credits on the API page.
403unknown_modelUse an id from /v1/models.
429key_rate, key_tokens, spend_velocityA key or spend limit. Wait for the Retry-After seconds, then retry.
429session, weeklyA plan window is used up. Wait for X-Ghost-Reset, or pay with credits.
429rate, concurrencyToo many requests a minute, or at once, for your plan. Slow down and retry.
502empty_upstreamThe model sent no reply. Retry, or try another model.
5xxRetry with backoff.