Errors
Validation and content errors returned
The Nunchux API uses standard HTTP status codes. All error responses include a JSON body describing what went wrong.Client Error Response Format
Client errors (4xx) return a JSON body. Auth, rate-limit, and billing errors carry anerror object; request-validation failures carry a plain detail string.
Client Error Codes
400 Bad Request
The request is missing required parameters or contains invalid values such as missing prompt, invalid model ID, invalid dimensions. Returned as a plain detail string.401 Unauthorized
The API key in the X-API-Key header is missing, malformed, unknown, revoked, or expired (codes: missing_api_key, invalid_key_format, invalid_api_key, key_revoked, key_expired).403 Forbidden
The account does not have access to the requested model. Restricted models need an explicit grant. This response carriesdetail, not the error envelope.
429 Rate Limit
Too many requests in a short period. Code rpm_limit_exceeded for the per-minute cap, concurrent_limit_exceeded for the simultaneous-job cap. Back off and retry.402 Insufficient Credits
Your account does not have enough credits for this request. The response includes your current balance and the cost so you know exactly how many credits to add.Credit metadataThe 402 body is the standard error object.
code, message and request_id are always present. The credit amounts are not always included. When they are, they ride in error.details, with the deprecated creditsRequired and creditsBalance mirrors alongside.Server Error Response Format
Server errors (5xx) return a JSON body with adetail string. When the inference backend supplies a typed envelope, an error object with a machine-readable code rides alongside it.
Server Error Codes
500 Internal Server Error
An unexpected error occurred on the server.502 Bad Gateway
The inference service returned no data. The request was processed but no output was generated.503 Service Unavailable
The server is temporarily unavailable.504 Gateway Timeout
A request exceeded its time budget (code:engine_timeout). On an endpoint that takes a source image, fetching that image is the usual cause.
Retrying safely
Only429 and the 5xx family should be retried. Use exponential backoff: start at one second and double on each attempt (1s → 2s → 4s → 8s), capping at 3–5 tries. If a response includes a Retry-After header, honor it instead. Never retry a 4xx other than 429 — the request is malformed and will fail the same way again.