Skip to main content
POST
创建图片任务(异步)
Returns { "taskId": "..." }. Poll Get Task Result.
  • No image → generate
  • image present → edit
  • image + mask → inpaint
image / mask accept http(s):// URLs only. For base64 or data URL, use Compat.
response_format defaults to url (our S3). b64_json returns base64. Never both. Models: gpt-image-2 (default), gpt-image-2.5-flare, gpt-image-2.5-sunburst.
Full field list, sizes, and quality rules: Async Image overview.

Authorizations

Authorization
string
header
required

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

Body

application/json
prompt
string
required

提示词(prompt)

model
enum<string>
default:gpt-image-2

模型。默认 gpt-image-2;2.5 官方名为 gpt-image-2.5-flare / gpt-image-2.5-sunburst。

Available options:
gpt-image-2,
gpt-image-2.5-flare,
gpt-image-2.5-sunburst
size
default:1024x1024

尺寸 / 分辨率。可传 ImageResolution 枚举值,或自定义 WxH(如 1280x960)。自定义尺寸须满足以下约束:① 单边 ≤ 3840 px;② 宽、高均为 16 的倍数;③ 长边 : 短边 ≤ 3:1;④ 总像素 ∈ [655 360, 8 294 400]。不满足约束或渠道不支持自定义尺寸时请求将被拒绝。

Available options:
auto,
1024x1024,
1536x1024,
1024x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840
n
number
default:1

生成数量(当前仅支持 1)

Required range: 1 <= x <= 1
quality
enum<string>

质量等级。gpt-image-2:low/medium/high/auto;gpt-image-2.5 额外支持 xhigh/max(Firefly 渠道会落到 high)。

Available options:
auto,
low,
medium,
high,
xhigh,
max,
standard
background
enum<string>

背景透明度

Available options:
transparent,
opaque,
auto
output_format
enum<string>

输出文件格式

Available options:
png,
jpeg,
webp
output_compression
number

JPEG / WebP 的压缩等级 0-100

Required range: 0 <= x <= 100
moderation
enum<string>

审核强度

Available options:
auto,
low
response_format
enum<string>
default:url

响应格式:url 返回图片自家 S3 URL;b64_json 返回 base64。本服务对所有渠道(含 OpenAI gpt-image-* 这种上游强制返 b64 的模型)都会按本字段严格输出,不会两个字段都返回。不传时按 url 处理。

Available options:
url,
b64_json
input_fidelity
enum<string>

输入图保真度(gpt-image-2 新增,仅 edit 场景生效;generate 可忽略)

Available options:
high,
low
image

输入图片,仅接受 http(s):// URL(异步任务约束,不接 base64 / data URL)。提供则走图片编辑;不提供则走文生图。支持单张字符串或数组。如需传 base64,请改用同步接口 /openai/v1/images/generations/openai/v1/images/edits

mask
string<uri>

mask 图片(仅编辑场景,仅接受 http(s):// URL);透明区域将被重绘。如需传 base64,请改用同步接口 /openai/v1/images/edits

Response

200 - application/json

返回 taskId

taskId
string
required

任务 ID,用于后续查询结果