| 模型 ID | 说明 |
|---|---|
wan2.7-image-pro | 专业版。非组图文生图支持最高 4K 输出。 |
wan2.7-image | 标准版,生成速度更快,最高支持 2K。 |
核心能力
- 文生图 — 根据文本提示生成一张或多张图片
- 图像编辑 — 通过文字指令编辑最多 9 张输入图片
- 交互式编辑 — 使用
bbox_list指定需要编辑的区域 - 组图生成 — 根据文本或参考图片生成一组相关图片
- 多图参考 — 在同一个
content数组中传入多个{ "image": "..." }
parameters.prompt_extend 默认为 true。对于特定内容请求,请选择 Direct 资源下的 wan2.7-image-nsfw 或 wan2.7-image-pro-nsfw 模型,并将该参数设为 false。接口同时兼容原有的 OpenAI 兼容扁平格式,以及 AnyFast 本次新增适配的 DashScope 兼容嵌套格式。简单文生图或单图编辑可以继续使用扁平格式;多图输入、区域编辑和组图生成使用嵌套格式。
请求结构
请求地址为POST /v1/images/generations。下面同时给出两种已验证可用的请求格式。
curl https://www.anyfast.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image",
"prompt": "电影感花店,精致的窗户和漂亮的木质门,门口摆放着鲜花",
"size": "2K",
"n": 1,
"watermark": false,
"thinking_mode": true
}'
curl https://www.anyfast.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"prompt": "将花瓶替换成一束红玫瑰",
"image": "https://example.com/room.png",
"size": "2K",
"n": 1
}'
curl https://www.anyfast.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H 'X-DashScope-DataInspection: {"input":"disable","output":"disable"}' \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{"image": "https://example.com/person.png"},
{"image": "https://example.com/background.png"},
{"text": "将图 1 中的人物放入图 2 的场景中"}
]
}
]
},
"parameters": {
"size": "2K",
"n": 1,
"watermark": false,
"thinking_mode": true,
"prompt_extend": true
}
}'
curl https://www.anyfast.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{"image": "https://example.com/room.png"},
{"text": "将选中区域的花瓶替换成一束红玫瑰"}
]
}
]
},
"parameters": {
"size": "2K",
"n": 1,
"bbox_list": [
[[420, 280, 760, 720]]
],
"prompt_extend": true
}
}'
curl https://www.anyfast.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{"text": "生成四张电影感组图,记录同一只橘猫经历春、夏、秋、冬,角色特征保持一致"}
]
}
]
},
"parameters": {
"size": "2K",
"enable_sequential": true,
"n": 4,
"watermark": false,
"prompt_extend": true
}
}'
输入限制
OpenAI 兼容扁平格式
| 字段 | 类型 | 说明 |
|---|---|---|
model | string | wan2.7-image 或 wan2.7-image-pro |
prompt | string | 支持中英文,最多 5,000 个字符 |
image | string | 单图编辑使用的公网图片 URL 或 Base64 Data URI |
size | string | 1K、2K,Pro 非组图文生图还支持 4K |
n | integer | 生成图片数量 |
thinking_mode | boolean | 文生图思考模式 |
watermark | boolean | 是否添加固定的“AI生成”水印 |
seed | integer | 范围 0–2,147,483,647 的随机数种子 |
嵌套 DashScope 兼容格式
| 字段 | 要求 |
|---|---|
input.messages | 仅传一条消息,role 固定为 user |
content[].text | 支持中英文,最多 5,000 个字符 |
content[].image | 公网 HTTP/HTTPS URL 或 Base64 Data URI |
| 图片格式 | JPEG、JPG、无透明通道的 PNG、BMP、WEBP |
| 图片大小 | 单张不超过 20 MB,宽高均为 240–8,000 px |
| 图片宽高比 | 1:8 至 8:1 |
| 图片数量 | 0–9 张,数组顺序即图片顺序 |
参数说明
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
parameters.size | string | 2K | wan2.7-image-pro 的非组图文生图支持 1K、2K、4K,其他模式最高 2K;wan2.7-image 支持 1K、2K。 |
parameters.n | integer | 1 或 12 | 非组图模式范围 1–4,默认 1;组图模式表示最大张数,范围 1–12,默认 12。按成功生成的图片张数计费。 |
parameters.enable_sequential | boolean | false | 开启文生组图或图生组图。 |
parameters.thinking_mode | boolean | true | 提升文生图质量,仅在无图片输入且关闭组图模式时生效。 |
parameters.prompt_extend | boolean | true | 控制 AnyFast 提示词扩展。对于特定内容请求,请选择 Direct 资源下的 wan2.7-image-nsfw 或 wan2.7-image-pro-nsfw 模型,并将该参数设为 false。 |
parameters.bbox_list | array | — | 交互式编辑区域。每张输入图对应一个列表,每张图最多两个 [x1, y1, x2, y2] 边界框。 |
parameters.color_palette | array | — | 3–10 个 HEX 色值及百分比,占比之和必须为 100.00%;仅关闭组图模式时可用。 |
parameters.watermark | boolean | false | 在右下角添加固定的“AI生成”水印。 |
parameters.seed | integer | 随机 | 范围 0–2,147,483,647。相同种子可获得相近结果,但不保证完全一致。 |
响应体
AnyFast 在data 中返回生成结果,并在 metadata 中保留 Wan 上游响应详情。
{
"data": [
{
"url": "https://dashscope-result.example.com/generated.png",
"b64_json": "",
"revised_prompt": ""
}
],
"created": 1784274013,
"metadata": {
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"content": [
{
"image": "https://dashscope-result.example.com/generated.png",
"type": "image"
}
],
"role": "assistant"
}
}
],
"finished": true
},
"usage": {
"image_count": 1,
"input_tokens": 25,
"output_tokens": 2,
"size": "2048*2048",
"total_tokens": 27
},
"request_id": "f30f2d2b-e0ee-9a47-ba5e-68b66360fe47"
}
}
API 参考
打开 Wan2.7 Image / Pro API 参考。