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

TypeCostDescription
Text to Image5 CreditsGenerate images from text prompts using Qwen-Image-2512 AI.
2

Create Task

POSThttps://qwen-image-2512.org/api/generate
Async 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

ParameterTypeRequiredDescription
promptstringRequiredThe text description for image generation. Maximum 2000 characters.
sizestringOptionalImage size. Supported: 1024*1024, 1024*1536, 1536*1024, 768*1024, 1024*768. Default: 1024*1024
seednumberOptionalRandom seed for reproducible results. Use -1 for random. Default: -1
output_formatstringOptionalOutput format: jpeg, png, or webp. Default: jpeg
callback_urlstringOptionalWebhook 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

GEThttps://qwen-image-2512.org/api/status

Poll this endpoint to check the progress of your task. We recommend polling every 5-10 seconds.

Query Parameters

ParameterTypeDescription
task_idstringThe task ID received from the generate endpoint. Required

Status Values

PENDINGTask is queued
IN_PROGRESSProcessing
SUCCESSCompleted
FAILEDError occurred
cURL
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

CodeDescription
200Success
400Bad Request - Invalid parameters (missing prompt, invalid size, etc.)
401Unauthorized - Missing or invalid API key
404Not Found - Task ID does not exist
500Internal Server Error - Please retry or contact support

Need Help?

Check out our support channel or email us.

Contact Support