Qwen Image 2.0 API
Complete API reference for Qwen Image 2.0 models powered by Alibaba Qwen.
Model Variants
This API supports four model variants:
Quick Comparison
Supported Aspect Ratios
Both Standard and Pro models support 7 aspect ratios:
16:9(default),9:16,1:1,4:3,3:4,3:2,2:3
Qwen Image 2 (Text-to-Image)
Endpoint
POST /api/v1/image/task
Authentication
Authorization: Bearer YOUR_API_KEY
Request Parameters
Required
Note: The width:height ratio must be one of: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3
Optional
Example Request
javascript
Qwen Image 2 Edit (Image Editing)
Endpoint
POST /api/v1/image/task
Request Parameters
Required
Note: The width:height ratio must be one of: 16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3
Optional
Single Image Edit Example
javascript
Multi-Image Composition Example
Up to 6 images can be combined in a single request:
javascript
Qwen Image 2 Pro (Text-to-Image)
Uses the same parameters as Qwen Image 2, with model_name set to qwen-image-2.0-pro for enhanced output quality.
Example Request
javascript
Qwen Image 2 Pro Edit (Image Editing)
Uses the same parameters as Qwen Image 2 Edit, with model_name set to qwen-image-2.0-pro-edit for enhanced output quality.
Example Request
javascript
Response Format
Initial Response
All models return a task_id for polling:
json
Polling Response
Poll GET /api/v1/image/{taskId} to check status:
json
Status Values
submitted: Task acceptedprocessing: Generation in progresssucceed: Generation completed successfullyfailed: Generation failed
Error Handling
Common Errors
Invalid Aspect Ratio
json
Missing Image URL (Edit Mode)
json
Too Many Images (Edit Mode)
json
Unauthorized
json
Best Practices
Text-to-Image Tips
- Be Specific: Include subject, style, lighting, and composition details in your prompt
- Aspect Ratio Selection: Choose ratio based on your use case (16:9 for web banners, 9:16 for mobile, 1:1 for social media)
- Use Seed for Reproducibility: Set a fixed
seedvalue when you need consistent results across requests - Standard vs Pro: Use Standard for rapid iteration when output quality is the priority
Image Editing Tips
- Clear Instructions: Be specific about what to change in the prompt
- Multi-Image Composition: Provide up to 6 images and describe how they should be combined
- Prompt Guidance: Describe the desired outcome rather than just listing changes
- Image Quality: Higher quality input images generally produce better editing results