All models
Alibaba
Image
Available
Qwen 2.1 Image to Image
Image to Image
From 60 credits (≈ ₹60.00) per request.
Parameters
| Parameter | Type | Description |
|---|---|---|
image_urlsRequired |
array<string> | Reference images, given as an array of 1 to 10 http(s) URLs. Required. The order of the array 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, and every URL must be directly retrievable with a GET. If an image URL cannot be fetched, the task fails with failCode 400. With more than 10 entries the request is rejected. The more references you supply the less detail each individual one keeps, so stay within 4 when |
promptRequired |
string | The prompt describing the result you want. Required. Any language is supported, up to 5000 characters; if it is longer, the request is rejected. When `mask_url` is supplied, use it to describe what should be generated inside the white area of the mask. max length 5000 |
mask_url |
string | Inpainting mask that switches the request into local-edit mode. A black and white image where **white marks the area to change and black is kept unchanged**, with a few pixels of feathering along the boundary. It must be used with exactly one entry in `image_urls`, otherwise the request is rejected. The mask should have the same aspect ratio as that reference image; a mask of a different size is scaled to it. In local-edit mode the output ratio follows the reference image, so `aspect_ratio` and format: uri |
aspect_ratio |
string | Output aspect ratio. Defaults to `auto`, which takes the aspect ratio of the first reference image and snaps it to the nearest supported ratio. The actual pixel size also depends on `resolution`. Ignored in local-edit mode. one of: "auto", "1:1", "4:3", "3:4", "3:2", "2:3", "16:9", "9:16", "21:9", "9:21" · default "auto" |
resolution |
string | Output resolution tier. `1K` is the faster option; `2K` produces four times the pixels and takes considerably longer, up to about 3 minutes with reference images. Only `1K` and `2K` are accepted — with any other value, including `4K`, the request is rejected. one of: "1K", "2K" · default "1K" |
background |
string | 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. one of: "opaque", "transparent" · default "opaque" |
output_format |
string | Output image format. `png` (default) and `webp` both carry an alpha channel and can be used with `background: transparent`. `jpeg` has no alpha channel and cannot be combined with a transparent background. one of: "png", "webp", "jpeg" · default "png" |
enhance_prompt |
boolean | 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. default true |
seed |
integer | The random seed. Omit it to generate with a random seed. Passing the same seed together with the same prompt and parameters reproduces the same image within the same service version. |
nsfw_checker |
boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
What you get back
Files arrive in output.files[] as private links that expire, with their type and size.
Use it from your code
# 1. Create the task
curl https://nexus.promptscenes.in/api/v1/tasks \
-H "Authorization: Bearer $NEXUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "qwen-2.1-image-to-image",
"input": {
"image_urls": null,
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "auto",
"resolution": "1K",
"background": "opaque",
"output_format": "png",
"enhance_prompt": true
},
"callback_url": "https://your-app.com/webhooks/nexus"
}'
# 2. Poll for the result
curl https://nexus.promptscenes.in/api/v1/tasks/TASK_ID \
-H "Authorization: Bearer $NEXUS_API_KEY"
import os, time, uuid, requests
API = "https://nexus.promptscenes.in/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['NEXUS_API_KEY']}"}
task = requests.post(
f"{API}/tasks",
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={
"model": "qwen-2.1-image-to-image",
"input": {
"image_urls": None,
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "auto",
"resolution": "1K",
"background": "opaque",
"output_format": "png",
"enhance_prompt": True,
},
"callback_url": "https://your-app.com/webhooks/nexus",
},
).json()
while task["status"] not in ("succeeded", "failed", "cancelled"):
time.sleep(3)
task = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS).json()
print(task["status"], task.get("output"))
const API = "https://nexus.promptscenes.in/api/v1";
const headers = {
Authorization: `Bearer ${process.env.NEXUS_API_KEY}`,
"Content-Type": "application/json",
};
let task = await fetch(`${API}/tasks`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({
"model": "qwen-2.1-image-to-image",
"input": {
"image_urls": null,
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "auto",
"resolution": "1K",
"background": "opaque",
"output_format": "png",
"enhance_prompt": true
},
"callback_url": "https://your-app.com/webhooks/nexus"
}),
}).then((r) => r.json());
while (!["succeeded", "failed", "cancelled"].includes(task.status)) {
await new Promise((r) => setTimeout(r, 3000));
task = await fetch(`${API}/tasks/${task.id}`, { headers }).then((r) => r.json());
}
console.log(task.status, task.output);
Request
{
"model": "qwen-2.1-image-to-image",
"input": {
"image_urls": null,
"prompt": "A cinematic shot of a lighthouse at dawn",
"aspect_ratio": "auto",
"resolution": "1K",
"background": "opaque",
"output_format": "png",
"enhance_prompt": true
}
}
Response
{
"id": "6f1c…",
"object": "task",
"model": "qwen-2.1-image-to-image",
"status": "succeeded",
"output": {
"files": [
{
"url": "https://…signed…",
"mime": "…",
"size": 0
}
]
},
"estimated_cost": "…",
"charged": "…"
}