This page describes how to interact with the Image Upscaling, Background Removal, Text-to-Speech, and re-Imagine APIs. The following Python code samples demonstrate how to use these endpoints.
You can copy this code right into your program and test it out (but change the client id). The daily free quota applies to all requests. You can run this code as a notebook here.
Your client id is your secret identifier. Use a random client id to avoid collisions with other users!
!wget https://image-upscaling.net/assets/images/test_image.jpg
import requests
import json
serverurl = "https://image-upscaling.net"
client_id = "1234567890asdfghjklqwertzUIOPYXC"
cookies = { "client_id": client_id }
use_face_enhance = False
scale = 4
path = "test_image.jpg"
url = "/".join([serverurl, "upscaling_upload"])
data = {"scale": scale, "model": "plus"}
if use_face_enhance: # optional param for plus and general models
data["fx"] = ""
data["prompt"] = "" # optional param for diffuser
data["creativity"] = 0.1 # optional param for diffuser
files = {"image": open(path, "rb")}
response = requests.post(url, data=data, files=files, cookies=cookies)
print(response.text)
url = "/".join([serverurl, "upscaling_get_status"])
response = requests.get(url, cookies=cookies)
print(response.json())
while True:
url = "/".join([serverurl, "upscaling_get_status"])
response = requests.get(url, cookies=cookies).json()
for url in response["processed"]:
filename = url.split("/")[-1]
params = {"delete_after_download": ""}
content = requests.get(url, cookies=cookies, params=params).content
with open(filename, "wb") as f:
f.write(content)
if not response["pending"] and not response["processing"] and not response["processed"]:
break
else:
import time
time.sleep(1)
url = "/".join([serverurl, "removebg_upload"])
files = {"image": open("test_image.jpg", "rb")}
response = requests.post(url, files=files, cookies=cookies)
print(response.text)
while True:
url = "/".join([serverurl, "removebg_get_status"])
response = requests.get(url, cookies=cookies).json()
for url in response["processed"]:
filename = url.split("/")[-1]
params = {"delete_after_download": ""}
content = requests.get(url, cookies=cookies, params=params).content
with open(filename, "wb") as f:
f.write(content)
if not response["pending"] and not response["processing"] and not response["processed"]:
break
else:
import time
time.sleep(1)
url = "/".join([serverurl, "tts_submit"])
data = {
"text": "This is the text to speech api",
"voice": "am_michael",
"speed": 1.1
}
response = requests.post(url, json=data, cookies=cookies)
print(response.text)
while True:
url = "/".join([serverurl, "tts_get_data"])
response = requests.get(url, cookies=cookies).json()
for element in response:
url = element["result"]
if url != "":
print(url)
params = {"delete_after_download": ""}
content = requests.get(url, params=params, cookies=cookies).content
with open(url.split("/")[-1] + ".mp3", "wb") as f:
f.write(content)
if not response:
break
else:
import time
time.sleep(1)
The re-Imagine API allows you to apply various styles to images.
path = "test_image.jpg"
url = "/".join([serverurl, "reImagine_upload"])
files = {"image": open(path, "rb")}
data = {
"style": "Oil_Painting" # select the desired style
}
req_id = requests.post(url, files=files, cookies=cookies, data=data).text
print(req_id)
#test_image_2025-09-24_11:44:41.452959.png
## get the status for the current request
url = "/".join([serverurl, "reImagine_get_status"])
entries = requests.get(url, cookies=cookies).json()
for entry in entries:
if entry['req_id'] == req_id:
print(entry)
#{'input_image': 'http://test.image-upscaling.net/reImagine_download_data/test_image_2025-09-24_11:44:41.452959.png?get_input_image=True', 'is_completed': False, 'req_id': 'test_image_2025-09-24_11:44:41.452959.png', 'result': ''}
A helper function to wait for processing to complete and download the result.
import time
def wait_and_download(request_id, filename):
while True:
url = "/".join([serverurl, "reImagine_get_status"])
entries = requests.get(url, cookies=cookies).json()
for entry in entries:
if entry['req_id'] == request_id:
if entry['is_completed'] == True:
print("the image is processed")
url = entry['result']
response = requests.get(url, cookies=cookies)
with open(filename, "wb") as f:
f.write(response.content)
return
time.sleep(1)
# Usage example
filename = req_id
wait_and_download(req_id, filename)
If you're using this in a Jupyter notebook, you can display the result:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread(filename)
imgplot = plt.imshow(img)
plt.show()
url = "/".join([serverurl, "get_account_info"])
response = requests.get(url, cookies=cookies).json()
print(response)
# {'balance': 361.1489, 'client_id': 'af25d8e9971a747bf55c17195f39757a', 'email': 'marvineckhardt04092003@gmail.com', 'has_free_quota_left': False, 'ip': '35.221.153.79', 'quota_free': 0.2, 'quota_used': 0.3765}
/account?client_id=xxxxxwith a valid client id and it will make the browser switch to the given client id.