Errors

API Error Handling

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

Errors

When a request fails, Skytells returns structured JSON so you can branch on stable error_id values (not on human-readable messages).

Which shape you get depends on the route:

Two error levels

Errors fall into two buckets: problems with the request or access (API-level), or problems while running the model after the job was accepted (prediction-level).

LevelWhat it means
API-levelInvalid input, missing parameters, auth, permissions, credits, rate limits — before work is queued to prediction serving.
Prediction-levelModel or serving failed after the job was accepted — e.g. model not found, not authorized, unsupported use case, policy/moderation, or bad output. Often appears on the prediction resource as status: "failed".

How the two levels differ in practice

API-level: Your request fails validation or policy before anything is queued to prediction serving.

request 4xx/5xx + error_id You Skytells API Validation / auth

Prediction-level: Validation passed; the job was queued and ran in serving, but inference failed. For predictions, the HTTP status on GET can still be 200 OK while the JSON body shows status: "failed" and an error message.

request 200 OK + prediction JSON You Skytells API Validation Prediction serving Prediction.status = failed

Safety controls apply during serving; a policy violation can surface as a failed prediction with an error string.

Learn more: Prediction-level errors.

Error shapes

Skytells returns different JSON shapes depending on the API surface:

ShapeTypical routes
Unified REST (standard envelope)Auth, models, predictions, rate limits, and most v1 REST — see Predictions API structured error
InferenceChat, Responses, Embeddings (OpenAI-compatible; no top-level status / response) — Inference error response
Failed prediction objectFailed predictions — failed prediction object

Unified REST (API-level example) — returned before a prediction is queued:

Standard unified error shape
{
  "status": false,
  "response": "short summary",
  "error": { "http_status": http_status_code, "message": "human-readable reason", "details": "extra context", "error_id": "error_code_value" }
}

Inference — nested error object (serving or generation failure after the request reaches inference infrastructure):

Inference error response
{
  "error": { "http_status": http_status_code, "message": "human-readable reason", "details": "extra context", "error_id": "error_code_value" }
}

This covers cases where the language model fails to produce output, parameters are wrong for the model, or the model is not authorized — see Inference errors.

Failed prediction — job was accepted and reached a terminal failed state:

Failed prediction object (excerpt)
{
  "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"
}

The full prediction object can include additional fields; see Error objects.


HTTP status codes (quick reference)

StatusMeaning
400Bad request — malformed query, invalid parameters, or client-fixable input
401Unauthorized — missing or invalid API key
402Payment / credits — negative balance or insufficient credits
403Forbidden — policy, security, or model access rules
404Not found — unknown model slug or resource
422Unprocessable — valid JSON but semantic validation failed
429Too many requests — rate or quota limits
500Internal error — unexpected server failure
502Bad gateway — prediction serving error (see Prediction errors)
503Service unavailable — temporary overload (e.g. prediction handler)
  • Inference errors — Chat, Responses, Embeddings: error_id catalog and HTTP behavior.
  • Prediction errors — Predictions routes, HTTP codes per error_id, and status: "failed" on the prediction resource.

Where in the pipeline did it fail?

LevelWhat failed
API-levelRequest, access, or validation — before serving starts
Prediction-levelModel / serving run — after the prediction exists

Error resources


API-level errors

These occur before the request is queued to prediction serving.

400 — Bad Request / infrastructure

The request was malformed or invalid.

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 is out of range (e.g. Predictions list: per_page not 150) or a required parameter is missing / invalid on other routes (e.g. Inference: missing model, messages not an array).Fix the parameter per error.details / paramInference errors · Prediction errors.
INVALID_PARAMETER_COMBINATIONPredictions: query parameters or input fields conflict or cannot be used together.Adjust the request per error.detailsPrediction errors.
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_FORMATPredictions list filters: from / to must be Y-m-d.Use calendar dates in YYYY-MM-DD form — Prediction errors.
INFRASTRUCTURE_ERRORContent Rejected or Internal infrastructure error, such as a server error or a network issue.Retry the request. If it persists, check status.skytells.ai for active incidents and contact support.
INVALID_REQUESTMalformed or invalid input when using Inference API.Validate JSON; match model and API schema. Set Content-Type: application/json.

For Inference-specific validation errors, see Inference API errors.


401 — Unauthorized

Authentication failed or the account cannot 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

Insufficient balance or credits for the operation.

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.
MODEL_NOT_ACTIVEThe model exists but is not active.Choose another model or retry later — Prediction errors.
MODEL_NOT_BILLABLEThe model has no billable price configured.Use a billable model — Prediction errors.
PARAMETER_NOT_ALLOWEDInput uses a restricted field (e.g. enterprise-only).Adjust the request body — Prediction errors.

404 — Not found

The requested resource does not exist.

error_idDescriptionResolution
MODEL_NOT_FOUNDNo model exists with the given slug (Predictions list / create — wrong model slug).Check the slug against the Models reference.

Note: Predictions GET /v1/predictions/{uuid} does not return 404 for a missing prediction. Use 502 with an error_id in the structured envelope — Prediction errors — Get one.


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 body was well-formed but could not be applied (semantic or policy failure).

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.
VALIDATION_ERRORAPIPredictions create failed validation (e.g. missing model or input).Fix the body; shape: Predictions API structured error. See Prediction errors — Request validation.
MODEL_NOT_SUPPORTEDAPIModel type not supported for this operation (e.g. not image/video/audio).Use a supported model — Prediction errors.

If the prediction returns status: "failed" with an error field, inference failed after the job was accepted. Shape: failed prediction object. Details: Prediction errors — Prediction-level errors.

Common causes:

  • The model could not produce output from the given prompt or parameters.
  • Safety controls triggered.
  • The model is temporarily unavailable.
  • The model is not authorized for this request.
  • An error at the edge of model serving.

429 — Too many requests

You exceeded a gateway or API-surface limit for your account. Limits apply per account (across API keys) and may be scoped by model, time window, tokens, and route — not one global counter.

Typical causes: burst traffic, tight polling on GET endpoints, or high concurrency on the same model.

See Account tiers for plan ceilings, and Rate limits for x-skytells-ratelimit-* headers and backoff.

error_idDescriptionResolution
RATE_LIMIT_EXCEEDEDToo many requests (or tokens) in the window for this account / model / route.Use Retry-After when present; otherwise details.reset if returned, or exponential backoff with jitter. Reduce concurrency or spread load.

Example body (shape may vary slightly by endpoint):

{
  "error_id": "RATE_LIMIT_EXCEEDED",
  "message": "Too many requests. Please wait before retrying."
}

Response headers

HeaderRole
Retry-AfterOptional on 429. When present, whole seconds to wait before retrying. May be omitted when the wait is not positive — do not assume it is always set.
x-skytells-ratelimit-*May mirror gateway state on the error response; see Rate limits — Response headers.

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, 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 it persists, check status.skytells.ai or contact support.
MODEL_UNAVAILABLEThe model service is temporarily unavailable.Retry after a short delay or check API Status.

502 — Bad gateway

The prediction serving layer returned an error while running or loading a prediction, or access was denied for a private resource. Responses use the unified API error envelope with HTTP 502 and a stable error_id.

error_idDescriptionResolution
ACCESS_DENIEDPrivate or non-sharable model, prediction, or resource; or not your prediction.Do not retry — fix id, model access, or account; see Prediction errors — ACCESS_DENIED.
otherPrediction serving runtime failure (error_id in body).Branch on error_id; see Prediction errors and 502 example.

503 — Service unavailable

Temporary overload or an empty handler result on Predictions create (e.g. PREDICTION_ERROR). Often safe to retry with backoff.

Resolution: Prediction errorsPREDICTION_ERROR.


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 body = await res.json();
  const err = body.error;
  const error_id = err?.error_id;
  const message = err?.message;
  switch (error_id) {
    case 'INSUFFICIENT_CREDITS':
      // redirect to billing
      break;
    case 'RATE_LIMIT_EXCEEDED':
      // implement backoff
      break;
    default:
      console.error(error_id, message);
  }
}

Error response shapes

Canonical JSON for Inference ({ "error": { ... } }) and unified REST (status, response, error) is on Error objectsInference error response and Predictions API structured error. Per-error_id behavior for Inference: Inference API errors.

How is this guide?

On this page