Image Upscaler

Image Upscaler enhances one source image and returns a hosted 2K, 4K, or 8K result. It uses the standard asynchronous image task API, including polling, callbacks, credit refunds on failure, and durable platform-hosted output URLs.

Model

ModelInputOutput
image-upscalerOne public image URLOne enhanced image URL

Pricing

Every run costs 4 credits ($0.02). Target resolution and output format do not change the price. Existing account-specific pricing multipliers still apply.

Create a Task

curl -X POST https://api.aivideoapi.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "image-upscaler",
    "callback_url": "https://your-server.com/webhook",
    "input": {
      "image_urls": ["https://example.com/source-image.jpg"],
      "target_resolution": "4k",
      "output_format": "jpeg"
    }
  }'

Request Body

FieldTypeRequiredDescription
modelstringYesMust be image-upscaler
inputobjectYesUpscaling parameters
callback_urlstringNoHTTP(S) URL notified when the task completes or fails

Input Parameters

FieldTypeRequiredDescription
image_urlsstring[]YesExactly one public HTTP(S) source image URL
target_resolutionstringNo2k, 4k (default), or 8k
output_formatstringNojpeg (default), png, or webp

The upstream-only enable_base64_output and enable_sync_mode fields are not supported. Results are always returned as URLs through the asynchronous task flow.

Create Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "397ce9f2-c04e-4244-ac33-3af19a7cc297"
  }
}

The 4-credit base price is pre-charged when the task is accepted. A failed task is refunded automatically.

Query a Task

curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
  -H "Authorization: Bearer sk-your-api-key"

Task status moves from pending to processing, then to completed or failed.

Completed

{
  "id": "397ce9f2-c04e-4244-ac33-3af19a7cc297",
  "status": "completed",
  "model": "image-upscaler",
  "created_at": 1785900000,
  "completed_at": 1785900015,
  "output": {
    "urls": [
      "https://file.aivideoapi.ai/images/2026/08/05/upscaled.webp"
    ]
  }
}

Failed

{
  "id": "57c8772c-f834-46f3-9b7d-81f92e104050",
  "status": "failed",
  "model": "image-upscaler",
  "created_at": 1785900000,
  "error": {
    "code": "upstream_error",
    "message": "Image upscaling failed"
  }
}

Callback

Pass callback_url when creating the task. The platform sends a POST request after the result is copied to platform storage or after the task fails. The callback body matches the task query response.

HeaderDescription
Content-Typeapplication/json
X-Eventtask.completed or task.failed
X-Task-IdPlatform task ID
X-TimestampUnix timestamp in seconds

Non-2xx responses and timeouts are retried up to three total attempts: immediately, after 3 minutes, and after 10 minutes. You can always fall back to GET /v1/tasks/{taskId}.


Error Codes

When a request fails, the API returns a JSON error response:

{
  "error": {
    "code": "insufficient_credits",
    "message": "Your credit balance is too low. Please top up.",
    "type": "billing_error"
  }
}

Error Reference

HTTP StatusCodeTypeDescription
400invalid_requestinvalid_request_errorMissing or invalid parameters
401invalid_api_keyauthentication_errorAPI key is invalid, disabled, or deleted
402insufficient_creditsbilling_errorCredit balance too low, please top up
403ip_not_allowedpermission_errorRequest IP not in the key's allowlist
404model_not_foundinvalid_request_errorModel does not exist or is inactive
404task_not_foundinvalid_request_errorTask ID does not exist
429rate_limit_exceededrate_limit_errorToo many requests, please slow down
429spend_limit_exceededbilling_errorKey spend limit reached (hourly/daily/total)
500internal_errorapi_errorUnexpected server error
503upstream_errorupstream_errorUpstream AI provider returned an error

Common Scenarios

invalid_request (400)

Returned when required fields are missing or invalid.

{
  "error": {
    "code": "invalid_request",
    "message": "'model' is required.",
    "type": "invalid_request_error"
  }
}

insufficient_credits (402)

Your balance is too low. Check your balance with GET /v1/credits and top up in Dashboard > Billing.

invalid_api_key (401)

Possible causes:

  • The key does not start with sk-
  • The key has been disabled or deleted
  • The user account has been banned

upstream_error (503)

The upstream AI provider returned an error. This may happen when:

  • The input contains sensitive or prohibited content
  • The provider is temporarily unavailable
  • The request parameters are not supported by the provider

Credits are automatically refunded when a task fails due to upstream errors.