跳到内容

Vega Image ​

更新时间

Endpoint: POST https://vod.intl.tencentcloudapi.comAction: CreateAigcImageTask

Vega Image 是 WAND 自研的图片生成模型,支持文生图与参考图编辑。提供 Pro / Flash / Lite 三个版本,生成结果可通过 DescribeTaskDetail 或完成事件确认。

基本信息 ​

项目值
ModelNamewand-vega-image
ModelVersion1.0-pro / 1.0-flash / 1.0-lite
输入文本 / 参考图片
结果查询DescribeTaskDetail
支持解除护栏支持

各版本支持规格 ​

版本分辨率比例参考图片
1.0-pro1K / 2K / 4K1:1 / 2:3 / 3:2 / 3:4 / 4:3 / 9:16 / 16:9 / 21:9最多 6 张
1.0-flash1K / 2K / 4K1:1 / 2:3 / 3:2 / 3:4 / 4:3 / 9:16 / 16:9 / 21:9最多 6 张
1.0-lite1K / 2K / 4K1:1 / 2:3 / 3:2 / 3:4 / 4:3 / 9:16 / 16:9 / 21:9最多 3 张

Resolution=2K、AspectRatio=16:9 的输出尺寸为 2560×1440。

参考图片规格 ​

版本参考图片数量单文件容量格式
1.0-pro最多 6 张10MB 以下PNG / JPEG
1.0-flash最多 6 张10MB 以下PNG / JPEG
1.0-lite最多 3 张10MB 以下PNG / JPEG

参考图片通过 FileInfos.Url 传递。单文件容量限制与图片数量限制分别适用。参考 URL 必须可被生成服务下载,非公开对象请使用有效的签名 URL。

生成示例 ​

夏天乡间小路上骑自行车的人物与稻田、向日葵

夏天乡间小路的插画

朝鲜时代宫殿中出现的戴着斗笠、身着韩服形铠甲的赛博机器人

朝鲜时代出现的赛博机器人 / Pro / 2K

请求参数 ​

参数必填类型说明
SubAppId必填IntegerVOD 应用程序 ID
ModelName必填Stringwand-vega-image
ModelVersion必填String1.0-pro / 1.0-flash / 1.0-lite
Prompt条件必填String生成或编辑指令。若无 FileInfos 则必填
FileInfos.N可选Array参考图片。Type=Url / File / Base64
FileInfos.N.Url条件必填StringType=Url 时的图片 URL
FileInfos.N.FileId条件必填StringType=File 时的 VOD 媒体 ID
FileInfos.N.Base64条件必填StringType=Base64 时图片的 Base64 字符串
OutputConfig.
Resolution
可选String输出分辨率
OutputConfig.
AspectRatio
可选String输出比例
OutputConfig.
StorageMode
可选StringTemporary / Permanent
OutputConfig.
LogoAdd
可选String徽标水印。Enabled / Disabled
OutputConfig.
OutputImageCount
可选Integer设置 Flash / Pro 的输出图片数量。示例使用 1
InputRegion可选String输入区域。海外请求为 Oversea

请求示例 ​

基于文本生成 ​

json
{
  "SubAppId": 123456789,
  "ModelName": "wand-vega-image",
  "ModelVersion": "1.0-pro",
  "Prompt": "A cybernetic robot wearing hanbok-inspired armor and a gat in a Joseon palace courtyard, rain and lantern light, cinematic realism.",
  "OutputConfig": {
    "StorageMode": "Temporary",
    "Resolution": "2K",
    "AspectRatio": "16:9",
    "LogoAdd": "Disabled"
  }
}

参考图片编辑 ​

json
{
  "SubAppId": 123456789,
  "ModelName": "wand-vega-image",
  "ModelVersion": "1.0-pro",
  "Prompt": "Keep the person and bicycle. Change the season to autumn with warm orange foliage.",
  "OutputConfig": {
    "StorageMode": "Temporary",
    "Resolution": "2K",
    "AspectRatio": "16:9",
    "LogoAdd": "Disabled",
    "OutputImageCount": 1
  },
  "FileInfos": [
    {
      "Type": "Url",
      "Url": ""
    }
  ]
}

Python SDK ​

python
import json
import os
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.vod.v20180717 import vod_client, models

profile = ClientProfile
profile.httpProfile = HttpProfile
profile.httpProfile.endpoint = "vod.intl.tencentcloudapi.com"
client = vod_client.VodClient(
    credential.Credential(
        os.environ["TENCENTCLOUD_SECRET_ID"],
        os.environ["TENCENTCLOUD_SECRET_KEY"],
    ),
    "ap-singapore",
    profile,
)
params = {
    "SubAppId": 123456789,
    "ModelName": "wand-vega-image",
    "ModelVersion": "1.0-pro",
    "Prompt": "A cybernetic robot in a Joseon palace courtyard, cinematic light",
    "OutputConfig": {
        "StorageMode": "Temporary",
        "Resolution": "2K",
        "AspectRatio": "16:9",
        "LogoAdd": "Disabled",
    },
}
request = models.CreateAigcImageTaskRequest
request.from_json_string(json.dumps(params))
response = client.CreateAigcImageTask(request)
print(response.to_json_string)

响应与结果查询 ​

生成请求返回 TaskId。

json
{
  "TaskId": "1500033704-AigcImageTask-b988f28b31d06c2ba1fc9ad1428c02e8t",
  "RequestId": "52ee718a-4423-409e-a96c-a7797d6879b6"
}

向 DescribeTaskDetail 传递相同的 SubAppId 与 TaskId。

json
{
  "SubAppId": 123456789,
  "TaskId": "1500033704-AigcImageTask-b988f28b31d06c2ba1fc9ad1428c02e8t"
}

为 AigcImageTask.Status=FINISH、ErrCode=0 时生成完成。图片地址在 AigcImageTask.Output.FileInfos.FileUrl 中返回。

json
{
  "AigcImageTask": {
    "Status": "FINISH",
    "ErrCode": 0,
    "Progress": 100,
    "Output": {
      "FileInfos": [
        {
          "FileUrl": "",
          "MetaData": {
            "Width": 2560,
            "Height": 1440
          }
        }
      ]
    }
  }
}

特殊设置 ​

Base64 参考图片 ​

使用 Type=Base64 与 Base64 字段。支持 JPEG / JPG / PNG / WEBP,编码前文件大小合计在 7MB 以下。不含 data:image/...;base64, 前缀。

python
import base64

with open("reference.png", "rb") as image:
    params["FileInfos"] = [{
        "Type": "Base64",
        "Base64": base64.b64encode(image.read).decode("ascii"),
    }]

结果保存与完成事件 ​

StorageMode=Temporary 返回临时结果 URL。要以 VOD 媒体保存请使用 Permanent。完成通知可使用普通回调或可信事件通知。认证与回调的通用规范参见 API Reference。

基于 VitePress 构建 · 部署于腾讯云 EdgeOne Pages