size 同时指定分辨率和比例,格式为 宽x高,单位是像素,中间使用小写英文字母 x。2048x1152 是 16:9 横图,864x1536 是 9:16 竖图。aspect_ratio、resolution、width 或 height;不要把 16:9、2K、4K 当作 size 的值。| 比例 | size | 用途 | 极点线路验证 |
|---|---|---|---|
| 1:1 | 1024x1024 | 基础方图 | 已实测 |
| 3:2 | 1536x1024 | 横图 | 1536x1024 / PNG |
| 2:3 | 1024x1536 | 竖图 | 1024x1536 / PNG |
| 16:9 | 1536x864 | 宽屏 | 符合官方尺寸规则;未单独实测 |
| 9:16 | 864x1536 | 竖屏 | 864x1536 / PNG |
| 4:3 | 1536x1152 | 横图 | 符合官方尺寸规则;未单独实测 |
| 3:4 | 1152x1536 | 竖图 | 符合官方尺寸规则;未单独实测 |
| 1:1 | 2048x2048 | 2K 方图 | 符合官方尺寸规则;未单独实测 |
| 16:9 | 2048x1152 | 2K 宽屏 | 2048x1152 / PNG |
| 9:16 | 1152x2048 | 2K 竖屏 | 符合官方尺寸规则;未单独实测 |
| 16:9 | 3840x2160 | 4K 宽屏 | 3840x2160 / PNG |
| 9:16 | 2160x3840 | 4K 竖屏 | 符合官方尺寸规则;未单独实测 |
size: "auto" 属于标准协议选项,由服务决定尺寸;需要固定尺寸交付时请明确填写像素宽高。1920x1080 的高度不是 16 的倍数,16:9 可使用 1536x864 或 2048x1152。| 参数 | 标准值 / 写法 | 使用建议 |
|---|---|---|
n | 标准范围 1–10;实测 1、2 | 与参考图数量无关。2 已返回两张图片;更多张数未逐项实测。 |
quality | low、medium、high、auto | 当前线路尚不能保证切换档位;建议省略。 |
output_format | png、jpeg、webp | 默认示例使用 PNG;其他格式见下方实测记录。 |
output_compression | 0–100 的整数 | 标准协议仅用于 JPEG / WebP,不控制 PNG;当前线路效果未保证。 |
background | 标准协议有 auto、opaque、transparent | 当前线路透明背景请求已被拒绝;推荐省略或 auto。 |
input_fidelity | gpt-image-2 不需要设置 | 按官方说明,此模型自动按高保真处理输入,省略该参数。 |
quality=high:图生图请求成功,但响应 quality 为 medium,因此不承诺 high 档位生效。size=auto + quality=auto + WebP + 压缩参数:返回 1 张;响应 size=2048x2048、quality=medium、output_format=webp、background=auto;下载图片核对为 2048x2048 / PNG。n=2:返回 2 张;响应 size=1024x1024、quality=medium、output_format=png、background=auto;下载图片核对为 1024x1024 / PNG, 1024x1024 / PNG。background=transparent:HTTP 400,服务端明确返回 Transparent background is not supported for this model.。当前线路不支持透明背景。JPEG + output_compression=80:返回 1 张;响应 size=1024x1024、quality=medium、output_format=jpeg、background=auto;下载图片核对为 1024x1024 / PNG。response_format 与 output_format 不是同一件事:前者涉及 URL / Base64 的返回方式,后者涉及 PNG / JPEG / WebP 文件编码。本线路当前接入方式为读取 data[].url;示例不设置 response_format。mask、stream、partial_images 等高级功能不在本版验证范围。curl.exe --max-time 300 'https://jidian.ai668.cc/v1/images/edits' `
-H "Authorization: Bearer $env:JIDIAN_API_KEY" `
-H 'Content-Type: application/json' `
--data-binary '@edit-request.json'curl --location 'https://jidian.ai668.cc/v1/images/edits' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2",
"prompt": "给图片中右侧的小狗添加一条红围巾,保留角色和场景。",
"images": [
{
"image_url": "https://example.com/reference.png"
}
],
"size": "1024x1024",
"n": 1
}'{
"background": "auto",
"created": 1791118432,
"data": [
{
"url": "https://example.com/generated-image.png"
}
],
"model": "gpt-image-2",
"moderation": "auto",
"output_format": "png",
"quality": "medium",
"size": "1024x1024",
"usage": {
"input_tokens": 352,
"input_tokens_details": {
"image_tokens": 300,
"text_tokens": 52
},
"output_tokens": 1056,
"output_tokens_details": {
"image_tokens": 1056,
"text_tokens": 0
},
"total_tokens": 1408
}
}