Developer Resources
Qwen-Image-2512 API Documentation
Integrate Alibaba's Qwen-Image-2512 AI model into your applications. Generate high-quality images from text prompts with a simple REST API.
1
Authentication
The Qwen-Image-2512 API uses Bearer Token authentication. Pass your API Key in the request header.
Authentication
Authorization: Bearer sk-your-api-key-here
Keep your API key secure. Do not share it in client-side code.
Pricing
| Type | Cost | Description |
|---|---|---|
| Text to Image | 5 Credits | Generate images from text prompts using Qwen-Image-2512 AI. |
2
Create Task
POST
https://qwen-image-2512.org/api/generateAsync Generation
Pricing
Each image generation costs 5 credits.
Initiate a generation task. The API returns a task_id immediately, which you use to poll for results.
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Required | The text description for image generation. Maximum 2000 characters. |
| size | string | Optional | Image size. Supported: 1024*1024, 1024*1536, 1536*1024, 768*1024, 1024*768. Default: 1024*1024 |
| seed | number | Optional | Random seed for reproducible results. Use -1 for random. Default: -1 |
| output_format | string | Optional | Output format: jpeg, png, or webp. Default: jpeg |
| callback_url | string | Optional | Webhook URL for task completion notification. |
Request Examples
Text to Image Example (cURL)
curl -X POST https://qwen-image-2512.org/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain landscape at sunset",
"size": "1024*1024",
"output_format": "png"
}'Success Response
{
"code": 200,
"message": "success",
"data": {
"task_id": "n43abc123def456qwenimg",
"status": "IN_PROGRESS"
}
}Error Response
{
"code": 400,
"message": "Bad Request: 'prompt' is required.",
"data": null
}3
Check Status
GET
https://qwen-image-2512.org/api/statusPoll this endpoint to check the progress of your task. We recommend polling every 5-10 seconds.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| task_id | string | The task ID received from the generate endpoint. Required |
Status Values
PENDINGTask is queuedIN_PROGRESSProcessingSUCCESSCompletedFAILEDError occurredcURL
curl -X GET "https://qwen-image-2512.org/api/status?task_id=n43abc123def456qwenimg" \
-H "Authorization: Bearer YOUR_API_KEY"Response (In Progress)
{
"code": 200,
"message": "success",
"data": {
"task_id": "n43abc123def456qwenimg",
"status": "IN_PROGRESS",
"consumed_credits": 5,
"error_message": null,
"created_at": "2024-12-19T10:00:00Z",
"request": { ... },
"response": null
}
}Response (Completed)
{
"code": 200,
"message": "success",
"data": {
"task_id": "n43abc123def456qwenimg",
"status": "SUCCESS",
"consumed_credits": 5,
"error_message": null,
"created_at": "2024-12-19T10:00:00Z",
"request": { ... },
"response": ["https://cdn.example.com/image.png"]
}
}Response (Failed)
{
"code": 200,
"message": "success",
"data": {
"task_id": "n43abc123def456qwenimg",
"status": "FAILED",
"consumed_credits": 0,
"error_message": "Content policy violation detected",
"created_at": "2024-12-19T10:00:00Z",
"request": { ... },
"response": null
}
}Error Codes
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters (missing prompt, invalid size, etc.) |
| 401 | Unauthorized - Missing or invalid API key |
| 404 | Not Found - Task ID does not exist |
| 500 | Internal Server Error - Please retry or contact support |