跳转到主要内容
万相2.7

Wan 2.7 — 同步调用

Wan 2.7 同步图像生成与编辑

POST
/services/aigc/multimodal-generation/generation
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": "wan2.7-image-pro",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "text": "A serene mountain lake at sunrise, with mist rising from the water, surrounded by pine trees, photorealistic"
          }
        ]
      }
    ]
  },
  "parameters": {
    "n": 1,
    "size": "2K",
    "watermark": false,
    "thinking_mode": true
  }
}'
{
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": [
            {
              "image": "https://dashscope-result.oss-cn-shanghai.aliyuncs.com/xxx.png?Expires=xxx",
              "type": "image"
            }
          ],
          "role": "assistant"
        }
      }
    ],
    "finished": true
  },
  "usage": {
    "image_count": 1,
    "input_tokens": 18790,
    "output_tokens": 2,
    "size": "2985*1405",
    "total_tokens": 18792
  },
  "request_id": "a3f4befe-cacd-49c9-8298-xxxxxx"
}
获取 API Key设置为环境变量。如需使用 SDK,请先安装 SDK
该同步接口支持 wan2.7-image-prowan2.7-image 模型。通过单次请求即可直接获取生成的图像,无需轮询。 如需异步处理,请使用异步提交接口。

鉴权

string
header
必填

千问 AI 平台 API Key。详见获取 API Key

请求体

application/json
enum<string>
必填

模型名称。可选值:wan2.7-image-pro、wan2.7-image。

wan2.7-image-pro,wan2.7-image
wan2.7-image-pro
object
必填

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

object

图像处理参数。

响应

200-application/json
object
object

用量统计。

string
默认值"a3f4befe-cacd-49c9-8298-xxxxxx"

唯一请求标识符。

a3f4befe-cacd-49c9-8298-xxxxxx
Wan 2.7 — 同步调用 - 千问 AI 平台