Skip to content

GPT-Image 文生图 ​

GPT-Image 文生图使用 OpenAI 兼容图片生成入口。该模型仅支持 Base64 图片返回。

Endpoint ​

POST /v1/images/generations

鉴权 ​

Authorization: Bearer <YOUR_API_KEY>

参数说明 ​

参数类型必填说明
modelstring是gpt-image-1.5 或 gpt-image-2。
promptstring是图片描述。
ninteger否生成数量,默认为 1。
sizestring否输出尺寸,例如 1024x1024、1024x1536、1536x1024、auto,或 gpt-image-2 支持的自定义尺寸。
qualitystring否auto、high、medium、low。
backgroundstring否auto、transparent、opaque。JPEG 不支持透明背景。
output_formatstring否png 或 jpeg。
output_compressioninteger否JPEG 压缩质量,范围 0-100。
response_formatstring否仅支持 b64_json。

API Reference ​

查看底层接口定义