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
| Level | Description |
|---|---|
| API-level | Errors related to the API itself, such as invalid input, missing parameters, authentication failures, or permission issues. |
| Prediction-level | Errors 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:
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:
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
Prediction Level Errors
Complete reference for all prediction level error codes, HTTP status codes, and step-by-step resolution guides.
Safety Controls
Learn about the safety controls applied to the model inference.
Rate Limits
Learn about the rate limits applied to the API.
Inference API Errors
OpenAI-compatible error schema for the /v1/chat/completions, /v1/responses, and /v1/embeddings endpoints.
API Level Errors
API level errors are errors that happen before the request is queued to be served in our prediction serving infrastructure.
Always branch on error_id in your code — never on the message string. Messages are human-readable and may change between API versions without notice.
400 — Bad Request / Infrastructure Errors
The request was malformed or contained invalid input.
error_id | Description | Resolution |
|---|---|---|
INVALID_INPUT | One or more input fields failed validation against the model's input_schema. | Check the model's input schema for required and valid fields. |
INVALID_PARAMETER | A 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_TYPE | The Content-Type header is not application/json. | Set Content-Type: application/json on all POST requests. |
MISSING_REQUIRED_FIELD | A required top-level field (model, input) is absent from the request body. | Include all required fields in your request payload. |
INVALID_DATE_FORMAT | Date field is not in the correct ISO 8601 format. | Ensure the date is in the correct format. |
INFRASTRUCTURE_ERROR | Content 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_id | Description | Resolution |
|---|---|---|
UNAUTHORIZED | The 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_SUSPENDED | Your account has been suspended. | Contact support. |
Never expose your API key in client-side code, public repositories, or logs. If you suspect your key has been compromised, rotate it immediately from the Console.
402 — Payment Required
The account balance or credits are insufficient to complete the request.
error_id | Description | Resolution |
|---|---|---|
PAYMENT_REQUIRED | Your account has a negative balance. | Top up your balance in the Billing section. |
INSUFFICIENT_CREDITS | You 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_id | Description | Resolution |
|---|---|---|
SECURITY_VIOLATION | The 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_DENIED | Your plan does not include access to this model. | Upgrade your plan or use a model available on your current tier. |
Repeated SECURITY_VIOLATION errors may result in automatic account suspension. Ensure your inputs comply with the Skytells usage policies.
404 — Not Found
The requested resource does not exist.
error_id | Description | Resolution |
|---|---|---|
MODEL_NOT_FOUND | No model exists with the given slug. | Check the slug against the Models reference. |
PREDICTION_NOT_FOUND | No 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_id | Description | Resolution |
|---|---|---|
PREDICTION_NOT_CANCELLABLE | The 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_id | Level | Description | Resolution |
|---|---|---|---|
UNPROCESSABLE_ENTITY | API, Prediction Level | The request was well-formed but was unable to be followed due to semantic errors. | Contact support. |
MODERATION_ERROR | API, Prediction Level | The request was well-formed but was unable to be followed due to moderation errors. | Contact support. |
CONTENT_POLICY_VIOLATION | API, Prediction Level | The request was well-formed but was unable to be followed due to content policy violations. | Contact support. |
USE_CASE_NOT_SUPPORTED | API, Prediction Level | The request was well-formed but was unable to be followed due to use case not supported. | Contact support. |
MODEL_NOT_AUTHORIZED | API, Prediction Level | The request was well-formed but was unable to be followed due to model not authorized. | Contact support. |
In case of a prediction level error, the error will be returned in the prediction object.
Also, If your prediction got returned with a status: failed and an error field, it means that the prediction level error occurred.
{
"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_id | Description | Resolution |
|---|---|---|
RATE_LIMIT_EXCEEDED | You have sent too many requests in a short period. | Implement exponential backoff and retry after the duration indicated in the Retry-After header. |
The response includes a Retry-After header with the number of seconds to wait before retrying. Use exponential backoff — start at 1s, doubling each retry — to avoid thundering-herd retries hitting the limit again immediately.
451 — Unavailable For Legal Reasons
The request was refused due to legal reasons.
error_id | Description | Resolution |
|---|---|---|
LEGAL_REASONS | The 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_id | Description | Resolution |
|---|---|---|
INTERNAL_ERROR | An unhandled server-side error occurred. | Retry the request. If the issue persists, check status.skytells.ai or contact support. |
MODEL_UNAVAILABLE | The model service is temporarily unavailable. | Retry after a short delay or check the API Status page. |
5xx errors are transient in most cases. Retry with backoff before escalating. If the issue persists for more than a few minutes, check status.skytells.ai for active incidents.
Handling Errors in Code
Error handling
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);
}
}Related
- Prediction Errors — Prediction-level error codes and troubleshooting
- Rate Limits — Rate limiting behavior and retry strategies
- Inference API Errors — OpenAI-compatible error schema
- TypeScript SDK Error Handling —
SkytellsErrorclass and SDK error handling patterns - TypeScript SDK Reliability — Automatic retries and timeout configuration
- Predictions API — Creating and managing predictions
- Models API — Model discovery and schemas
- Responsible AI — Content safety policies
How is this guide?