Create a new 4o Image(gpt image 1) generation task. Generated images are stored for 14 days, after which they expire.
All APIs require authentication via Bearer Token.
Get API Key:
Usage: Add to request header: Authorization: Bearer YOUR_API_KEY
Note:
(Required) Aspect ratio of the generated image. Must be one of the listed values.
1:1, 3:2, 2:3 "1:1"
(Optional) Text prompt that conveys the creative idea you want the 4o model to render. Required if neither filesUrl nor fileUrl is supplied. At least one of prompt or filesUrl must be provided.
"A beautiful sunset over the mountains"
(Optional) Up to 5 publicly reachable image URLs to serve as reference or source material. Use this when you want to edit or build upon an existing picture. If you don’t have reliable hosting, upload your images first via our File Upload API quick‑start: https://docs.kie.ai/file-upload-api/quickstart. Supported formats: .jfif, .pjpeg, .jpeg, .pjp, .jpg, .png, .webp. At least one of prompt or filesUrl must be provided.
[
"https://example.com/image1.png",
"https://example.com/image2.jpg"
](Optional) How many image variations to produce (1, 2, or 4). Each option has a different credit cost—see up‑to‑date pricing at https://kie.ai/billing. Default is 1.
1, 2, 4 1
(Optional) Mask image URL indicating areas to modify (black) versus preserve (white). The mask must match the reference image’s dimensions and format (≤ 25 MB). When more than one image is supplied in filesUrl, maskUrl is ignored.
Example:

In the image above, the left side shows the original image, the middle shows the mask image (white areas indicate parts to be preserved, black areas indicate parts to be modified), and the right side shows the final generated image.
"https://example.com/mask.png"
The URL to receive 4o image generation task completion updates. Optional but recommended for production use.
"https://your-callback-url.com/callback"
(Optional) Enable prompt enhancement for more refined outputs in specialised scenarios (e.g., 3D renders). Default false.
false
(Optional) Choose the upload region. true routes uploads via China servers; false via non‑China servers.
false
(Optional) Activate automatic fallback to backup models (e.g., Flux) if GPT‑4o image generation is unavailable. Default false.
false
(Optional) Specify which backup model to use when the main model is unavailable. Takes effect when enableFallback is true. Available values: GPT_IMAGE_1 or FLUX_MAX. Default value is FLUX_MAX.
GPT_IMAGE_1, FLUX_MAX "FLUX_MAX"
(Optional, Deprecated) File URL, such as an image URL. If fileUrl is provided, 4o image may create based on this image. This parameter will be deprecated in the future, please use filesUrl instead.
"https://example.com/image.png"
Request successful
Response Status Codes
200, 400, 401, 402, 404, 422, 429, 455, 500, 550 Error message when code != 200
"success"