API reference/POST /upscale

Upscale 2× / 4×

Increase resolution without losing detail. Defaults to Swin2SR (best for photos). Pass model=realesrgan for illustration/anime workloads.

POSThttps://useknockout--api.modal.run/upscale

Parameters

Send as multipart/form-data unless noted otherwise.

filerequiredfileImage to process. JPG, PNG, WebP, HEIC. Up to 10 MB and 4096×4096.
scaleint 2|42Output is scale× the input dimensions.
modelstringswin2srUpscaler model. swin2sr or realesrgan.
formatstringpngOutput format — png (with alpha) or webp.

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.png

Response

HTTP/1.1 200 OK
content-type: image/png
x-knockout-latency: 412
x-knockout-model: Swin2SR

Errors

401unauthorizedMissing or invalid token.
402payment_requiredFree tier exhausted. Add a card to continue.
413payload_too_largeImage exceeds 10 MB or 4096×4096.
422no_subject_detectedForeground could not be isolated from background.
429rate_limit_exceededSlow down. Retry-After header tells you when.
500internal_errorSomething broke on our side. Include request_id when reporting.
413output_too_largeScaled output exceeds 8192×8192.
Every error response also includes a request_id in the JSON body. Quote it when reporting issues.

Notes

  • Swin2SR — best on natural photos, slower (~400ms for 1024×1024 at 2×).
  • Real-ESRGAN — best on illustration / line art / anime, faster (~250ms).
  • 4× costs ~2.5× the latency of 2×. Watch your wall clock.