Docs / image / Qwen Image 2.1 Image to Image
Qwen Image 2.1 Image to Image online
Edit images with Qwen Image 2.1 using plain-language instructions, with an optional mask to limit changes to one area.
Rp Mulai Rp320 / gambar
qwen2-1/image-to-image model id
1 · Create a task
Kirim permintaan untuk membuat tugas generasi image. Wajib header Idempotency-Key. Saldo direservasi sebesar estimasi; task gagal tidak ditagih.
curl -X POST https://getrun.id/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: my-task-001" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2-1/image-to-image",
"input": {
"prompt": "Replace only the woman's light-gray sweatshirt with a premium cobalt-blue knitted wool sweater.\n\nPreserve the same person, facial features, expression, hairstyle, skin texture, body proportions, pose, camera framing, background, and original lighting.\n\nAdd the exact text \"Kie AI\" across the upper chest in cream-colored intarsia knitting. Form the letters from visible yarn stitches that follow the fabric's folds, perspective, and shadows. Keep the complete wording clearly readable. Include realistic wool texture and a ribbed neckline and cuffs.",
"background": "opaque",
"image_urls": [
"https://example.com/input.jpg"
],
"resolution": "1K",
"aspect_ratio": "auto",
"output_format": "png"
}
}'const res = await fetch('https://getrun.id/v1/tasks', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Idempotency-Key': 'my-task-001',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "qwen2-1/image-to-image",
"input": {
"prompt": "Replace only the woman's light-gray sweatshirt with a premium cobalt-blue knitted wool sweater.\n\nPreserve the same person, facial features, expression, hairstyle, skin texture, body proportions, pose, camera framing, background, and original lighting.\n\nAdd the exact text \"Kie AI\" across the upper chest in cream-colored intarsia knitting. Form the letters from visible yarn stitches that follow the fabric's folds, perspective, and shadows. Keep the complete wording clearly readable. Include realistic wool texture and a ribbed neckline and cuffs.",
"background": "opaque",
"image_urls": [
"https://example.com/input.jpg"
],
"resolution": "1K",
"aspect_ratio": "auto",
"output_format": "png"
}
}),
});
const task = await res.json();import requests
res = requests.post(
"https://getrun.id/v1/tasks",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "my-task-001",
},
json={
"model": "qwen2-1/image-to-image",
"input": {
"prompt": "Replace only the woman's light-gray sweatshirt with a premium cobalt-blue knitted wool sweater.\n\nPreserve the same person, facial features, expression, hairstyle, skin texture, body proportions, pose, camera framing, background, and original lighting.\n\nAdd the exact text \"Kie AI\" across the upper chest in cream-colored intarsia knitting. Form the letters from visible yarn stitches that follow the fabric's folds, perspective, and shadows. Keep the complete wording clearly readable. Include realistic wool texture and a ribbed neckline and cuffs.",
"background": "opaque",
"image_urls": [
"https://example.com/input.jpg"
],
"resolution": "1K",
"aspect_ratio": "auto",
"output_format": "png"
}
},
)
task = res.json()Input parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
seed |
integer | No | The same seed with the same prompt and parameters reproduces the same image on the same model version. The seed actually used is returned with the result. | 0 |
prompt |
string | Yes | Describe what you want the result to look like. Any language is supported, up to 5000 characters. When a mask is uploaded, describe what should be generated inside the white area instead. (max 5000 chars) | Replace only the woman's light-gray sweatshirt |
mask_url |
string | No | Optional inpainting mask, which switches the request to local-edit mode. A black and white image where white marks the area to change and black stays untouched. It must be used with exactly one reference image, should have the same aspect ratio as that image, and cannot be combined with a transparent background. In local-edit mode the output ratio follows the reference image, so the aspect ratio and prompt rewriting settings are ignored. (file URL) | — |
background |
string | No | Background type. transparent outputs a PNG or WebP with a real alpha channel and cannot be used with JPEG. When using transparent, describe only the subject — prompts that mention a background, scene, surface, etc. may produce a non-transparent result. Opsi: opaque transparent |
opaque |
image_urls |
array | Yes | Reference images, 1 to 10 of them. Their order is the order the prompt refers to ("the first image", "the second image"). JPEG, PNG and WebP are supported, up to 30MB and 25MP each. The more references you add the less detail each one keeps, so stay within 4 when fidelity matters. When combining several people or objects into one picture, a landscape ratio such as 3:2 or 16:9 usually works better. (array of file URLs) | https://example.com/input.jpg |
resolution |
string | No | Output resolution tier. Only 1K and 2K are supported. 2K takes noticeably longer to generate. Opsi: 1K 2K |
1K |
aspect_ratio |
string | No | Output aspect ratio. Defaults to auto, which takes the aspect ratio of the first reference image and snaps it to the nearest supported ratio. Ignored in local-edit mode. Opsi: auto 1:1 4:3 3:4 3:2 2:3 16:9 9:16 21:9 9:21 |
auto |
nsfw_checker |
boolean | No | A configurable parameter. Defaults to true in the Playground. | true |
output_format |
string | No | Output image format. JPEG has no alpha channel, so it cannot be combined with a transparent background. Opsi: png webp jpeg |
png |
enhance_prompt |
boolean | No | Rewrites the prompt into a fuller scene description before generating, which noticeably improves quality. Enabled by default (also when the parameter is omitted); pass false to turn it off. | true |
2 · Poll the result
Ambil status tugas hingga selesai — poll tiap 2–5 detik.
Respons saat sukses:
{
"id": "task_9f2c…",
"status": "succeeded",
"model": "qwen2-1/image-to-image",
"price": {
"currency": "IDR",
"estimated": 320,
"reserved": 320,
"final": 320
},
"output": {
"urls": [
"https://storage.getcore.id/outputs/task_9f2c…/0.png"
],
"expires_at": "(7 hari setelah selesai)"
}
}
Status values
| Status | Keterangan |
|---|---|
queued | Tugas sedang diantrikan. |
processing | Sedang diproses. |
succeeded | Berhasil. |
failed | Gagal — lihat error detail, tidak ditagih. |
image/png, dilayani dari CDN kami dan berlaku 7 hari — salin ke penyimpananmu sendiri untuk jangka panjang.Best practices
Bila generation gagal, task berstatus failed dengan error.code ternormalisasi (mis. moderation_blocked, upstream_error) dan price.final = 0 — saldo dikembalikan otomatis. Daftar lengkap kode error ada di Error handling. Selalu kirim Idempotency-Key unik per tugas agar retry aman.
Coba tanpa kode: jalankan model ini langsung dari Playground atau lihat di API Market.
