POST
/
v2
/
upscale
Upscale V2
curl --request POST \
  --url https://api.novita.ai/v2/upscale \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "image": "<string>",
  "upscaler_1": {},
  "resize_mode": {},
  "upscaling_resize": {},
  "upscaling_resize_w": {},
  "upscaling_resize_h": {},
  "upscaling_crop": {},
  "upscaler_2": {},
  "extras_upscaler_2_visibility": {},
  "gfpgan_visibility": {},
  "codeformer_visibility": {},
  "codeformer_weight": {},
  "img_expire_ttl": 123
}'
{
  "code": 123,
  "msg": "<string>",
  "data": {
    "task_id": "<string>",
    "warn": "<string>"
  }
}
The Upscale V2 API is deprecated and will be removed in the future. Please migrate to Upscale V3.

POST Upscale V2

An indispensable tool for improving the quality of images generated by Stable Diffusion.

Request Headers

Authorization
string
required

Request Body

image
string
required
Base64 encoded image
upscaler_1
string|null
AI upscalers are models trained with massive amounts of data.
resize_mode
integer|null
Resizing mode:
upscaling_resize
number|null
The magnification factor of the image. For example, if you input upscaling_resize:2 with an image size of 512x512, it will return images of 1024x1024 (the maximum image size is 2048).
upscaling_resize_w
integer|null
The target image width; the maximum image size is 2048.
upscaling_resize_h
integer|null
The target image height; the maximum image size is 2048.
upscaling_crop
boolean|null
Zoom in after cropping.
upscaler_2
string|null
AI upscalers are models trained with massive amounts of data.
extras_upscaler_2_visibility
number|null
Range [0~1], Extras upscaler 2 visibility.
gfpgan_visibility
number|null
Range [0~1], GFPGAN visibility.
codeformer_visibility
number|null
Range [0~1], CodeFormer visibility.
codeformer_weight
number|null
Range [0~1], CodeFormer weight (0 = maximum effect, 1 = minimum effect).
img_expire_ttl
integer
Image storage time (seconds). Range [0, 604800].

Response

code
integer
CodeNormal=0, CodeInternalError=-1, CodeInvalidJSON=1, CodeModelNotExist=2, CodeTaskIdNotExist=3, CodeInvalidAuth=4, CodeHostUnavailable=5, CodeParamRangeOutOfLimit=6, CodeCostBalanceFailure=7, CodeSamplerNotExist=8, CodeTimeout=9, CodeNotSupport=10
msg
string
data
object

Example

request
curl --location 'https://api.novita.ai/v2/upscale' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
  'image': '{{base64 encoded image}}',
  'upscaler_1': 'R-ESRGAN 4x+',
  'resize_mode': 1,
  'upscaling_resize': null,
  'upscaling_resize_w': 1024,
  'upscaling_resize_h': 1024,
  'upscaling_crop': true,
  'upscaler_2': 'R-ESRGAN 4x+',
  'extras_upscaler_2_visibility': 0.5,
  'gfpgan_visibility': 0.5,
  'codeformer_visibility': 0.5,
  'codeformer_weight': 0.5,
  'img_expire_ttl': null
}'
response
{
  "code": null,
  "msg": "",
  "data": {
    "task_id": "",
    "warn": ""
  }
}