Skip to content

Vidu 生图参数

Vidu Q2 Image(viduq2-image)走统一生图契约:POST /chat/completionsmodalitiesimage)+ 可选 GET /image/tasks/{taskId}。本页按 Text to ImageReference to ImageImage Edit 分节给出可复制示例。

通用字段表见 图像生成 · 高级参数。端点说明见 创建图像生成(chat)。模型列表见 获取模型modality=image)或 模型广场

OpenAI Images 形态见 创建图像(Images)编辑图像(Images)


模型 ID

model典型能力image_size参考图
viduq2-image文生图 / 参考生图 / 图编辑1080p / 2K / 4K最多 7

公共约束

说明
stream须为 false 或省略
aspect_ratio常见 auto16:99:161:13:44:321:92:33: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)


相关

© Trinity AI