Picture Editor
Photo editing API is used to modify images based on uploading pictures and prompt, suitable for changing background, local modifications, style alignment and commodity chart processing. Whether or not to support editing based on the description of the selected image model, the GPT Image series is usually used as a priority.
API Path
| Methodology | Path | Returns by |
|---|---|---|
POST | /v1/images/edits | synchronous returns the edit photo result. |
POST | /v1/images/edits/async | Returns task ID first, then queryes the editing results. |
Example request
bash
curl https://moonnexai.com/v1/images/edits \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-F "image=@./product.png" \
-F "model=gpt-image-2-pro" \
-F "prompt=Change the background to a clean studio scene." \
-F "size=1024x1024"Common field
| field | Annotations |
|---|---|
image | Enter the picture file. |
model | Picture model name, for example, gpt-image-2-pro. |
prompt | Edits the description of the target. |
mask | Monued file, based on API Reference. |
size | Output size. |
Results-based processing
| scene | Treatment |
|---|---|
| Commodity Chart Edit | Saves original, edits prompt and results. |
| Local changes | synchronous saves information about mask files or mask sources. |
| Failed to retry | Re-submit the original file and the request parameter. |
| asynchronous Edit | Saves id, polling GET /v1/images/tasks/{task_id}, successfully read data[].url. |
Access Recommendations
- Enter the picture to be clear and the main edge as complete as possible.
- For local changes, write in the programt to clear the contents and modify the area.
- Use synchronous
/v1/images/editswhen uploading local picture files; Picture Step Task is available when entering a public web URL or Base64 image content. - When you need a stable re-use, look at Uploads and assets first.