创建 gpt-image-2
POST
/v1/images/generations
- 根据文本
prompt生成图像(gpt-image-2) - 支持
size、format、quality等输出参数 - 请求体为
application/json - 官方文档:Images create
Authorizations
bearer
Type
HTTP (bearer)
Request Body
application/json
model
string
Required
用于生成图像的模型,如 gpt-image-2。
prompt
string
Required
所需图像的文本描述。最大长度为 1000 个字符。
n
integer
要生成的图像数。必须介于 1 和 10 之间。
size
string
图片尺寸
1024x1024 正方形
1536x1024 横版
1024x1536 竖版
2048x2048 2K正方形
2048x1152 2K横版
3840x2160 4K横版
2160x3840 4K竖版
auto 默认
尺寸严格限制规则
- 图片最大边长 ≤ 3840px
- 宽高两边像素均为 16px 的倍数
- 长边 / 短边 比值 ≤ 3:1
- 总像素范围:最小 655360 ~ 最大 8294400
format
string
图片格式
可选:png 、 jpeg 、 webp
quality
string
图片画质
可选:low 、 medium 、 high 、 auto(默认)
Responses
application/json
object
id
string
Required
object
string
Required
created
integer
Required
choices
object[]
Required
usage
object
Required