Reference

Errors

Status codes, error codes, and what to do about each.

Failed requests are never charged.

Shape

/v1/systemone and the authentication and rate-limit errors on every /v1 endpoint use one envelope:

{"error": {"code": "bad_labels", "message": "question 'q': choice needs a criteria dict with >=2 labels"}}

/v1/pick reports validation errors as {"detail": "…"}. The Gemini API endpoints (/v1beta) return Google’s error shape.

The video endpoints (/v1/videos/*) use the OpenAI-style envelope:

{"error": {"message": "credit balance is empty; add credit at https://platform.parseclab.ai", "type": "billing_error", "code": "insufficient_quota"}}
StatusCodeMeaning
400invalid_request, invalid_json, unsupported_modelNo model, a body that is not a JSON object, or a model that is not a video model.
402insufficient_quotaThe account has no credit.
404model_not_found, not_foundUnknown model, or a request_id this account did not start.
502upstream_errorxAI failed.
504upstream_timeoutxAI did not answer in time.

xAI’s own 4xx errors, such as a rejected prompt, come back unchanged. A generation that fails while rendering is not an HTTP error: its poll answers 200 with "status": "failed" (Grok Imagine).

Codes

StatusCodeMeaning
401unauthorizedMissing, unknown or revoked key.
402insufficient_creditThe account’s free decisions or credit are used up.
413state_too_longThe state exceeds the 49,152-token context.
422no_questions, bad_question, bad_type, bad_labels, missing_state, bad_image, bad_requestThe request body is invalid; the message says which part.
503overloadedAt capacity. Retry after the Retry-After header.
502backend_unavailableThe model backend is down.
504timeoutThe model did not answer in time.

Retrying

Retry 503, 502 and 504 with exponential backoff, honouring Retry-After when it is present. Don’t retry 4xx responses without changing the request: they fail the same way every time.