生成图片 · gpt-image-2.5-pro
/v1/images/generations生成一张图片。耗时请求建议开启 stream;各模型的质量与实际像素限制见图片指南。
同步 · 直接返回结果 · 本次请求等待处理并直接返回 JSON 或文件。
鉴权
使用客户 API Key。 获取与配置 →
Authorization: Bearer YOUR_API_KEY选择模型
查看该模型的能力与限制 →请求参数
- 不能同时提供 image_url, reference_images.
- 当 提供 delivery: 必须提供 stream;stream 必须为 true;response_format 必须为 "url".
- 当 model = "gemini-3.1-flash-lite-image": resolution 须匹配 ^(1[kK]|1080[pP])$;size 仅接受 "auto", "1024x1024", "1536x1024", "1024x1536", "1792x1024", "1024x1792".
- 当 model 为 "gemini-3-pro-image", "gpt-image-2.5-pro", "gpt-image-2", "image-pro", "image-creative": quality 仅接受 "auto", "hd";否则 quality 仅接受 "auto", "standard".
- 当 提供 progress,且 progress = true: 必须提供 stream;stream 必须为 true.
modelstring必填本站公开调用名称,具体能力与限制见指南。
"gemini-3.1-flash-lite-image""gemini-3.1-flash-image""gemini-3-pro-image""gpt-image-2.5-fast""gpt-image-2.5-pro""gpt-image-2""image-basic""image-fast""image-pro""image-creative"promptstring必填必填,不能为空白,最多 4096 个 Unicode 字符。
最少字符: 1 · 最多字符: 4096 · 匹配规则: "\\S"
sizestring分辨率档位与比例预设,实际像素以返回文件为准;必须与 resolution/aspect_ratio 一致。
"auto""1024x1024""1536x1024""1024x1536""1792x1024""1024x1792""2048x2048""2048x1152""1152x2048""4096x4096""4096x2304""2304x4096"resolutionstring分辨率档位大小写不敏感,默认 1K,Lite 仅支持 1K。
匹配规则: "^(1[kK]|1080[pP]|2[kK]|4[kK])$" · 默认: "1k"
aspect_ratiostring画面比例;图片默认 1:1,普通视频默认 16:9,short 固定 9:16。
"1:1""16:9""9:16""4:3""3:4""3:2""2:3""21:9"默认: "1:1"
qualitystring质量随模型固定,只接受 auto 或该模型的 standard/hd,不支持 low/medium/high。
"auto""standard""hd"ninteger每次仅生成一个产物。
固定值: 1 · 默认: 1
response_formatstring普通 JSON 默认只返回 URL;默认 SSE 即使填写 url 也仍包含 Base64。
"url""b64_json"默认: "url"
enhanceboolean提示词增强开关,默认 true。
默认: true
streambooleantrue 返回等待心跳和最终图片事件。
默认: false
partial_imagesinteger仅接受 0,暂不提供中途预览图。
固定值: 0
deliverystring本站 URL 交付扩展,仅与 stream:true 同用,不能同时请求 b64_json;完成事件为 image_url.completed。
固定值: "url"
image_urlstring单张 HTTP(S) 图片 URL 或图片 Base64 data URL。
匹配规则: "^(https?://|data:image/)"
reference_imagesarray非空参考图 URL / data URL 数组;与单图输入互斥。
最少条数: 1
展开结构
string — HTTP(S) 图片地址或 Base64 图片 Data URL。
匹配规则: "^(https?://|data:image/)"
progressboolean本站扩展,进度事件来自同一个原始任务,必须开启 stream=true;源进度百分比缺失时为 null。
默认: false
同时满足的规则 · 1
- 不能同时提供 image_url, reference_images.
object
条件约束(JSON Schema)
{
"not": {
"required": [
"image_url",
"reference_images"
]
}
}同时满足的规则 · 2
- 当 提供 delivery: 必须提供 stream;stream 必须为 true;response_format 必须为 "url".
object
条件约束(JSON Schema)
{
"if": {
"required": [
"delivery"
]
},
"then": {
"required": [
"stream"
],
"properties": {
"stream": {
"const": true,
"type": "boolean"
},
"response_format": {
"const": "url",
"type": "string"
}
}
}
}同时满足的规则 · 3
- 当 model = "gemini-3.1-flash-lite-image": resolution 须匹配 ^(1[kK]|1080[pP])$;size 仅接受 "auto", "1024x1024", "1536x1024", "1024x1536", "1792x1024", "1024x1792".
object
条件约束(JSON Schema)
{
"if": {
"properties": {
"model": {
"const": "gemini-3.1-flash-lite-image",
"type": "string"
}
}
},
"then": {
"properties": {
"resolution": {
"pattern": "^(1[kK]|1080[pP])$"
},
"size": {
"enum": [
"auto",
"1024x1024",
"1536x1024",
"1024x1536",
"1792x1024",
"1024x1792"
],
"type": "string"
}
}
}
}同时满足的规则 · 4
- 当 model 为 "gemini-3-pro-image", "gpt-image-2.5-pro", "gpt-image-2", "image-pro", "image-creative": quality 仅接受 "auto", "hd";否则 quality 仅接受 "auto", "standard".
object
条件约束(JSON Schema)
{
"if": {
"properties": {
"model": {
"enum": [
"gemini-3-pro-image",
"gpt-image-2.5-pro",
"gpt-image-2",
"image-pro",
"image-creative"
],
"type": "string"
}
}
},
"then": {
"properties": {
"quality": {
"enum": [
"auto",
"hd"
],
"type": "string"
}
}
},
"else": {
"properties": {
"quality": {
"enum": [
"auto",
"standard"
],
"type": "string"
}
}
}
}同时满足的规则 · 5
- 当 提供 progress,且 progress = true: 必须提供 stream;stream 必须为 true.
object
条件约束(JSON Schema)
{
"if": {
"required": [
"progress"
],
"properties": {
"progress": {
"const": true
}
}
},
"then": {
"required": [
"stream"
],
"properties": {
"stream": {
"const": true,
"type": "boolean"
}
}
}
}不接受未列出的字段。
响应
返回 JSON 结果,或 SSE 心跳、可选进度事件(progress=true),随后返回完成或错误事件。只有完成事件才能确认交付。
响应头
X-Image-Request-Idstring用于查单的请求 ID,可能与最终 New API request_id 不同。
Content-Type application/json
createdinteger必填dataarray必填最少条数: 1 · 最多条数: 1
展开结构
urlstring必填格式: "uri"
b64_jsonstring在成功的普通响应中,仅在显式请求时返回。