Skip to main content
POST
图片生成

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
prompt
string
必填

必填。要生成图像的文本描述;GPT Image 模型最长 32000 字符,dall-e-2 最长 1000 字符,dall-e-3 最长 4000 字符。

Required string length: 1 - 32000
model
enum<string>
必填

必填。图片生成模型。网关不会采用 OpenAI 的 dall-e-2 默认值,必须显式传 model。

可用选项:
gpt-image-2.5-sunburst,
gpt-image-2.5-sunburst-2026-09-08,
gpt-image-2.5-flare,
gpt-image-2.5-flare-2026-09-08,
gpt-image-2,
gpt-image-2-2026-04-21,
gpt-image-1.5,
gpt-image-1,
gpt-image-1-mini,
dall-e-2,
dall-e-3
background
enum<string> | null

背景设置,仅 GPT Image 模型支持。transparent 使用时 output_format 必须为 png 或 webp。

可用选项:
transparent,
opaque,
auto,
null
moderation
enum<string> | null

内容审核级别,仅 GPT Image 模型支持。auto 为默认值。

可用选项:
low,
auto,
null
n
integer | null

生成的图像数量。dall-e-3 仅支持 1。

必填范围: 1 <= x <= 10
output_compression
integer | null

图像压缩率(0–100),仅 GPT Image 的 webp 或 jpeg 输出支持,默认 100。

必填范围: 0 <= x <= 100
output_format
enum<string> | null

输出图像格式,仅 GPT Image 模型支持。

可用选项:
png,
jpeg,
webp,
null
partial_images
integer | null

流式响应中返回的中间图像数量,仅 GPT Image 模型支持。

必填范围: 0 <= x <= 3
quality
enum<string> | null

图像质量。GPT Image 支持 auto/low/medium/high;GPT Image 2.5 额外支持 xhigh/max;dall-e-3 支持 standard/hd;dall-e-2 仅支持 standard。

可用选项:
auto,
low,
medium,
high,
xhigh,
max,
standard,
hd,
null
response_format
enum<string>
默认值:b64_json

仅 dall-e-2 和 dall-e-3 支持 url 或 b64_json。GPT Image 模型始终返回 Base64,不支持此上游参数。

可用选项:
b64_json,
url
size
enum<string> | null

图像尺寸。GPT Image 2/2.5 支持 WIDTHxHEIGHT:宽高均为 16 的倍数、比例 1:3~3:1,最高 3840x2160;其他 GPT Image 使用 auto、1024x1024、1536x1024 或 1024x1536;dall-e-2 支持 256x256、512x512、1024x1024;dall-e-3 支持 1024x1024、1792x1024、1024x1792。

可用选项:
auto,
256x256,
512x512,
1024x1024,
1536x1024,
1024x1536,
1792x1024,
1024x1792,
null
stream
boolean | null

是否采用 SSE 流式生成,仅 GPT Image 模型支持,默认 false。

style
enum<string> | null

生成风格,仅 dall-e-3 支持。

可用选项:
vivid,
natural,
null
user
string

终端用户的唯一标识,用于滥用监控与检测。

响应

200 - application/json
created
integer
必填

图像创建时的 Unix 时间戳(秒)。

data
object[]
必填

生成结果列表。

background
enum<string>

实际采用的背景设置。

可用选项:
transparent,
opaque
output_format
enum<string>

实际输出图像格式。

可用选项:
png,
webp,
jpeg
quality
enum<string>

实际生成质量。

可用选项:
low,
medium,
high
size
string

实际生成的图像尺寸。

usage
object

GPT Image 模型的 token 用量。