DashScope (Alibaba Cloud Model Studio) image generation models use the Model Studio native protocol, which the platform forwards transparently. Unlike OpenAI-Compatible Image Generation (synchronous), Model Studio image generation uses asynchronous tasks: submission returns a task_id, and the result can be retrieved after polling until the status becomes SUCCEEDED. Available models are determined by the response from List Models (protocols includes dashscope).
Authorizations
Bearer Token authentication; no Alibaba Cloud AK is required.
Authorization: Bearer YOUR_API_KEYSubmit an Image Generation Task
Three submission endpoints (select based on the model, consistent with the official Model Studio API):
POST /api/v1/services/aigc/text2image/image-synthesis # Text-to-imagePOST /api/v1/services/aigc/image2image/image-synthesis # Image-to-imagePOST /api/v1/services/aigc/image-generation/generation # wan2.6 image generation (action is generation; also asynchronous)Request Headers
| Header | Required | Description |
|---|---|---|
Authorization |
Yes | Bearer YOUR_API_KEY |
Content-Type |
Yes | application/json |
X-DashScope-Async |
Yes | Must be set to enable. According to the official Model Studio API semantics, HTTP supports only asynchronous calls. Omitting this header results in the error current user api does not support synchronous calls |
The request body uses the native Model Studio format:
model(required)input:prompt,negative_prompt, reference images, and other model-supported fieldsparameters:size(for example,1024*1024; note that*is used as the separator),n,seed, and other parameters
Query a Task
GET /api/v1/tasks/{task_id}output.task_status: PENDING / RUNNING / SUCCEEDED / FAILED / CANCELED. After the task succeeds, images are available at output.results[].url. The URL validity period is determined by Model Studio (typically 24 hours), so save the files elsewhere promptly. The query and cancellation endpoints require only the Authorization header.
Notes
- Task queries must use the same API Key used for submission; the task Id can be queried for 7 days, after which
404 task_not_foundis returned. - Poll every 2–5 seconds until a terminal state is reached.
- Cancel:
POST /api/v1/tasks/{task_id}/cancel(onlyPENDINGtasks can be canceled). - Refer to the official Alibaba Bailian documentation for the
input/parametersfields of each model; the platform does not rewrite these fields.
