# qwen-image-2.1/image-to-image

> Qwen Image 2.1 image-to-image mode supports up to 10 reference images for multi-image editing and style transfer. Native 2K resolution output with 40-step inference and 7 aspect ratio options.

- **Provider:** AirCube
- **Category:** image-to-image
- **Price:** $0.0300 per run

## Key Features

- Up to 10 reference images — provide multiple reference images for style transfer, composition guidance, or multi-subject editing.
- Native 2K resolution — all outputs are generated at 2K-class dimensions without upscaling.
- 40-step inference — high-quality editing that preserves reference image characteristics.
- 7 aspect ratio options — 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16.
- Multi-image composition — combine elements from multiple reference images in a single generation.
- RGBA output — native transparency support for compositing workflows.

## Parameters

| Parameter | Required | Description |
| --- | --- | --- |
| `prompt` | Yes | Description of the image to generate or the edit to apply to the reference images. |
| `image` | Yes | One or more reference image URLs (up to 10). Guides the generation style, composition, or content. |
| `aspect_ratio` | No | Aspect ratio: 1:1 (default), 4:3, 3:4, 3:2, 2:3, 16:9, 9:16. |

## How to Use

1. Upload one or more reference images (up to 10) to guide the generation.
2. Describe what you want in the prompt — reference the uploaded images for style, composition, or content guidance.
3. Select an aspect ratio from the 7 available options.
4. Use multiple reference images for complex multi-subject compositions or style blending.

## Code Examples

### Python

```python
import os
import requests

response = requests.post(
    "https://aircube.ai/api/v3/qwen-image-2.1/image-to-image",
    headers={
        "Authorization": "Bearer " + os.environ["AIRCUBE_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
    "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
    "image": "https://example.com/style-reference.jpg",
    "aspect_ratio": "16:9"
},
    timeout=300,
)
data = response.json()

if data["success"]:
    print("ID:", data["data"]["id"], "Status:", data["data"]["status"])
else:
    print("Error:", data["error"]["message"])
```

### Node.js

```javascript
const response = await fetch("https://aircube.ai/api/v3/qwen-image-2.1/image-to-image", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.AIRCUBE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
  "image": "https://example.com/style-reference.jpg",
  "aspect_ratio": "16:9"
}),
});

const data = await response.json();

if (data.success) {
  console.log("ID:", data.data.id, "Status:", data.data.status);
} else {
  console.error("Error:", data.error.message);
}
```

### cURL

```curl
curl -X POST "https://aircube.ai/api/v3/qwen-image-2.1/image-to-image" \
  -H "Authorization: Bearer $AIRCUBE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
  "image": "https://example.com/style-reference.jpg",
  "aspect_ratio": "16:9"
}'
```

### Python (Async)

```python
import os
import time
import requests

# 1. Submit
response = requests.post(
    "https://aircube.ai/api/v3/qwen-image-2.1/image-to-image",
    headers={
        "Authorization": "Bearer " + os.environ["AIRCUBE_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
    "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
    "image": "https://example.com/style-reference.jpg",
    "aspect_ratio": "16:9"
},
    timeout=300,
)
data = response.json()

if not data["success"]:
    print("Error:", data["error"]["message"])
    exit(1)

generation_id = data["data"]["id"]
print(f"Submitted: {generation_id}")

# 2. Poll until completed
while True:
    time.sleep(5)
    r = requests.get(
        f"https://aircube.ai/api/v3/status/{generation_id}",
        headers={"Authorization": "Bearer " + os.environ["AIRCUBE_API_KEY"]},
    )
    result = r.json()["data"]

    if result["status"] == "completed":
        print(result["output_url"])
        break
    elif result["status"] == "failed":
        print("Generation failed")
        break
```

### Node.js (Async)

```javascript
// 1. Submit
const response = await fetch("https://aircube.ai/api/v3/qwen-image-2.1/image-to-image", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.AIRCUBE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
  "image": "https://example.com/style-reference.jpg",
  "aspect_ratio": "16:9"
}),
});
const data = await response.json();

if (!data.success) {
  console.error("Error:", data.error.message);
  process.exit(1);
}

const generationId = data.data.id;
console.log("Submitted:", generationId);

// 2. Poll until completed
while (true) {
  await new Promise((r) => setTimeout(r, 5000));
  const res = await fetch(
    `https://aircube.ai/api/v3/status/${generationId}`,
    { headers: { "Authorization": "Bearer " + process.env.AIRCUBE_API_KEY } },
  );
  const result = (await res.json()).data;

  if (result.status === "completed") {
    console.log(result.output_url);
    break;
  } else if (result.status === "failed") {
    console.error("Generation failed");
    break;
  }
}
```

### cURL (Async)

```curl
# 1. Submit
RESPONSE=$(curl -s -X POST "https://aircube.ai/api/v3/qwen-image-2.1/image-to-image" \
  -H "Authorization: Bearer $AIRCUBE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "Apply the artistic style of the reference image to create a landscape with mountains and a river",
  "image": "https://example.com/style-reference.jpg",
  "aspect_ratio": "16:9"
}')

ID=$(echo "$RESPONSE" | jq -r '.data.id')
echo "Submitted: $ID"

# 2. Poll until completed
while true; do
  sleep 5
  STATUS_RES=$(curl -s "https://aircube.ai/api/v3/status/$ID" \
    -H "Authorization: Bearer $AIRCUBE_API_KEY")
  STATUS=$(echo "$STATUS_RES" | jq -r '.data.status')

  if [ "$STATUS" = "completed" ]; then
    echo "$STATUS_RES" | jq -r '.data.output_url'
    break
  elif [ "$STATUS" = "failed" ]; then
    echo "Generation failed"; break
  fi
done
```

## Pricing

| Resolution | Duration | Cost |
| --- | --- | --- |
| 2k | per image | $0.03 |

### Billing Rules

- Per image: 2k: $0.03.
- Failed generations are not charged.

## Best Use Cases

- Style transfer — apply the style of reference images to new compositions at 2K resolution.
- Multi-reference composition — combine elements from up to 10 images into a cohesive output.
- Product photo editing — enhance or restyle product images while preserving key details.
- Character consistency — maintain character identity across multiple generations using reference images.
- Scene reconstruction — recreate scenes from multiple angle references.
- Design iteration — rapidly explore variations using existing images as references.

## Pro Tips

- Use more reference images for better style and content consistency.
- Be specific in your prompt about how to use the reference images — e.g., 'use the style from image 1 and the pose from image 2'.
- The model handles up to 10 reference images — use them for complex multi-subject scenes.
- All outputs are 2K resolution — ideal for production-quality edits.
- Combine with text-to-image mode first to generate a base, then refine with image-to-image.

## Notes

- Supports 1–10 reference images per generation.
- Fixed 2K output resolution across all aspect ratios.
- Same pricing as text-to-image mode.

## FAQ

**Q: How many reference images can I use?**

Up to 10 reference images per generation. More images generally provide better guidance for the model.

**Q: What is the output resolution?**

All outputs are native 2K resolution, matching the text-to-image mode.

**Q: How much does it cost?**

$0.03 per image, regardless of the number of reference images. Failed generations are not charged.

**Q: Can I mix text-to-image and image-to-image?**

Yes — use text-to-image to generate a base image, then use image-to-image with that image as a reference to iterate.

**Q: What aspect ratios are supported?**

Seven options: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, and 9:16.
