万相旧版文生图
阿里巴巴万相(Wanxiang)旧版文生图模型,支持 wan2.6-t2i、wan2.2 和 wanx2.1 系列,提供多种尺寸、批量生成和负向提示词等功能。
在线体验
快速开始
python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="wan2.6-t2i",
prompt="一只橘猫在樱花树下打盹",
size="1280x1280",
n=2
)
print(response.data[0].url)请求端点
| 项目 | 值 |
|---|---|
| 方法 | POST |
| 路径 | /v1/images/generations |
| Base URL | https://open.dieyuyun.com |
| 兼容协议 | OpenAI Images API |
认证
Bearer Token: Authorization: Bearer YOUR_API_KEY
支持的模型
| 模型 | 分类 | 特点 | 最高分辨率 | 同步返回 |
|---|---|---|---|---|
wan2.6-t2i | 2.6 新版 | 最新协议,支持同步+异步,支持 prompt_extend | 1440² | 是 |
wan2.2-t2i-plus | 2.2 高质量 | 高质量旧版,宽高各 [512, 1440] | 1440² | 否 (异步) |
wan2.2-t2i-flash | 2.2 快速 | 快速旧版,速度快成本低 | 1440² | 否 (异步) |
wanx2.1-t2i-turbo | 2.1 快速 | 2.1 快速版 | 1440² | 否 (异步) |
wanx2.1-t2i-plus | 2.1 高质量 | 2.1 高质量版 | 1440² | 否 (异步) |
模型对比
| 对比项 | wan2.6-t2i | wan2.2-t2i-plus | wan2.2-t2i-flash | wanx2.1-t2i-turbo | wanx2.1-t2i-plus |
|---|---|---|---|---|---|
| 同步返回 | 是 | 否 | 否 | 否 | 否 |
| prompt_extend | 是 | 否 | 否 | 否 | 否 |
| watermark | 是 | 否 | 否 | 否 | 否 |
| negative_prompt | 是 | 是 | 是 | 是 | 是 |
| 批量生成 (n) | 1~4 | 1~4 | 1~4 | 1~4 | 1~4 |
| 最高分辨率 | 1440² | 1440² | 1440² | 1440² | 1440² |
标准请求字段
所有模型通用
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| model | string | 是 | — | 模型标识,见 支持的模型 |
| prompt | string | 是 | — | 图像描述文本 |
| size | string | 否 | 见模型尺寸表 | 图像尺寸,不同模型支持的尺寸不同 |
| n | integer | 否 | 4 | 生成数量,范围 1~4 |
| response_format | string | 否 | url | 返回格式: url 或 b64_json |
| negative_prompt | string | 否 | — | 反向提示词,描述不希望出现的内容 |
| seed | integer | 否 | — | 随机种子,用于复现生成结果 |
| async | boolean | 否 | false | 启用异步模式,返回 taskId 用于查询结果,详见 异步任务 |
支持的尺寸
wan2.6-t2i
总像素范围: [1280², 1440²]
| 尺寸 | 比例 | 说明 |
|---|---|---|
1280x1280 | 1:1 | 方形 |
1696x960 | 16:9 | 横版宽屏 |
960x1696 | 9:16 | 竖版全屏 |
1472x1104 | 4:3 | 横版 |
1104x1472 | 3:4 | 竖版 |
wan2.2 / wanx2.1 系列
每边范围: [512, 1440]
| 尺寸 | 比例 | 说明 |
|---|---|---|
1024x1024 | 1:1 | 方形 |
1440x1440 | 1:1 | 方形高清 |
1280x720 | 16:9 | 横版宽屏 |
720x1280 | 9:16 | 竖版全屏 |
1024x1440 | ~3:4 | 竖版 |
1440x1024 | ~4:3 | 横版 |
768x1152 | 2:3 | 竖版 |
1152x768 | 3:2 | 横版 |
960x1280 | 3:4 | 竖版 |
1280x960 | 4:3 | 横版 |
512x1024 | 1:2 | 竖版窄屏 |
1024x512 | 2:1 | 横版宽幅 |
扩展参数
wan2.6-t2i 专属参数
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| prompt_extend | boolean | 否 | true | 是否自动扩展提示词以获得更好效果 |
| watermark | boolean | 否 | false | 是否添加水印,设为 true 可开启 |
注意
wan2.2 和 wanx2.1 系列旧版模型在兼容模式下不支持 prompt_extend 和 watermark 参数。
所有模型通用扩展参数
| 字段 | 类型 | 说明 |
|---|---|---|
| negative_prompt | string | 反向提示词,描述不希望出现的内容 |
| seed | integer | 随机种子,用于复现生成结果 |
请求示例
bash
curl https://open.dieyuyun.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-t2i",
"prompt": "一只橘猫在樱花树下打盹",
"size": "1280x1280",
"n": 2
}'python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="wan2.6-t2i",
prompt="一只橘猫在樱花树下打盹",
size="1280x1280",
n=2
)
print(response.data[0].url)javascript
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://open.dieyuyun.com/v1',
apiKey: 'YOUR_API_KEY',
})
const response = await client.images.generate({
model: 'wan2.6-t2i',
prompt: '一只橘猫在樱花树下打盹',
size: '1280x1280',
n: 2,
})
console.log(response.data[0].url)使用负向提示词
bash
curl https://open.dieyuyun.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-t2i",
"prompt": "一只橘猫在樱花树下打盹,水彩画风格",
"size": "1280x1280",
"negative_prompt": "模糊, 低质量, 变形",
"n": 2
}'关闭提示词扩展 (wan2.6-t2i)
bash
curl https://open.dieyuyun.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-t2i",
"prompt": "一只橘猫在樱花树下打盹",
"size": "1280x1280",
"prompt_extend": false,
"n": 2
}'异步模式
在请求中添加 "async": true 即可启用异步模式。异步请求不会直接返回生成结果,而是返回一个 taskId,用于后续查询任务进度和获取结果。
json
{
"id": "task_abc123",
"status": "queued",
"progress": 0
}| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 任务 ID,用于查询任务状态 |
| status | string | 当前状态: queued / processing |
| progress | integer | 进度百分比 (0-100) |
任务完成后,通过 GET /v1/tasks/{taskId} 获取结果,返回格式与同步响应一致。
详见 异步任务 了解完整的轮询流程和最佳实践。
响应格式
成功响应
json
{
"created": 1717000000,
"data": [
{
"url": "https://...",
"revised_prompt": "一只橘色的猫咪在粉色樱花树下安静地打盹,花瓣轻轻飘落,阳光透过树叶洒下斑驳光影"
},
{
"url": "https://...",
"revised_prompt": "一只橘色的猫咪在粉色樱花树下安静地打盹,花瓣轻轻飘落,阳光透过树叶洒下斑驳光影"
}
]
}| 字段 | 类型 | 说明 |
|---|---|---|
| created | integer | Unix 时间戳 |
| data | array | 生成结果数组 |
| data[].url | string | 图像 URL |
| data[].revised_prompt | string | 优化后的提示词 |
错误响应
详见 错误码。
最佳实践
- 同步生成: 需要同步返回结果时,使用
wan2.6-t2i,它是唯一支持同步返回的模型,无需轮询 task_id。 - 高质量生成: 追求图像质量时,选择
wan2.2-t2i-plus或wanx2.1-t2i-plus,它们在细节和构图方面表现更优。 - 快速生成: 追求速度和低成本时,选择
wan2.2-t2i-flash或wanx2.1-t2i-turbo,适合快速迭代场景。 - 批量生成: 所有模型支持一次生成 1~4 张图像 (
n默认为 4),适合快速对比和方案选择。 - 负向提示词: 使用
negative_prompt排除不想要的元素,例如negative_prompt: "模糊, 低质量, 变形"。 - 提示词扩展:
wan2.6-t2i的prompt_extend默认为true,系统会自动优化提示词。如需精确控制,可设为false。 - 尺寸选择: 根据最终用途选择合适尺寸——社交媒体竖版用 9:16,横版用 16:9,通用场景用 1:1。
- 异步模型注意: wan2.2 和 wanx2.1 系列为异步返回,需要通过 task_id 轮询获取结果。
速率限制
详见 速率限制。
相关文档
- 万相 2.7 - 通义万相视频生成模型
- Qwen-Image - Qwen 图像生成模型
- Z-Image Turbo - 极速图像生成模型
- 模型列表与定价 - 浏览可用模型和定价信息
- 使用 Playground 测试 - 交互式测试图像生成