gpt-image-2
Submit an async gpt-image-2 image generation task. Returns a task_id to poll via the status endpoint.
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
application/json
model*string
模型名,固定为 gpt-image-2。
prompt*string
图片描述(必填,非空)
size?string
输出尺寸。支持指定宽高比、像素尺寸或 auto。
image?string
单张参考图 URL(与 images 二选一或合并使用)
images?array<string>
多张参考图 URL,最多 16 张。
Items
items <= 16n?integer
生成数量。
Range
1 <= value <= 4quality?string
图片质量。
Value in
"low" | "medium" | "high"resolution?string
输出分辨率。
Value in
"1K" | "2K" | "4K"mask_url?string
编辑模式蒙版 URL(需配合 image)。
model_params?object
模型扩展参数。
[key: string]?any
callback_url?string
任务终态时由平台主动 POST 的 HTTPS 回调地址(可选)
Format
uri[key: string]?never
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.apimp.ai/api/generate/submit" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "A red panda riding a skateboard, cinematic lighting" }'{
"code": 200,
"data": {
"task_id": "task_0VDknz6qRwvH5Y5aDAt6mN8pRShzLb6X",
"status": "not_started",
"created_time": "2026-06-18T09:21:26",
"error_message": null
}
}{
"code": 400,
"error": {
"message": "field `prompt` is required",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "string",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "string",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "string",
"type": "invalid_request_error"
}
}{
"code": 400,
"error": {
"message": "string",
"type": "invalid_request_error"
}
}How is this guide?
Last updated on