
Kandinsky 2 2 Inpaint
Kandinsky 2.2 inpainting: paints the masked part of a photo from a text prompt and leaves the rest untouched.
KANDINSKY_2_2_IMG2IMGKandinsky 2.2 restyles a photo from a text prompt and keeps its layout; the strength sets how far the result moves from the original.

Restyles a photo from a text prompt and keeps the photo's layout. Kandinsky 2.2 is a two-stage model: a prior maps the prompt into an image embedding, and a decoder repaints the photo's latents toward that embedding. How far the result moves from the original photo is the strength.
The weights are kandinsky-community/kandinsky-2-2-decoder at revision 9ae140d347fed8ce6e8bb3005dcc1f48543bb8e3 and kandinsky-community/kandinsky-2-2-prior at revision 9fc51ad5732afc5d031724219d22e6c42179c5a8. Both cards state the licence as Apache-2.0. The model was created by Arseniy Shakhmatov, Anton Razzhigaev, Aleksandr Nikolich, Igor Pavlov, Andrey Kuznetsov and Denis Dimitrov (kandinsky-community).
Taken from the text-guided image-to-image example on both pinned cards:
pipe = AutoPipelineForImage2Image.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()
prompt = "A fantasy landscape, Cinematic lighting"
negative_prompt = "low quality, bad quality"
image = pipe(prompt=prompt, image=original_image, strength=0.3, height=768, width=768).images[0]
This project loads the same weights as KandinskyV22PriorPipeline and KandinskyV22Img2ImgPipeline in float16 and turns on model CPU offload, as the card's example does: each network moves to the GPU only while it runs.
low quality, bad quality, from that example.num_inference_steps. The decoder's library default is 100, and the prior card's ControlNet image-to-image example uses 50. This slice accepts at most 50, so 50 is the default.guidance_scale or prior_guidance_scale. 4.0 is the library default those arguments would keep. The text-to-image example on the same card sets prior_guidance_scale=1.0 for a different task. That value is not used here. The number you pass is sent to both the prior and the decoder.The same photo, prompt, negative prompt, strength, steps, guidance and seed produce the same image. Seed -1 draws a seed in 0 … 2147483647 and prints it as [kandinsky-2-2-img2img] seed=....
Runs on an NVIDIA A100 slice of class mig2g: 20 GB of GPU memory and 24 GiB of RAM. Prior and decoder weights load in float16 with model CPU offload, so they wait in RAM (about 10 GB, which is why the 12 GiB mig1g class is too small) and only the network that is running sits on the GPU. A 1024-pixel image at 50 decoder steps usually finishes in well under a minute on that slice. Fewer steps, or a shorter long side, finish faster. Strength changes how much of the photo remains. It does not change the step count.
One image per request. Photos larger than 20 MB or 4096 pixels on a side are refused. The prompt cannot be longer than 1000 characters, and the negative prompt cannot be longer than 500. Strength outside 0.1–1.0, steps outside 1–50, guidance outside 0–15, and a seed outside -1 … 2147483647 are refused. A very small photo is scaled up to at least 64 pixels on each side. The result follows the prompt loosely and can change faces, text and small objects. High strength replaces more of the original. The weights are public and permissively licensed. Do not use the output to impersonate a real person.
| Name | Type | Required | Default | Details |
|---|---|---|---|---|
image | file | Yes | — | Photo to restyle. At most 20 MB and 4096 pixels on a side. The long side is resized to at most 1024, in steps of 64. image/jpeg, png, webp |
prompt | text | Yes | — | Style or content to apply while keeping the photo's layout. Max 1000 characters |
negative_prompt | text | No | low quality, bad quality | What the image should avoid. The model card uses \"low quality, bad quality\". Max 500 characters |
strength | number | No | 0.15 | How far to move from the photo. Up to about 0.2 keeps the photo's layout; 0.3 (the model card's example) and above repaint it from the prompt. 0.1–1 |
num_inference_steps | integer | No | 50 | Decoder steps. The card omits this (library default 100). Capped at 50 for this slice. 1–50 |
guidance_scale | number | No | 4.0 | Prior and decoder guidance. The image-to-image example omits this, so 4.0 is the library default. 0–15 |
seed | integer | No | -1 | Repeat a previous result. Leave at -1 for a new one each time. -1–2147483647 |
Output. Returns binary file.
Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=KANDINSKY_2_2_IMG2IMG" \
-H "X-API-Key: kg_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"input": {
"image": "https://example.com/input.png",
"prompt": "example",
"guidance_scale": 4.0,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 50,
"seed": -1,
"strength": 0.15
},
"outputFormat": "json"
}'
# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
-H "X-API-Key: kg_your_api_key"from kainguru import KainguruClient
with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
submitted = client.executions.execute(
"KANDINSKY_2_2_IMG2IMG",
{
"image": "https://example.com/input.png",
"prompt": "example",
"guidance_scale": 4.0,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 50,
"seed": -1,
"strength": 0.15
},
output_format="json",
)
result = client.executions.await_completion(submitted.id)
print(result.execution.output)Price per request: 4.076 credits ($0.04076). The price is shown again before every run; all prices are on the pricing page.

Kandinsky 2.2 inpainting: paints the masked part of a photo from a text prompt and leaves the rest untouched.

Edit a picture from a written instruction, changing objects, people, text or style while keeping the rest consistent.
Fine-tunable
Colourises black-and-white and faded photos: it keeps each photo's own light and shade and adds natural colours.
Fine-tunable
Removes objects, text, watermarks and blemishes from a photo: paint what to remove white on a black mask, and it fills…
Fine-tunable
Enlarges a small picture 4 times with latent diffusion, drawing in new plausible detail. A creative upscale: richer…
Fine-tunable
Edits a picture from an instruction in English or Chinese with LongCat-Image-Edit (6B, Apache-2.0): local and global…
Fine-tunable