Overview
Qwen 2 Image is an asynchronous text-to-image API. It supports standard and pro generation modes, multiple aspect ratios, prompt extension, optional negative prompts, and up to 6 images per task.| Capability | Value |
|---|---|
| Model ID | qwen-2-image |
| Modes | text-to-image, text-to-image-pro |
| Default mode | text-to-image |
| Prompt length | 1-800 characters |
| Negative prompt | Optional, up to 500 characters |
| Images per task | num_images defaults to 1; range 1-6 |
| Aspect ratios | 1:1, 3:4, 4:3, 9:16, 16:9 |
| Prompt extension | prompt_extend, default true |
| Watermark | watermark, default false |
Endpoint and authentication
Base URL:| Method | Endpoint | Purpose |
|---|---|---|
POST | /generateTask/qwen-2-image | Submit a text-to-image task |
GET | /statusTask/qwen-2-image?taskId={taskId} | Poll task status and retrieve results |
Copy-paste async quickstart
taskId; you need it to poll for the final result.
Poll for result
resultJson after state becomes success:
Request body
Standard text-to-image
Pro text-to-image
Parameters
Result delivery mode. Use
async for polling with statusTask, or callback for webhook delivery.Required when
request_type is callback. Must be a callback URL that can receive the final task payload. See Webhooks.Qwen 2 Image input parameters.
Response format
Submit task response
POST /generateTask/qwen-2-image returns a task ID when the task is accepted:
API status code.
200 means the task was accepted.Human-readable status message.
Unique task identifier used with the status endpoint.
Status response fields
Unique task identifier.
Current task state:
pending, processing, success, or failed.JSON string containing generated image URLs in
resultUrls. Present when state is success.Machine-readable failure code. Present when
state is failed.Human-readable failure message. Present when
state is failed.Task creation timestamp in Unix milliseconds.
Task completion timestamp in Unix milliseconds. Present after completion.
Processing duration in milliseconds when available.
Webhook callback mode
Use callback mode when your backend should receive the final result automatically instead of polling.Billing
Qwen 2 Image is billed per generated image.| Mode | APIXO price |
|---|---|
text-to-image | $0.03 / image |
text-to-image-pro | $0.07 / image |
Latency and polling
Qwen 2 Image tasks are asynchronous. Actual latency varies by prompt complexity, requested image count, and queue load.| Use case | Recommended first poll | Poll interval |
|---|---|---|
| Standard generation | 10s after task creation | 5s-10s |
| Pro mode or multiple images | 10s-15s after task creation | 5s-10s |
429, slow down requests and retry with backoff. For account-level details, see System APIs.
Errors and troubleshooting
HTTP errors
| Code | Meaning | What to do |
|---|---|---|
400 | Invalid request body, parameter type, or value | Fix the request before retrying |
401 | Missing or invalid API key | Check the Authorization header |
402 | Insufficient balance or quota | Add balance or switch account/key |
403 | Key or route cannot access the model | Check permissions and route strategy |
404 | Task not found | Verify the taskId and model ID |
429 | Rate limit or concurrency limit reached | Retry with exponential backoff |
500 | Server or unmapped model error | Retry with backoff |
502 | Model service error | Retry with backoff |
504 | Model service timeout | Retry or use callback mode for long-running jobs |
Request validation
| Condition | Backend behavior |
|---|---|
Invalid mode | Returns Invalid mode type. Supported: text-to-image, text-to-image-pro |
Missing or empty prompt | Returns a missing-parameter or validation error |
Prompt exceeds 800 characters | Returns a length error |
Invalid num_images | Returns The parameter {{num_images}} must be between 1 and 6. |
Invalid aspect_ratio | Returns the supported aspect-ratio list |
Invalid prompt_extend or watermark | Returns a boolean type error |
Invalid seed | Returns the supported seed range |