图片

Wan 2.7 Image

阿里巴巴的 Wan 2.7 Image 和 Wan 2.7 Image Pro:可生成新图、编辑图片,或基于最多 9 张参考图作图,支持 1K 或 2K、十种画幅,Pro 还支持仅凭提示词生成 4K。擅长海报、产品图和图中文字。

价格

模型尺寸按图片计费
Wan 2.7 Image1K, 2K$0.026
Wan 2.7 Image Pro1K, 2K, 4K$0.065

各种尺寸和画幅价格一致。参考图和输入图不额外收费。

生成图片

import os
from openai import OpenAI
client = OpenAI(base_url="https://api.zurelay.com/v1", api_key=os.environ["ZURELAY_API_KEY"])
result = client.images.generate(
model="wan-2.7-image",
prompt="A poster for a summer jazz night on a rooftop: a saxophonist against a pink sunset, the words 'ROOFTOP JAZZ' in bold letters at the top and 'Saturday 8 pm' below",
size="2K",
extra_body={
"aspect_ratio": "3:4"
},
)
print(result.data[0].url)

参数

sizestring
1K(默认)或 2K,新图在 Wan 2.7 Image Pro 上还可使用 4K,或 1536x1024 这样的像素值,会按最接近的分辨率和画幅处理。
aspect_ratiostring
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 或 21:9。不传时,新图为正方形;编辑则沿用你发送的最后一张图的画幅。
imagesarray
最多 9 张用于编辑或参考的图片,可以是链接或 data URL(或 /v1/images/edits 上的文件),并按提示词中提到的顺序排列:“图 1”“图 2”。
ninteger
1 到 4 张图片。

1K 下图像约 100 万像素(1024 × 1024 正方形,16:9 为 1376 × 768),2K 约 400 万像素(2048 × 2048,16:9 为 2736 × 1520),4K 约 1600 万像素(4096 × 4096)。尺寸小于要求或画幅不符的图像会重新生成,不会交付。

图像编辑与参考图

随提示词一起发送图片,并说明要改什么、保留什么。有多张图时,按顺序指代(“把图 1 中的狐狸放到图 2 的汽车上”)。 编辑和参考图最高支持 2K,Pro 也一样。

import os
import requests
response = requests.post(
"https://api.zurelay.com/v1/images/generations",
headers={"Authorization": f"Bearer {os.environ['ZURELAY_API_KEY']}"},
json={
"model": "wan-2.7-image",
"prompt": "Make it a snowy night with warm light in the windows. Keep the house exactly the same.",
"images": [
"https://example.com/house.png"
],
"size": "2K"
},
)
response.raise_for_status()
print(response.json())

提示词编写

  • 用完整的句子描述主体、场景、光线和风格。
  • 把必须出现的文字放在引号中,并说明位置。
  • 编辑时,说明哪些要改、哪些不变:“把夹克改成红色,其余保持不变。”

使用须知

  • 1K 和 2K 的图像需要 20 到 60 秒;Pro 的 4K 约需 2 分钟。
  • 图像不带可见水印。
  • 模型拒绝的提示词会返回 image_not_generated,不收费。
  • 链接有效期为 24 小时;控制台的素材库会将以链接形式返回的图片保留 30 天。

更多图片传入方式: 图片编辑与参考图。

有疑问,或发现内容缺失?联系我们的支持团队,我们会通过邮件回复,通常只需一分钟。