ApiframeApiframe Docs
Image GenerationQwen Image

Qwen Image 2

Qwen's v2 unified image generation and editing model.

Use in Apiframe Studio

POST /v2/images/generatemodel: "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

ParameterTypeDescription
qwenImage2Params.imagestringInput image URL (optional — omit for text-to-image, provide for editing)
qwenImage2Params.aspect_ratiostringAspect ratio. Values: "1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9", "2:1", "1:2"
qwenImage2Params.negative_promptstringNegative text prompt
qwenImage2Params.seedintegerSeed 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

On this page