Vidu 生图参数
Vidu Q2 Image(viduq2-image)走统一生图契约:POST /chat/completions(modalities 含 image)+ 可选 GET /image/tasks/{taskId}。本页按 Text to Image、Reference to Image、Image Edit 分节给出可复制示例。
通用字段表见 图像生成 · 高级参数。端点说明见 创建图像生成(chat)。模型列表见 获取模型(modality=image)或 模型广场。
OpenAI Images 形态见 创建图像(Images)、编辑图像(Images)。
模型 ID
model | 典型能力 | image_size | 参考图 |
|---|---|---|---|
viduq2-image | 文生图 / 参考生图 / 图编辑 | 1080p / 2K / 4K | 最多 7 张 |
公共约束
| 项 | 说明 |
|---|---|
stream | 须为 false 或省略 |
aspect_ratio | 常见 auto、16:9、9:16、1:1、3:4、4:3、21:9、2:3、3:2 |
image_config.custom_size | 不支持;用 image_size |
output_image_count | 单次默认 1 张 |
model_specific_config.seed | 可选整数,便于复现相近结果 |
| 计费 | 按张;单价随分辨率与参考图张数分档 |
Text to Image
纯文本提示词生成图片,不传参考图。
bash
curl -sS "${TRINITY_BASE_URL}/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TRINITY_API_KEY}" \
-d '{
"model": "viduq2-image",
"messages": [{ "role": "user", "content": "一只穿着宇航服的猫站在月球上,电影级光影" }],
"modalities": ["image", "text"],
"stream": false,
"image_config": {
"image_size": "1080p",
"aspect_ratio": "16:9",
"output_format": "url"
},
"model_specific_config": {
"seed": 42
}
}'python
import json, os, requests
url = f"{os.environ['TRINITY_BASE_URL']}/chat/completions"
headers = {
"Authorization": f"Bearer {os.environ['TRINITY_API_KEY']}",
"Content-Type": "application/json",
}
payload = {
"model": "viduq2-image",
"messages": [{"role": "user", "content": "一只穿着宇航服的猫站在月球上,电影级光影"}],
"modalities": ["image", "text"],
"stream": False,
"image_config": {
"image_size": "1080p",
"aspect_ratio": "16:9",
"output_format": "url",
},
"model_specific_config": {"seed": 42},
}
print(requests.post(url, headers=headers, data=json.dumps(payload)).json())Reference to Image
在 image_config.reference_images 传入 1~7 张公网可访问图片 URL,结合提示词生成新图(主体一致性)。
bash
curl -sS "${TRINITY_BASE_URL}/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TRINITY_API_KEY}" \
-d '{
"model": "viduq2-image",
"messages": [{ "role": "user", "content": "保持角色外观,换成雨夜霓虹街道背景" }],
"modalities": ["image", "text"],
"stream": false,
"image_config": {
"image_size": "2K",
"aspect_ratio": "9:16",
"output_format": "url",
"reference_images": [
{
"type": "url",
"url": "https://example.com/character.png",
"text": "主体角色"
}
]
}
}'Image Edit
图编辑与参考生图使用同一 HTTP 路径与字段:多张参考图 + 文案描述希望替换或修改的内容。无需单独的 mode / edit Action。
bash
curl -sS "${TRINITY_BASE_URL}/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TRINITY_API_KEY}" \
-d '{
"model": "viduq2-image",
"messages": [{ "role": "user", "content": "把图中的红色背包换成蓝色双肩包,其余构图不变" }],
"modalities": ["image", "text"],
"stream": false,
"image_config": {
"image_size": "4K",
"aspect_ratio": "1:1",
"output_format": "url",
"reference_images": [
{
"type": "url",
"url": "https://example.com/source-scene.png",
"text": "待编辑原图"
},
{
"type": "url",
"url": "https://example.com/bag-style.png",
"text": "目标背包样式参考"
}
]
},
"model_specific_config": {
"seed": 7
}
}'亦可通过 OpenAI 兼容入口 POST /images/edits 提交编辑请求;平台映射到同一统一契约。详见 编辑图像(Images)。