跳转到主要内容
千问

Qwen — 同步图像生成

同步图像生成

POST
/services/aigc/multimodal-generation/generation
cURL
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
  "model": "qwen-image-2.0-pro",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "text": "Healing-style hand-drawn poster featuring three puppies playing with a ball on lush green grass. The main title Come Play Ball! is prominently displayed at the top in bold, blue cartoon font."
          }
        ]
      }
    ]
  },
  "parameters": {
    "negative_prompt": "",
    "prompt_extend": true,
    "watermark": false,
    "size": "2048*2048"
  }
}'
{
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": [
            {
              "image": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.png?Expires=xxx"
            }
          ],
          "role": "assistant"
        }
      }
    ]
  },
  "usage": {
    "height": 928,
    "image_count": 1,
    "width": 1664
  },
  "request_id": "d0250a3d-b07f-49e1-bdc8-6793f4929xxx"
}
获取 API Key配置环境变量。如果使用 SDK,还需安装 SDK

鉴权

string
header
必填

千问云 API Key。详见获取 API Key

请求体

application/json
enum<string>
必填

模型名称。

qwen-image-2.0-pro,qwen-image-2.0-pro-2026-04-22,qwen-image-2.0-pro-2026-03-03,qwen-image-2.0,qwen-image-2.0-2026-03-03,qwen-image-max,qwen-image-max-2025-12-30,qwen-image-plus,qwen-image
qwen-image-2.0-pro
object
必填

包含消息数组的输入数据。

object

图像生成参数。

响应

200-application/json
object
object

用量统计(仅统计成功结果)。

string
默认值"d0250a3d-b07f-49e1-bdc8-6793f4929xxx"

唯一请求标识符,用于追踪和排查问题。

abf1645b-b630-433a-92f6-xxxxxx