POST
/
v3
/
async
/
upscale
Upscale
curl --request POST \
  --url https://api.novita.ai/v3/async/upscale \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "extra": {
    "response_image_type": "<string>",
    "webhook": {
      "url": "<string>",
      "test_mode": {
        "enabled": true,
        "return_task_status": "<string>"
      }
    },
    "custom_storage": {
      "aws_s3": {
        "region": "<string>",
        "bucket": "<string>",
        "path": "<string>",
        "save_to_path_directly": true
      }
    },
    "enterprise_plan": {
      "enabled": true
    },
    "enable_nsfw_detection": true,
    "nsfw_detection_level": 123
  },
  "request": {
    "model_name": "<string>",
    "image_base64": "<string>",
    "scale_factor": 123
  }
}'
{
  "task_id": "<string>"
}
An indispensable tool for improving the quality of images generated by Stable Diffusion.
This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the image generation results.

Request Headers

Content-Type
string
required
Enum: application/json
Authorization
string
required
Bearer authentication format, for example: Bearer {{API Key}}.

Request Body

extra
object
Optional extra parameters for the request.
request
object
required

Response

task_id
string
Use the task_id to request the Task Result API to retrieve the generated outputs.

Example

This is an indispensable tool for improving the quality of images generated by Stable Diffusion. Try it in playground. Request:
curl --location --request POST 'https://api.novita.ai/v3/async/upscale' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "extra": {
        "response_image_type": "jpeg"
    },
    "request": {
        "model_name": "RealESRGAN_x4plus_anime_6B",
        "scale_factor": 2,
        "image_base64": "{{base64 encoded image}}"
    }
}'
HTTP status codes in the 2xx range indicate that the request has been successfully accepted; code 400 indicates a request parameter error, while status codes in the 5xx range indicate internal server errors. Response:
{
    "task_id": "71dd988e-632e-4339-b217-74bcbe6db0ee"
}
Use task_id to retrieve images HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors. You can find the image URLs in the imgs field of the response. Request:
curl --location 'https://api.novita.ai/v3/async/task-result?task_id=71dd988e-632e-4339-b217-74bcbe6db0ee' \
--header 'Authorization: Bearer {{API Key}}'
Response:
{
    "extra": {
        "enable_nsfw_detection": false
    },
    "task": {
        "task_id": "71dd988e-632e-4339-b217-74bcbe6db0ee",
        "task_type": "UPSCALE",
        "status": "TASK_STATUS_SUCCEED",
        "reason": "",
        "eta": 0,
        "progress_percent": 0
    },
    "images": [
        {
            "image_url": "https://faas-output-image.s3.ap-southeast-1.amazonaws.com/prod/71dd988e-632e-4339-b217-74bcbe6db0ee/949a5ba965c84bd99764ca9b2f51fc6a.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIASVPYCN6LRCW3SOUV%2F20240321%2Fap-southeast-1%2Fs3%2Faws4_request&X-Amz-Date=20240321T093338Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&x-id=GetObject&X-Amz-Signature=e7d4dab3a82555d10ded8ad82769122b75b6bda179c60f3bacb978d85d23252e",
            "image_url_ttl": "3600",
            "image_type": "jpeg",
            "nsfw_detection_result": null
        }
    ],
    "videos": []
}