Skip to content

Picture Generation ​

The image-generation API creates images from text prompts, including product images, posters, sketches, covers and marketing visuals. Common models include gpt-image-2, gpt-image-2-pro, doubao-seedream-5-0-260128 and grok-imagine-image.

API Path ​

MethodologyPathReturns by
POST/v1/images/generationssynchronous returns the photo result or picture response.
POST/v1/images/generations/asyncReturns task ID first, then query the results of the picture.

Example request ​

bash
curl https://moonnexai.com/v1/images/generations \
  -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
  }'

Common field ​

fieldAnnotations
modelPhoto model names, e.g. gpt-image-2, doubao-seedream-5-0-260128, grok-imagine-image.
promptPicture description.
sizeOutput size, e.g. 1024x1024.
nGenerates the quantity.
response_formatreturns the format, which is based on API Reference.

Results-based processing ​

sceneTreatment
Return picture URLSaves URLs, prompts, model names and dimensions.
Return picture contentFirst, you can save access to the business file storage and then you can save the address.
Batch GenerationStaples each chart and the parameters for generation in the order of return.
asynchronous GenerationSaves id, polling GET /v1/images/tasks/{task_id}, successfully read data[].url.

Access Recommendations ​

  • Prompt proposes to include the subject, scene, style, aspect ratio and use.
  • Saves the prompt, model name, size and result URLs when the batch is generated.
  • Synchronous endpoints wait for completion. For long tasks or to avoid a persistent connection, use asynchronous image tasks.
  • Use Picture Editor when changing based on a picture already available.

Relevant Pages ​