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
}
'import requests
url = "https://api.novita.ai/v2/upscale"
payload = {
"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
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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
})
};
fetch('https://api.novita.ai/v2/upscale', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v2/upscale",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v2/upscale"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novita.ai/v2/upscale")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v2/upscale")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"task_id": "<string>",
"warn": "<string>"
}
}Deprecated
Upscale V2
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
}
'import requests
url = "https://api.novita.ai/v2/upscale"
payload = {
"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
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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
})
};
fetch('https://api.novita.ai/v2/upscale', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v2/upscale",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v2/upscale"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novita.ai/v2/upscale")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v2/upscale")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"upscaler_1\": {},\n \"resize_mode\": {},\n \"upscaling_resize\": {},\n \"upscaling_resize_w\": {},\n \"upscaling_resize_h\": {},\n \"upscaling_crop\": {},\n \"upscaler_2\": {},\n \"extras_upscaler_2_visibility\": {},\n \"gfpgan_visibility\": {},\n \"codeformer_visibility\": {},\n \"codeformer_weight\": {},\n \"img_expire_ttl\": 123\n}"
response = http.request(request)
puts response.read_body{
"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
Request Body
Base64 encoded image
AI upscalers are models trained with massive amounts of data.
Resizing mode:
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).
The target image width; the maximum image size is 2048.
The target image height; the maximum image size is 2048.
Zoom in after cropping.
AI upscalers are models trained with massive amounts of data.
Range [0~1], Extras upscaler 2 visibility.
Range [0~1], GFPGAN visibility.
Range [0~1], CodeFormer visibility.
Range [0~1], CodeFormer weight (0 = maximum effect, 1 = minimum effect).
Image storage time (seconds). Range [0, 604800].
Response
CodeNormal=0, CodeInternalError=-1, CodeInvalidJSON=1, CodeModelNotExist=2, CodeTaskIdNotExist=3, CodeInvalidAuth=4, CodeHostUnavailable=5, CodeParamRangeOutOfLimit=6, CodeCostBalanceFailure=7, CodeSamplerNotExist=8, CodeTimeout=9, CodeNotSupport=10
Example
requestcurl --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
}'
{
"code": null,
"msg": "",
"data": {
"task_id": "",
"warn": ""
}
}
Last modified on December 25, 2024
Was this page helpful?
⌘I