Image GenerationQwen Image
Qwen Image 2
Qwen's v2 unified image generation and editing model.
POST /v2/images/generate — model: "qwen-image-2"
Qwen Image 2 is a unified model that handles both text-to-image generation and image editing. Omit the image parameter for text-to-image, or provide it for editing.
See Image Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Description |
|---|---|---|
qwenImage2Params.image | string | Input image URL (optional — omit for text-to-image, provide for editing) |
qwenImage2Params.aspect_ratio | string | Aspect ratio. Values: "1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9", "2:1", "1:2" |
qwenImage2Params.negative_prompt | string | Negative text prompt |
qwenImage2Params.seed | integer | Seed for reproducibility |
Credit cost
3 credits per generation.
Code examples
curl -X POST https://api.apiframe.ai/v2/images/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain lake at dawn with mist rising",
"model": "qwen-image-2",
"qwenImage2Params": {
"aspect_ratio": "16:9"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/images/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "A serene mountain lake at dawn with mist rising",
"model": "qwen-image-2",
"qwenImage2Params": {
"aspect_ratio": "16:9",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "A serene mountain lake at dawn with mist rising",
model: "qwen-image-2",
qwenImage2Params: { aspect_ratio: "16:9" },
}),
});
console.log(await response.json());Try it
POST
/v2/images/generateTry it