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

> Qwen Image 2.1 is a 7B-parameter image generation model with native 2K resolution (2048x2048). It supports both text-to-image and image-to-image with up to 10 reference images, featuring 40-step inference for high-quality output and 7 aspect ratio options.

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

## Key Features

- Native 2K resolution — generates images at 2048×2048 and other 2K-class sizes without upscaling.
- 7B-parameter model — a powerful image generation backbone with strong prompt understanding.
- 40-step inference — high-quality output with detailed textures and accurate compositions.
- 7 aspect ratio options — 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16 with 32-pixel-aligned dimensions.
- RGBA output — native transparency support for compositing workflows.
- Bilingual prompt support — understands prompts in English and Chinese.

## Parameters

| Parameter | Required | Description |
| --- | --- | --- |
| `prompt` | Yes | Natural-language description of the image to generate. |
| `aspect_ratio` | No | Aspect ratio: 1:1 (default), 4:3, 3:4, 3:2, 2:3, 16:9, 9:16. |

## How to Use

1. Provide a detailed prompt describing the desired image — subject, style, lighting, composition.
2. Select an aspect ratio from the 7 available options to match your output needs.
3. All outputs are generated at native 2K resolution — no additional resolution setting needed.
4. Use detailed prompts for best results; the model excels with specific scene descriptions.

## Code Examples

### Python

```python
import os
import requests

response = requests.post(
    "https://aircube.ai/api/v3/qwen-image-2.1/text-to-image",
    headers={
        "Authorization": "Bearer " + os.environ["AIRCUBE_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
    "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
    "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/text-to-image", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.AIRCUBE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
  "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/text-to-image" \
  -H "Authorization: Bearer $AIRCUBE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
  "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/text-to-image",
    headers={
        "Authorization": "Bearer " + os.environ["AIRCUBE_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
    "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
    "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/text-to-image", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.AIRCUBE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
  "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/text-to-image" \
  -H "Authorization: Bearer $AIRCUBE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A cinematic shot of a mountain lake at golden hour, with snow-capped peaks reflected in crystal-clear water",
  "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

- High-resolution content creation — generate 2K images directly without upscaling artifacts.
- Marketing and advertising — hero images, banners, and social media visuals at production resolution.
- Product visualization — detailed product renders and concept images.
- Illustration and concept art — leverage the 7B model's strong compositional understanding.
- Print-ready assets — 2K output is suitable for many print applications.
- Transparent backgrounds — use RGBA output for compositing into existing designs.

## Pro Tips

- Include detailed style and lighting descriptions for best results.
- The model outputs at 2K natively — no need to specify resolution.
- Take advantage of bilingual support — prompts in Chinese produce equally high-quality output.
- For wide compositions, use 16:9 ratio (2752×1536); for tall compositions, use 9:16 (1536×2752).
- Combine with image-to-image mode to iterate on generated concepts using reference images.

## Notes

- Fixed 2K output resolution — all aspect ratios produce 2K-class pixel dimensions.
- 7 aspect ratio options available; all dimensions are aligned to 32-pixel boundaries.
- 40-step inference pipeline for high-quality output.

## FAQ

**Q: What is the Qwen Image 2.1 API?**

An image generation API powered by the Qwen-Image-2.1 7B model. It generates native 2K resolution images from text prompts with 40-step inference for high-quality output.

**Q: What resolution are the outputs?**

All outputs are native 2K resolution. For example, 1:1 produces 2048×2048, 16:9 produces 2752×1536. No upscaling is needed.

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

$0.03 per image. Failed generations are not charged.

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

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

**Q: Can I use generated images commercially?**

Yes — all outputs are yours to use commercially.
