GPT-Image 2.0
← 返回 GPT-Image 概览,查看版本对比与选型。
Endpoint: POST https://vod.intl.tencentcloudapi.comAction: CreateAigcImageTask
GPT-Image 2.0 是该系列的基础版本:只有一个系列、三个画质档位,参数最简。它也是省略 ModelVersion 时的默认系列(默认值 image2_medium)。
本页是 GPT-Image 系列三篇接口文档之一,另见 GPT-Image 2.5 与 GPT-Image 2.6。需要 xhigh / max 更高画质档位,或要在速度与精度之间二选一的,请用 2.5 / 2.6 的双系列。
基本信息
| 项目 | 取值 |
|---|---|
| ModelName | OG |
| ModelVersion | image2_low / image2_medium / image2_high |
| 默认值 | ModelVersion=image2_medium / AspectRatio=1:1 |
| 结果查询 | DescribeTaskDetail |
| 支持解除护栏 | 不支持 |
ModelVersion 枚举
| ModelVersion | 特点 | 推荐用途 |
|---|---|---|
image2_low | 生成速度最快,成本最低 | 快速草稿、批量测试、提示词迭代 |
image2_medium | 速度、成本与画质的最佳平衡点(默认值) | 大多数日常生产和通用设计需求 |
image2_high | 速度最慢、成本最高;细节、纹理、光影最极致,擅长处理复杂文本和小字体 | 最终成品交付、印刷物料、高精度产品图 |
2.0 的档位止于 high
xhigh 与 max 两档从 2.5 起提供。需要更高精度,或需要在 sunburst(偏精度)与 flare(偏速度)之间选择的,请改用 2.5 / 2.6。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
SubAppId | 必填 | Integer | 子应用 ID |
ModelName | 必填 | String | 固定值 OG |
ModelVersion | 可选 | String | image2_low / image2_medium / image2_high。省略取默认值 image2_medium |
Prompt | 必填 | String | 生成提示词,最多 32,000 个字符 |
FileInfos.N | 可选 | Array | 参考图片(image-to-image),最多 16 张。ReferenceType=mask 时作为蒙版。传图方式见参考图片的传入方式 |
OutputConfig.StorageMode | 可选 | String | Temporary(临时存储,有效期 7 天)/ Permanent(永久存储,生成 FileId) |
OutputConfig.Resolution | 可选 | String | 1K / 2K / 4K |
OutputConfig.AspectRatio | 可选 | String | 1:1 / 3:2 / 2:3 / 3:4 / 4:3 / 16:9 / 9:16 / 21:9 / 9:21 |
OutputConfig.OutputImageCount | 可选 | Integer | 生成张数,OG 为 1~8 |
OutputConfig.OutputFormat | 可选 | String | jpeg / png。省略时跟随模型默认值。GIF / SVG 输出仅 2.6 支持 |
OutputConfig.PersonGeneration | 可选 | String | AllowAdult(允许成人)/ Disallowed(禁止人物或人脸) |
OutputConfig.InputComplianceCheck | 可选 | String | 输入内容合规检查:Enabled / Disabled |
OutputConfig.OutputComplianceCheck | 可选 | String | 输出内容合规检查:Enabled / Disabled |
OutputConfig.LogoAdd | 可选 | String | 是否添加图标水印:Enabled / Disabled |
InputRegion | 可选 | String | 输入的区域信息:Mainland(中国大陆)/ Oversea(海外)/ OverseaUSWest(海外-美西) |
ExtInfo | 可选 | String | 承载模型专用选项的 JSON 字符串,详见特殊设置 |
SessionContext | 可选 | String | 回调时原样返回的会话标识 |
请求示例
{
"SubAppId": 123456789,
"ModelName": "OG",
"ModelVersion": "image2_medium",
"Prompt": "a serene japanese garden, soft morning light",
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"AspectRatio": "9:16"
},
"SessionContext": "job-001"
}响应示例
{
"AigcImageTask": {
"Status": "FINISH",
"ErrCode": 0,
"Progress": 100,
"Output": {
"FileInfos": [
{
"FileUrl": "http://<host>.vod2.myqcloud.com/.../aigcImageGenFile.png",
"ExpireTime": "2026-08-01T10:29:48Z",
"MetaData": {
"Width": 1024,
"Height": 1024,
"Container": "png"
}
}
]
}
}
}特殊设置
以下用法在 2.0 / 2.5 / 2.6 三个系列之间完全一致(2.6 独有的 GIF / SVG 输出见 2.6 文档)。
参考图片的传入方式
FileInfos 中每一项用 Type 指定图片来源:
Type | 配套字段 | 说明 |
|---|---|---|
File | FileId | 点播媒体文件 ID |
Url | Url | 可公开访问的图片 URL |
Base64 | Base64 | 图片的 Base64 字符串 |
Base64 的限制
- 所有文件大小总和不能超过
7 MB,避免转成 Base64 后超出云 API10 MB的请求包上限; - 图片格式须为
jpeg/jpg/png/webp; - 不要带
data:image/jpeg;base64,之类的前缀。
多图参考
一次请求可放入多张参考图片,最多 16 张。用于图片编辑、风格迁移、多图融合(如换背景、组合元素)。
{
"SubAppId": 123456789,
"ModelName": "OG",
"ModelVersion": "image2_medium",
"FileInfos": [
{ "Type": "Url", "Url": "https://<cos>/room.png" },
{ "Type": "Url", "Url": "https://<cos>/fabric.jpg" }
],
"Prompt": "redesign this room with the material palette of the second image, keep the layout unchanged",
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"AspectRatio": "9:16"
},
"SessionContext": "job-001"
}多张输出 (OutputImageCount)
用 OutputConfig.OutputImageCount 指定一次生成的图片数量。OG 为 1~8 张(各引擎上限不同,Kling 为 1~9 张)。
{
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"AspectRatio": "9:16",
"OutputImageCount": 3
}
}自定义分辨率 (size)
用 ExtInfo 的 size 直接指定输出分辨率。
| 条件 | 值 |
|---|---|
| 宽高 | 各为 16 的倍数 |
| 最长边 | 3840px 以下(即最大不超过 4K) |
| 总像素数 | 655,360 ~ 8,294,400 |
{
"SubAppId": 123456789,
"ModelName": "OG",
"ModelVersion": "image2_medium",
"Prompt": "a serene japanese garden, soft morning light",
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"AspectRatio": "9:16"
},
"ExtInfo": "{\"AdditionalParameters\": \"{\\\"size\\\": \\\"2000x1104\\\"}\"}",
"SessionContext": "job-001"
}常用预设有 1024x1024(方)、1536x1024(横)、1024x1536(竖)。也支持 2K(2560x1440)与 4K(3840x2160)输出,超过 2560px 为实验性支持。
auto 模式
在 size 填入 auto,模型会根据输入决定分辨率。
{
"ExtInfo": "{\"AdditionalParameters\": \"{\\\"size\\\": \\\"auto\\\"}\"}"
}auto 模式下 AspectRatio 不要传 auto
size 为 auto 时,AspectRatio 仍需指定具体比例,不能也填 auto。
图片编辑蒙版
在 FileInfos 中一并放入指定了 ReferenceType=mask 的图片,对要编辑的区域进行蒙版处理。蒙版图与原图各占一项。
{
"SubAppId": 123456789,
"ModelName": "OG",
"ModelVersion": "image2_medium",
"FileInfos": [
{
"Type": "Url",
"Url": "https://<cos>/room-mask.png",
"ReferenceType": "mask"
},
{
"Type": "Url",
"Url": "https://<cos>/room.png"
}
],
"Prompt": "the same sunny indoor lounge with a pool, but with a flamingo standing in the pool",
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"AspectRatio": "9:16"
},
"SessionContext": "job-001"
}透明背景
在 ExtInfo 的 background 填入 transparent,可生成背景透明的图片。
"ExtInfo": "{\"AdditionalParameters\": \"{\\\"background\\\":\\\"transparent\\\"}\"}"VOD 与 MPS 的传递位置不同
同一个 OG 引擎,透明背景选项的放置位置不同:VOD 放入 ExtInfo 内的 AdditionalParameters(JSON 字符串被双重编码),MPS 则直接指定在最顶层的 AdditionalParameters。
输出格式 (OutputFormat)
用 OutputConfig.OutputFormat 指定输出格式。省略时使用模型默认值。
{
"OutputConfig": {
"StorageMode": "Permanent",
"Resolution": "1K",
"OutputFormat": "png"
}
}| 值 | 说明 |
|---|---|
jpeg | JPEG 输出 |
png | PNG 输出 |
若需要无损,或后处理中要处理 alpha 通道与细节灰阶,请指定 png;若用于传递、容量更重要,则 jpeg 更有利。透明背景需配合 png。
文本渲染
支持中、英、日、韩及阿拉伯文等多语种文本渲染,image2_high 对复杂文本与小字体的表现最好。
相关文档
| 文档 | 说明 |
|---|---|
| GPT-Image 概览 | 三个系列的选型对比与公共规格 |
| GPT-Image 2.6 | 最新系列:sunburst / flare 各五档 |
| GPT-Image 2.5 | 双系列、xhigh / max 档位、各档位生成时间实测 |
| VOD 快速开始 | VOD API 的鉴权、任务提交与结果查询 |