Kandinsky ImageSR logoKandinsky ImageSR

REST API REFERENCE

Kandinsky ImageSR 2.0 API Reference

Integrate hosted Kandinsky ImageSR 2.0 super-resolution into your app with a single authenticated HTTPS endpoint supporting both multipart uploads and JSON payloads.

1. Authentication & Endpoints

Generate a user API key in your dashboard and pass it via Authorization: Bearer sk_... or X-API-Key: sk_.... Failed upstream calls automatically refund credits.

POST/api/v1/upscale
GET/api/v1/health

2. Request Parameters

file / image_base64 / image_urlbinary | string · default: required

Upload binary file in multipart/form-data, or supply exactly one of image_base64 or public image_url in application/json.

upscale_factorinteger (1 | 2 | 4) · default: 2

1 = native resolution restoration (2 credits), 2 = 2x HD upscale (4 credits), 4 = 4x Ultra upscale up to 8192px (8 credits).

creativityinteger (0..8) · default: 4

Controls detail reconstruction strength. 0 stays strictly faithful to input pixels; 8 synthesizes richer fine textures.

overlapfloat (0.0..0.75) · default: 0.25

Tile blending overlap ratio used to keep large 4K/8K outputs seamless.

output_formatpng | webp | jpeg · default: png

Output encoding format for the delivered image.

qualityinteger (1..100) · default: 95

Compression quality for JPEG and WebP outputs (ignored for PNG).

response_formatimage | json · default: image (multipart) / json (JSON)

Return raw binary image stream with X-Output-Size headers, or a JSON payload containing base64 and timing metadata.

3. Code Examples

cURL (Multipart to Binary PNG)

curl -X POST "https://kandinsky-imagesr.com/api/v1/upscale" \
  -H "Authorization: Bearer sk_your_api_key" \
  -F "file=@sample.jpg" \
  -F "upscale_factor=4" \
  -F "creativity=4" \
  -F "output_format=png" \
  -F "response_format=image" \
  -o upscaled_4x.png

Python (JSON URL to Base64 WebP)

import base64
import httpx

res = httpx.post(
    "https://kandinsky-imagesr.com/api/v1/upscale",
    headers={"Authorization": "Bearer sk_your_api_key"},
    json={
        "image_url": "https://example.com/photo.jpg",
        "upscale_factor": 2,
        "creativity": 4,
        "output_format": "webp",
        "quality": 95,
        "response_format": "json",
    },
    timeout=120.0,
)
res.raise_for_status()
data = res.json()
with open("enhanced.webp", "wb") as f:
    f.write(base64.b64decode(data["image_base64"]))
print(data["output_size"], data["inference_seconds"], data["credits_used"])

JSON Response Example

{
  "task_id": "8f2c1b0a-...",
  "model": "kandinskylab/Kandinsky-ImageSR-2.0",
  "upscale_factor": 4,
  "creativity": 4,
  "overlap": 0.25,
  "input_size": [288, 215],
  "output_size": [1152, 860],
  "output_format": "png",
  "content_type": "image/png",
  "output_bytes": 284319,
  "inference_seconds": 2.85,
  "credits_used": 8,
  "image_base64": "iVBORw0KGgo...",
  "data_url": "data:image/png;base64,iVBORw0KGgo..."
}