跳转到主要内容
万相V2

Wan v2 — 创建任务

Wan 异步图像生成

POST
/services/aigc/image-generation/generation
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
  "model": "wan2.6-t2i",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "text": "A flower shop with exquisite windows, a beautiful wooden door, and flowers on display"
          }
        ]
      }
    ]
  },
  "parameters": {
    "prompt_extend": true,
    "watermark": false,
    "n": 1,
    "negative_prompt": "",
    "size": "1280*1280"
  }
}'
{
  "request_id": "<string>",
  "output": {
    "task_id": "<string>",
    "task_status": "PENDING"
  }
}
请先获取 API Key设置为环境变量。如需使用 SDK,请先安装 SDK

支持的模型

Wan 文生图系列各版本使用不同的端点和请求格式:
模型端点输入格式分辨率最大提示词长度
wan2.6-t2i/services/aigc/image-generation/generationmessages 数组1280*1280 到 1440*1440,比例 1:4 到 4:12,100 字符
wan2.5-t2i-preview/services/aigc/text2image/image-synthesisprompt 字符串1280*1280 到 1440*1440,比例 1:4 到 4:12,000 字符
wan2.2-t2i-plus/services/aigc/text2image/image-synthesisprompt 字符串每边 512–1440,最大 1440*1440500 字符
wan2.2-t2i-flash/services/aigc/text2image/image-synthesisprompt 字符串每边 512–1440,最大 1440*1440500 字符
wan2.1-t2i-plus/services/aigc/text2image/image-synthesisprompt 字符串每边 512–1440,最大 1440*1440500 字符
wan2.1-t2i-turbo/services/aigc/text2image/image-synthesisprompt 字符串每边 512–1440,最大 1440*1440500 字符
wanx2.0-t2i-turbo/services/aigc/text2image/image-synthesisprompt 字符串每边 512–1440,最大 1440*1440800 字符
wan2.6-t2i 还支持同步端点(单次请求,即时响应)。

SDK 版本要求

  • wan2.6-t2i:DashScope Python SDK 1.25.7+,Java SDK 2.22.6+
  • wan2.5 及更早版本:DashScope Python SDK 1.25.2+,Java SDK 2.22.2+

鉴权

string
header
必填

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

Header 参数

enum<string>
必填

必须设置为 enable 以创建异步任务。

enable

请求体

application/json
object
enum<string>
必填

模型名称。wan2.6-t2i 模型请填写 wan2.6-t2i

wan2.6-t2i
wan2.6-t2i
object
必填

包含消息数组的输入对象。

object

wan2.6-t2i 模型的参数。

响应

200-application/json
string

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

object