API reference/POST /upscale
Upscale 2× / 4×
Increase resolution. Defaults to Real-ESRGAN, which restores and invents plausible detail, best for low-res or old photos. Pass model=swin2sr for faithful, no-invented-detail upscaling on product and archival images.
POSThttps://useknockout--api.modal.run/upscale
Parameters
Send as multipart/form-data unless noted otherwise.
FieldTypeDefaultDescription
filerequiredfile–Image to process. JPG, PNG, WebP, HEIC. Up to 10 MB and 4096×4096.
scaleint 2|42Output is scale× the input dimensions.
modelstringrealesrganUpscaler model. realesrgan (default) or swin2sr.
formatstringpngOutput format: png, webp, or jpg. Output is opaque, so jpg is valid here.
Request
curl -X POST "https://useknockout--api.modal.run/upscale" \
-H "Authorization: Bearer $TOKEN" \
-F "file=@cat.jpg" \
-F "scale=4" -F "model=swin2sr" \
-o out.pngResponse
HTTP/1.1 200 OK
content-type: image/png
x-knockout-latency: 412
x-knockout-model: Real-ESRGANErrors
FieldTypeDefaultDescription
401unauthorized–Missing or invalid token.
402payment_required–Free tier exhausted. Add a card to continue.
413payload_too_large–Image exceeds 10 MB or 4096×4096.
422no_subject_detected–Foreground could not be isolated from background.
429rate_limit_exceeded–Slow down. Retry-After header tells you when.
500internal_error–Something broke on our side. Include request_id when reporting.
413output_too_large–Scaled output exceeds 8192×8192.
Every error response also includes a
request_id in the JSON body. Quote it when reporting issues.Notes
- Real-ESRGAN (default): restores and invents plausible detail. Best for low-res, compressed, or old photos. Fast (~6s).
- Swin2SR (model=swin2sr): faithful, no invented detail. Best for product and archival accuracy, where fidelity matters more than added sharpness.
- 4× costs more latency than 2×. Watch your wall clock.