Errors

Overview

Error handling reference for the Skytells API v1 — error codes, rate limits, and resolution guides.

Errors

When an API request fails, the Skytells API always returns a structured JSON body with a machine-readable error_id and a human-readable message:

{
  "error_id": "MODEL_NOT_FOUND",
  "message": "The model with slug 'example' does not exist"
}

Errors are grouped into two levels depending on where the problem happens:

API-level errors happen before a prediction starts. These are related to the request itself or to API access, such as invalid input, missing parameters, authentication failures, or permission issues.

Prediction-level errors happen after the API has already accepted your request and started running the model. In this case, the request was valid, but something went wrong during inference or model execution.

Error Levels

LevelDescription
API-levelErrors related to the API itself, such as invalid input, missing parameters, authentication failures, or permission issues.
Prediction-levelErrors related to the model inference, such as model not found, model not authorized, use case not supported, content policy violation, moderation error, or unprocessable entity.

Error Levels Flow

To make it easier to understand, here is a flow diagram of the error levels:

API Level Error Flow

Here's the flow of an API level error when the request is invalid:

request response: {code} You Skytells API Validation

At this error layer, your request is not yet queued to be served in our prediction serving infrastructure.

Prediction Level Error Flow

Here's the flow of a prediction level error when the model inference fails:

request failed response (200 OK) You Skytells API Validation Skytells GPU Infra Prediction.status = failed

At this error layer, your request was queued to be served in our prediction serving infrastructure, but the model inference failed. Please also note that Safety Controls are applied at this layer as well, so if the model inference fails due to a safety violation, the prediction will be failed and the error will be returned to you.

Learn more about Prediction Level Errors.


Error Resources


API Level Errors

API level errors are errors that happen before the request is queued to be served in our prediction serving infrastructure.

400 — Bad Request / Infrastructure Errors

The request was malformed or contained invalid input.

error_idDescriptionResolution
INVALID_INPUTOne or more input fields failed validation against the model's input_schema.Check the model's input schema for required and valid fields.
INVALID_PARAMETERA query parameter (e.g. per_page, page) is out of the allowed range.Ensure per_page is between 1 and 50 and page is a positive integer.
UNSUPPORTED_MEDIA_TYPEThe Content-Type header is not application/json.Set Content-Type: application/json on all POST requests.
MISSING_REQUIRED_FIELDA required top-level field (model, input) is absent from the request body.Include all required fields in your request payload.
INVALID_DATE_FORMATDate field is not in the correct ISO 8601 format.Ensure the date is in the correct format.
INFRASTRUCTURE_ERRORContent was rejected due to safety policies or other infrastructure issues.Contact support.

Sometimes Skytells performs pre-checks on the request before it is queued to be served in our prediction serving infrastructure, In case of INFRASTRUCTURE_ERROR, please take a look at the Prediction Level Errors for more details on the prediction level errors.


401 — Unauthorized

Authentication failed or the account is not permitted to make requests.

error_idDescriptionResolution
UNAUTHORIZEDThe x-api-key header is missing or the key is invalid / revoked.Verify your API key in the Console and pass it as x-api-key.
ACCOUNT_SUSPENDEDYour account has been suspended.Contact support.

402 — Payment Required

The account balance or credits are insufficient to complete the request.

error_idDescriptionResolution
PAYMENT_REQUIREDYour account has a negative balance.Top up your balance in the Billing section.
INSUFFICIENT_CREDITSYou do not have enough credits to run this prediction.Purchase additional credits or use a lower-cost model.

403 — Forbidden

The request was understood but refused.

error_idDescriptionResolution
SECURITY_VIOLATIONThe request was flagged as malicious (e.g. prompt injection, abuse patterns).Review your input for policy violations. Repeated violations may lead to account suspension.
MODEL_ACCESS_DENIEDYour plan does not include access to this model.Upgrade your plan or use a model available on your current tier.

404 — Not Found

The requested resource does not exist.

error_idDescriptionResolution
MODEL_NOT_FOUNDNo model exists with the given slug.Check the slug against the Models reference.
PREDICTION_NOT_FOUNDNo prediction exists with the given ID, or it belongs to another account.Verify the prediction ID and that you are using the correct API key.

409 — Conflict

The request conflicts with the current state of a resource.

error_idDescriptionResolution
PREDICTION_NOT_CANCELLABLEThe prediction has already completed, failed, or been cancelled.No action needed — the prediction is already in a terminal state.

422 — Unprocessable Entity

The request was well-formed but was unable to be followed due to semantic errors.

error_idLevelDescriptionResolution
UNPROCESSABLE_ENTITYAPI, Prediction LevelThe request was well-formed but was unable to be followed due to semantic errors.Contact support.
MODERATION_ERRORAPI, Prediction LevelThe request was well-formed but was unable to be followed due to moderation errors.Contact support.
CONTENT_POLICY_VIOLATIONAPI, Prediction LevelThe request was well-formed but was unable to be followed due to content policy violations.Contact support.
USE_CASE_NOT_SUPPORTEDAPI, Prediction LevelThe request was well-formed but was unable to be followed due to use case not supported.Contact support.
MODEL_NOT_AUTHORIZEDAPI, Prediction LevelThe request was well-formed but was unable to be followed due to model not authorized.Contact support.

Also, If your prediction got returned with a status: failed and an error field, it means that the prediction level error occurred.

prediction.failed payload
{
  "status": "failed",
  "error": "Failed to generate image / video / audio ..etc.",
  "output": null,
  "data_removed": true,
  "metrics": {
    "predict_time": 1.082823234,
    "total_time": 1.094474004
  },
  "model": "truefusion",
  "source": "api",
}

It could be due to the following reasons:

  • The model could not produce output from the given prompt or input parameters.
  • Safety Controls triggered.
  • The model is currently unavailable.
  • The model is not authorized to be used.
  • Error at the edge of the model serving infrastructure.

429 — Too Many Requests

You have exceeded the allowed request rate.

error_idDescriptionResolution
RATE_LIMIT_EXCEEDEDYou have sent too many requests in a short period.Implement exponential backoff and retry after the duration indicated in the Retry-After header.

The request was refused due to legal reasons.

error_idDescriptionResolution
LEGAL_REASONSThe request was refused due to legal reasons.Contact support.

When you encounter this error, please contact support.


500 — Internal Server Error

An unexpected error occurred on the Skytells backend.

error_idDescriptionResolution
INTERNAL_ERRORAn unhandled server-side error occurred.Retry the request. If the issue persists, check status.skytells.ai or contact support.
MODEL_UNAVAILABLEThe model service is temporarily unavailable.Retry after a short delay or check the API Status page.

Handling Errors in Code

Error handling

TypeScript
const res = await fetch('https://api.skytells.ai/v1/predictions', {
  method: 'POST',
  headers: {
    'x-api-key': YOUR_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ model: 'skytells/truefusion-pro', input: { prompt: '...' } }),
});

if (!res.ok) {
  const { error_id, message } = await res.json();
  switch (error_id) {
    case 'INSUFFICIENT_CREDITS':
      // redirect to billing
      break;
    case 'RATE_LIMIT_EXCEEDED':
      // implement backoff
      break;
    default:
      console.error(error_id, message);
  }
}

How is this guide?

On this page