Hy
Endpoint: POST https://mps.intl.tencentcloudapi.comAction: CreateAigcImageTask
Hy Image 是腾讯混元的图片生成模型,支持文生图与参考图生成 / 编辑。3.5-preview 支持基于上一轮结果的多轮再编辑。
基本信息
| 项目 | 值 |
|---|---|
| ModelName | Hunyuan |
| ModelVersion | 3.5-preview / 3.0 |
| 是否支持关闭安全围栏 | 不支持 |
Hy Image 不适用输入·输出安全围栏关闭参数。
支持文本生成与参考图编辑。
3.0 支持 3 张参考图,3.5-preview 最多支持 6 张。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
ModelName | 必填 | String | 固定值 Hunyuan |
ModelVersion | 选填 | String | 3.5-preview / 3.0 |
Prompt | 必填 | String | 生成提示词。最多 1000 个字符。存在参考图时作为编辑指令生效 |
EnhancePrompt | 选填 | Boolean | 提示词自动优化。默认值 false |
ImageInfos.N | 选填 | Array | 参考图数组。每项使用 ImageUrl 字段 |
ExtraParameters | 选填 | Object | Resolution / AspectRatio 等输出选项 |
AdditionalParameters | 选填 | String | 直接指定像素尺寸。{"size":"1808x1024"} |
OutputImageCount | 选填 | Integer | 顶层字段。在 3.5-preview 中仅返回 1 张 |
MPS 输出配置
分辨率与宽高比在 ExtraParameters 中指定,输出张数在顶层 OutputImageCount 中指定。
请求示例
json
{
"ModelName": "Hunyuan",
"ModelVersion": "3.5-preview",
"Prompt": "a serene japanese garden, soft morning light",
"ExtraParameters": {
"Resolution": "2K",
"AspectRatio": "16:9"
},
"Operator": "admin",
"StoreCosParam": {
"CosBucketName": "<bucket-appid>",
"CosBucketRegion": "<bucket-region>",
"CosBucketPath": "/aigc/"
},
"EnhancePrompt": false
}json
{
"ModelName": "Hunyuan",
"ModelVersion": "3.5-preview",
"Prompt": "change the car color to matte black, keep the composition",
"ImageInfos": [
{
"ImageUrl": "https://<host>/car.png"
}
],
"ExtraParameters": {
"Resolution": "1K",
"AspectRatio": "16:9"
},
"Operator": "wiki-example",
"StoreCosParam": {
"CosBucketName": "<bucket-appid>",
"CosBucketRegion": "<bucket-region>",
"CosBucketPath": "/aigc/"
},
"EnhancePrompt": false
}响应示例
json
{
"Response": {
"Status": "DONE",
"Message": "ok",
"ImageUrls": [
"https://aigc-output-image-<id>.cos.<region>.myqcloud.com/<file>.png?q-sign-algorithm=sha1&..."
],
"RequestId": "<request-id>"
}
}特殊配置
输出分辨率
下表为 ExtraParameters.Resolution 与 ExtraParameters.AspectRatio 各组合对应的实际输出像素。使用与 VOD 接口相同的映射关系。
| Resolution | 1:1 | 16:9 | 9:16 | 4:3 | 3:4 |
|---|---|---|---|---|---|
| 省略 | 720x720 | 1280x720 | 720x1280 | 960x720 | 720x960 |
1K | 1024x1024 | 1808x1024 | 1024x1808 | 1360x1024 | 1024x1360 |
2K | 2048x2048 | 2048x1152 | 1152x2048 | 1920x1440 | 1440x1920 |
4K | 4096x4096 | 3840x2160 | 2160x3840 | 3840x2880 | 2880x3840 |
省略 Resolution 且只传入 AspectRatio 时,短边固定为 720。两个值都省略时,按 3:2 宽高比输出为 1872x1248。
4K / 5:4 组合按 2688x2160 输出。
直接指定像素尺寸
在 AdditionalParameters 中传入 size 时,其优先级高于 ExtraParameters 的分辨率与宽高比。取值格式为 宽x高,与 VOD 接口不同,JSON 只需转义一层。
json
{
"AdditionalParameters": "{\"size\":\"1808x1024\"}"
}| 输入值 | 实际输出 |
|---|---|
1808x1024 | 1808x1024 |
1024x1536 | 1024x1536 |
656x1000 | 656x992 (向下取整为 16 的倍数) |
auto | 根据提示词自动决定 |
100x100 | 256x256 (按下限校正) |
参考图
在 ImageInfos 中输入参考图的 ImageUrl。
json
{
"ImageInfos": [
{
"ImageUrl": "https://<host>/reference.png"
}
]
}| 项目 | 值 |
|---|---|
| 必填字段 | ImageUrl |
| 参考图数量 | 最多 6 张 |
| 格式 | jpeg, png, webp |
参考图输入
在 ImageInfos 中指定 ImageUrl。可同时使用 ReferenceType。