Skip to main content
Qwen

Qwen — Generate an image

Async image generation

POST
/services/aigc/text2image/image-synthesis
curl -X POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis \
  -H 'X-DashScope-Async: enable' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "qwen-image-plus",
  "input": {
    "prompt": "Healing-style hand-drawn poster featuring three puppies playing with a ball on lush green grass."
  },
  "parameters": {
    "negative_prompt": "",
    "size": "1664*928",
    "n": 1,
    "prompt_extend": true,
    "watermark": false
  }
}'
{
  "output": {
    "task_status": "PENDING",
    "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
  },
  "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}
Get an API key and set it as an environment variable. If using the SDK, install it. This async endpoint is supported only by qwen-image-plus and qwen-image. All other models use the synchronous API.

Workflow

  1. Submit a task via POST /services/aigc/text2image/image-synthesis with the X-DashScope-Async: enable header.
  2. Poll for results via GET /tasks/{task_id} until task_status reaches SUCCEEDED or FAILED. Poll every 10 seconds.

Authorizations

string
header
required

DashScope API Key. Create one in the Qwen Cloud console.

Header Parameters

enum<string>
required

Must be set to enable for asynchronous task submission.

enable

Body

application/json
enum<string>
required

Model name. Only qwen-image-plus and qwen-image are supported for asynchronous calls.

qwen-image-plus,qwen-image
qwen-image-plus
object
required

Input data.

object

Generation parameters for Qwen-Image async calls.

Response

200-application/json
string
default"4909100c-7b5a-9f92-bfe5-xxxxxx"

Unique request identifier.

object