API Kandinsky
Programmatic access to Kandinsky models: image generation and editing, video with sound, talking avatars, upscaling
Where to start
Choose what you want to create.
How it works
All models work the same way and differ only in address and parameters.
Create a task
POST /v1/tasks/<model>
Check the status
GET /v1/tasks/<task_id>
Download the result
GET /v1/tasks/<task_id>/result
https://kandinskyapi.sberdevices.ru/v1Authorization: the header Authorization: Bearer <token>. The body of every POST contains censor and an object params with the model parameters. Files (images, video, audio) are passed in params as a Base64 string.
Quick start
Copy an example and paste your token: in cURL instead of <TOKEN>, in Python into the TOKEN. Python examples need the requests library: python -m pip install requests.
Create a task
Send a POST to the address of the model you need. The response contains a task_id.
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/k6-image-t2i" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"query":"A watercolor house by a lake at dawn","resolution":"1024x1024"}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
params = {"query": "A watercolor house by a lake at dawn", "resolution": "1024x1024"}
r = requests.post(f"{API}/tasks/k6-image-t2i", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
Check the status
Request the task by task_id until it finishes.
curl -fS "https://kandinskyapi.sberdevices.ru/v1/tasks/<TASK_ID>" \
-H "Authorization: Bearer <TOKEN>"
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
task_id = "<TASK_ID>" # Task ID from the first step
r = requests.get(f"{API}/tasks/{task_id}", headers=headers, timeout=30)
r.raise_for_status()
print(r.json())
Download the result
When the task is done, download the file: PNG, MP4 or ZIP, depending on the model.
curl -fS "https://kandinskyapi.sberdevices.ru/v1/tasks/<TASK_ID>/result" \
-H "Authorization: Bearer <TOKEN>" \
--output result.bin
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
task_id = "<TASK_ID>"
r = requests.get(f"{API}/tasks/{task_id}/result", headers=headers, timeout=120)
r.raise_for_status()
with open("result.bin", "wb") as f:
f.write(r.content)
Images
Kandinsky 6 T2I
Text to image
Creates an image from a text description.
POST/v1/tasks/k6-image-t2i
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/k6-image-t2i" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"query":"A watercolor house by a lake at dawn","resolution":"1024x1024","beautificator":"enabled"}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
params = {
"query": "A watercolor house by a lake at dawn",
"resolution": "1024x1024",
"beautificator": "enabled",
}
r = requests.post(f"{API}/tasks/k6-image-t2i", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
query | yes | Prompt text, up to 2048 characters. Describes the content and style of the image. |
resolution | no | 1280x768, 768x1280, 1024x1024, 768x768 or auto. With auto the service picks the size. |
beautificator | no | enabled (default) or disabled. Automatic prompt expansion. |
Result. PNG. Sizes: 1280×768, 768×1280, 768×768 and 1024×1024.
Kandinsky 6 I2I
Images and text to image
Builds a new image from 1–3 references and a text description. The order of the pictures matters: you can refer to them in the prompt.
POST/v1/tasks/k6-i2i
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/k6-i2i" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"image":["<BASE64_IMAGE_1>"],"query":"Place the object on a light studio background","beautificator":"enabled"}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"image": [b64("reference.png")],
"query": "Place the object on a light studio background",
"beautificator": "enabled",
}
r = requests.post(f"{API}/tasks/k6-i2i", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
image | yes | An array of 1–3 JPEG/PNG images in Base64, up to 4096×4096. Request body up to 100 MB. |
query | yes | Text up to 2048 characters. Say which elements to take from each image and how to compose the result. |
beautificator | no | enabled (default) or disabled. |
Result. PNG. The size is chosen by aspect ratio: 1280×768, 768×1280 or 1024×1024.
Kandinsky Super Res
Image upscaling
Enlarges an image 2 or 4 times and redraws the details.
POST/v1/tasks/kandinsky-image-sr-2
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/kandinsky-image-sr-2" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"image":"<BASE64_IMAGE>","upscale":2,"creativity":4}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"image": b64("input.png"),
"upscale": 2,
"creativity": 4,
}
r = requests.post(f"{API}/tasks/kandinsky-image-sr-2", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
image | yes | One JPEG/PNG image in Base64, up to 4096×4096. Request body up to 100 MB. |
upscale | yes | Upscale factor: 2 or 4. |
creativity | no | An integer from 0 to 8, default 4. 0 stays closer to the source, 8 gives more freedom in the details. |
Result. PNG. The maximum result size is 16384×16384.
Video
Kandinsky 6.5 Preview T2VA
Text to video with sound
Generates video with sound from text. Describe the scene, the motion and the sound you want in the prompt.
POST/v1/tasks/kandinsky6.5-preview-t2va
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/kandinsky6.5-preview-t2va" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"query":"A calm sea at sunset, the soft sound of waves","aspect_ratio":"16:9","duration":5}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
params = {
"query": "A calm sea at sunset, the soft sound of waves",
"aspect_ratio": "16:9",
"duration": 5,
}
r = requests.post(f"{API}/tasks/kandinsky6.5-preview-t2va", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
query | yes | Text up to 2048 characters: scene, motion, sound. |
aspect_ratio | no | 1:1, 16:9 or 9:16. Default 16:9. |
duration | no | Duration in seconds: 5, 10 or 15. Default 5. |
Result. MP4 with sound, 24 fps. Sizes: 1:1 — 2048×2048, 16:9 — 2688×1536, 9:16 — 1536×2688.
Kandinsky 6.5 Preview Ref2VA
References to video with sound
Brings up to three references to life: characters, objects, background. Describe the action and the sound in the prompt.
POST/v1/tasks/kandinsky6.5-preview-i2va
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/kandinsky6.5-preview-i2va" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"images":["<BASE64_IMAGE_1>"],"query":"A character walks through a park, birds can be heard","aspect_ratio":"16:9","duration":5}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"images": [b64("reference.png")],
"query": "A character walks through a park, birds can be heard",
"aspect_ratio": "16:9",
"duration": 5,
}
r = requests.post(f"{API}/tasks/kandinsky6.5-preview-i2va", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
images | yes | An array of 1–3 JPEG/PNG images in Base64, up to 4096×4096. Request body up to 100 MB. |
query | yes | Text up to 2048 characters: action and sound. |
aspect_ratio | no | 1:1, 16:9 or 9:16. Default 16:9. |
duration | no | 5, 10 or 15 seconds. Default 5. |
Result. MP4 with sound, 24 fps. Sizes are the same as for T2VA.
Kandinsky 6 Pro Fast T2VA
Text to video, sound and size settings
Fast video from text. You can choose the size and turn off the sound track.
POST/v1/tasks/k6-video-pro-fast-t2va
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/k6-video-pro-fast-t2va" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"query":"Dawn over the sea","aspect_ratio":"16:9","beautificator":"disabled","output_resolution":"hd","include_audio":true}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
params = {
"query": "Dawn over the sea",
"aspect_ratio": "16:9",
"beautificator": "disabled",
"output_resolution": "hd",
"include_audio": True,
}
r = requests.post(f"{API}/tasks/k6-video-pro-fast-t2va", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
query | yes | Text up to 2048 characters. |
aspect_ratio | no | 1:1, 16:9 or 9:16. Default 1:1. |
beautificator | no | enabled or disabled. Off by default: turn it on only if you need automatic prompt expansion. |
output_resolution | no | sd, hd or fhd. Default fhd. |
include_audio | no | true or false, default true. false turns off the generated sound track. |
Result. MP4, 5 seconds, 24 fps. SD — 16:9 864×480, 9:16 480×864, 1:1 480×480. HD — 1280×720, 720×1280, 720×720. FHD — 1920×1080, 1080×1920, 1080×1080.
Kandinsky 6 Pro Fast I2VA
Image to video, sound and size settings
Animates an image. Describe the motion of the object or the camera in the prompt.
POST/v1/tasks/k6-video-pro-fast-i2va
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/k6-video-pro-fast-i2va" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"image":"<BASE64_IMAGE>","query":"The camera slowly moves closer","aspect_ratio":"9:16","beautificator":"disabled","output_resolution":"fhd","include_audio":false}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"image": b64("input.png"),
"query": "The camera slowly moves closer",
"aspect_ratio": "9:16",
"beautificator": "disabled",
"output_resolution": "fhd",
"include_audio": False,
}
r = requests.post(f"{API}/tasks/k6-video-pro-fast-i2va", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
image | yes | One JPEG/PNG image in Base64, up to 4096×4096. Request body up to 100 MB. |
query | yes | Text up to 2048 characters: motion of the object or the camera. |
aspect_ratio | no | 1:1, 16:9 or 9:16. Default 1:1. |
beautificator | no | enabled or disabled. Off by default. |
output_resolution | no | sd, hd or fhd. Default fhd. |
include_audio | no | true or false, default true. |
Result. MP4, 5 seconds, 24 fps. SD — 16:9 832×464, 9:16 464×832, 1:1 624×624. HD — 1536×864, 864×1536, 1152×1152. FHD — 1856×1056, 1056×1856, 1408×1408.
Kandinsky Video Super Res
Video upscaling
Increases the resolution of a finished video 2 or 4 times, or up to a chosen size.
POST/v1/tasks/kandinsky-video-sr-2
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/kandinsky-video-sr-2" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"video":"<BASE64_MP4>","resolution_scale":2,"include_audio":true}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"video": b64("input.mp4"),
"resolution_scale": 2,
"include_audio": True,
}
r = requests.post(f"{API}/tasks/kandinsky-video-sr-2", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
video | yes | One MP4 in Base64, up to 100 MB, at least 256×256. |
resolution_scale | no | 2 or 4, default 2. Used if target_resolution is not set. |
target_resolution | no | hd, fullhd or 2k. Sizes depend on the orientation of the input video. |
include_audio | no | true or false, default true. Keeps the original sound track; false removes it (no sound is generated). |
Result. Video of the chosen size. HD — 1280×720 / 720×1280 / 720×720, Full HD — 1920×1080 / 1080×1920 / 1080×1080, 2K — 2560×1440 / 1440×2560 / 1440×1440. Input limits: at ×2 up to 1280×720 and 180 s, at ×4 up to 960×576 and 60 s.
Avatars
Kandinsky Avatar 1.0
Talking video avatar
Turns a portrait into a talking video. The avatar speaks a text or ready-made speech.
POST/v1/tasks/giga_avatar
curl -X POST "https://kandinskyapi.sberdevices.ru/v1/tasks/giga_avatar" \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"censor":true,"params":{"image":"<BASE64_IMAGE>","query":"Hello! Let me tell you about our new product.","default_audio":"woman","repeat":false,"emotion":"happiness_subtle","output_resolution":"fhd"}}'
import requests
API = "https://kandinskyapi.sberdevices.ru/v1"
TOKEN = "PASTE_YOUR_API_TOKEN_HERE"
headers = {"Authorization": f"Bearer {TOKEN}"}
import base64
from pathlib import Path
def b64(path):
return base64.b64encode(Path(path).read_bytes()).decode("ascii")
params = {
"image": b64("portrait.png"),
"query": "Hello! Let me tell you about our new product.",
"default_audio": "woman",
"repeat": False,
"emotion": "happiness_subtle",
"output_resolution": "fhd",
}
r = requests.post(f"{API}/tasks/giga_avatar", headers=headers,
json={"censor": True, "params": params}, timeout=60)
r.raise_for_status()
print("task_id:", r.json()["task_id"])
| Field | Req. | Values and limits |
|---|---|---|
image | yes | JPEG/PNG in Base64, a string or a list (the first one is used). Up to 25 MB per file, up to 2048 px on each side. |
query | conditional | Non-empty text up to 1000 characters. Required when repeat: false, optional when repeat: true. |
audio | conditional | MP3/WAV in Base64. Required when repeat: true. When repeat: false it is a voice sample for synthesis and takes priority over default_audio. Trimmed after 60 seconds. |
repeat | no | true or false, default false. true uses the speech you pass as is, without synthesis. |
default_audio | conditional | man or woman. A voice preset, used when repeat: false and there is no audio. |
emotion | no | default, anger_subtle, happiness_subtle, sadness_subtle, anger_moderate, happiness_moderate, sadness_moderate. Default is default. |
output_resolution | no | sd, hd or fhd. Default fhd. |
include_sd_video | no | true or false, default false. With FHD it can add an SD version to the ZIP. |
Result. A video avatar. With repeat: true you need ready-made non-empty audio.
General
Limits
- Images: JPEG or PNG in Base64, up to 4096×4096 (up to 2048 px per side for avatars).
- Request body: up to 100 MB.
- All results are downloaded through
/result: PNG, MP4 or ZIP.
Access and limits
Tokens and limits are issued on request, and limits are set separately for each client. To get access, write to us.