Skip to main content

Upscale


Upscale

POST https://api.novita.ai/v3/async/upscale

An indispensable tool to improve 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 at https://novita.ai/reference/task/task.htmlopen in new window to retrieve the image generation results.

Request header parameters

  • Content-TypestringRequired

    undefined

    Enum:
    application/json
  • AuthorizationstringRequired

    Bearer authentication format, for example: Bearer {{API Key}}.

Request Body parameters

  • extraobject

    Optional extra parameters for the request.

    Show properties
  • requestobjectRequired

    Show properties

Responses

Example

This is an indispensable tool to improve the quality of images generated by Stable Diffusion.

Try it in playgroundopen in new window.

Request:

curl --location --request POST 'https://api.novita.ai/v3/async/upscale' \
--header 'Authorization: Bearer {{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 means requst params error, while status codes in the 5xx range indicate internal server errors.

Response:

{
    "task_id": "71dd988e-632e-4339-b217-74bcbe6db0ee"
}

Use task_id to get 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 get images url in imgs of response.

Request:

curl --location 'https://api.novita.ai/v3/async/task-result?task_id=71dd988e-632e-4339-b217-74bcbe6db0ee' \
--header 'Authorization: Bearer {{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": []
}
novita.ai API
novita.ai API