GPT Image asynchronous Call
The GPT Image asynchronous API suits long generations, clients that cannot keep an HTTP connection open and background processing. Submission returns a MoonNexAI task ID; query it for status and the final image URL.
This page only indicates that asynchronous calls. Use GPT Image Synchronize Call when waiting in the same HTTP request and directly obtaining the results.
asynchronous entrance
| Capacity | Path | Annotations |
|---|---|---|
| Picture asynchronous Generation | /v1/images/generations/async | Submits the prompt and returns task ID. |
| Photo asynchronous Edit | /v1/images/edits/async | Submits the edit task with JSON image URL or Base64 Data URL. |
| Query task | /v1/images/tasks/{task_id} | Query status, progress, error and successful results. |
| Get Content | /v1/images/tasks/{task_id}/content | Successfully, get the first result picture. |
The actual available model, single or multi-chart capability, number and size of pictures are based on the current API Key grouping and model capabilities.
asynchronous Photo Generation
curl https://moonnexai.com/v1/images/generations/async \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A clean product mockup on a white studio table.",
"size": "1024x1024",
"n": 1
}'Photo Editor for asynchronous
asynchronous Photo Editor uses a single image field: Single-map transfer string. Current grouping and models support multi-map string arrays.
Single Chart URL:
curl https://moonnexai.com/v1/images/edits/async \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "保留人物、姿势和服装,把画面改成水彩插画。",
"image": "https://example.com/reference.png",
"size": "1024x1024",
"n": 1
}'Multitext URL:
curl https://moonnexai.com/v1/images/edits/async \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "保留第一张图的主体和构图,参考第二张图的色彩与细节。",
"image": [
"https://example.com/subject.png",
"https://example.com/style.png"
],
"size": "1024x1024",
"n": 1
}'Photo URLs must be downloaded directly from the public network. It is recommended to use HTTPS addresses with real .png, .jpg or .webp suffixes, no login, no additional request headers and no short-term signatures. Base64 Enter a full Data URL, e.g. data:image/png;base64,....
quality is an optional field. Use the default quality behaviour of the selected model when it is not passed; it is visible only when it is confirmed that the current model supports the target quality slotting. The quality values that different models support may differ, and do not write quality to express "default quality".
Edit field
| field | Annotations |
|---|---|
model | It is to be filled. The current GPS Image model name is available for the API Key group. |
prompt | It is. Writes the content to be retained, the area to be modified and the target effect. |
image | Always fill in the editing. Pass a picture URL/Data URL string or a string array when multigraphs are supported. |
size | Optional. Output size, based on the range of support for the selected model. |
quality | Optional. Output quality slotting; use model default behaviour when omitted, with the visible value being the range supported by the selected model. |
n | Optional. Generate the quantity, which is based on the model and the range of account available. |
Content security and failure management
Input images and prompts must pass content checks. A task may be rejected because of an image, a person or body description, or other prompt content. Such rejection does not establish that image URLs, multiple images or the asynchronous API are unsupported.
When the query result is status=failed, read error.message and adjust the picture or prompt to the hint to create a new task. Failure task does not result in URLs, does not continue with polling and task, nor treats content security errors as downloads or network errors.
Submit response
Saves id in response after submitting successfully. Do not consider queued or running as a success.
{
"id": "task_xxx",
"object": "image.edit",
"created": 1711234567,
"status": "queued",
"progress": 0,
"model": "gpt-image-2"
}Query task
curl https://moonnexai.com/v1/images/tasks/task_xxx \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>"When searching, the following order is followed:
- Check
statusfirst. status=failedreadserrorand does not continue to wait for the result URL.status=queuedorrunningcontinues with polling and uses reasonable search interval.data[].urlis read only whenstatus=succeededis available.
Example of success response:
{
"id": "task_xxx",
"object": "image.edit",
"created": 1711234567,
"status": "succeeded",
"progress": 100,
"model": "gpt-image-2",
"data": [
{
"url": "https://moonnexai.com/assets/public/v2/example/generated-image.png"
}
]
}Asynchronous image results are always stored as URLs in the task result. To download the first image, request /v1/images/tasks/{task_id}/content and handle the response or redirect using standard HTTP behavior.