Skip to content

Errors ​

MoonNexAI returns a consistent error object to help you diagnose failures, correct requests and decide whether to retry.

Response format ​

json
{
  "error": {
    "message": "Invalid API key.",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

Common Errors ​

HTTP status codetypecodeAnnotations
400invalid_request_errorinvalid_requestrequest body is formatted wrong, field or field type is missing correctly.
400invalid_request_errorinvalid_parameterParameter values are not within the scope of the model support, e.g. size, duration, aspect ratio or quantity are not valid.
401authentication_errormissing_api_keyThe request is missing the Authorization header.
401authentication_errorinvalid_api_keyAPI Key does not exist, is invalid or is formatted wrong.
403permission_errormodel_not_enabledCurrently account does not have a model or capability for the request facility.
404not_found_errortask_not_foundtask does not exist or does not belong to the current account.
409task_errortask_canceledtask has been cancelled and cannot continue searching for results or retry the current task.
422content_policy_errorasset_rejectedUploading media assets or generating content does not comply with Platform security rules.
429rate_limit_errorrate_limit_exceededThe request rate exceeds the account or model limit.
402billing_errorinsufficient_balanceaccount balance or insufficient amount.
500server_errorservice_errorMoonNexAI service anomaly, please try again later.
502service_errormodel_service_unavailableModel services are not available for the time being, but please try again later.
504timeout_errorrequest_timeoutrequest or task await timeout.

Recommended handling ​

  • 400, 422: Check request parameters and media assets for resubmission.
  • 401: Checks the API Key for correctness and confirms that the placeholder is not used as a real key.
  • 402, 403: Check balance, amount and model privileges at MoonNexAI console.
  • 429: Reduce concurrency and increase the delay between retries.
  • 5xx: Retry with exponential backoff and retain task_id for troubleshooting.