Skip to navigation

Media · Generate · Generate AI image

View as Markdown

Generate an AI image from a prompt, optionally guided by reference images. One call: POST {model, parameters} (capability is optional). It blocks and returns the final result — do not call getTaskResult. Use the field names below as-is for every model; the server adapts the payload to the model you chose. If something does not fit that model (a ratio it lacks, too many references for the mode), the error says exactly what to change.

storage controls where the result is kept:

  • “asset” — saved to your asset library for reuse (recommended)
  • “transient” — temporary, not saved
  • “default” — kept in the image gallery

Authentication

AuthorizationApi-Key

Header authentication of the form Api-Key <token>

OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelstringRequiredDefaults to google.gemini-3.1-flash-image

Model to generate with. A caller that names only a provider ("use OpenAI") takes that family's recommended id, which is the one listed first for the family. Registered ids: flux.flux-realism (Flux Pro), flux.flux-kontext-pro (Flux Kontext Pro — image editing), flux.flux-kontext-max (Flux Kontext Max — image editing), flux.flux-1.1-pro-ultra (Flux Pro Ultra), flux.flux-2-pro (Flux 2 Pro), recraft.recraft (ReCraft V3), ideogram.ideogram-v3-turbo (Ideogram V3 Turbo), ideogram.ideogram-v4 (Ideogram 4.0, text-to-image only), google.gemini-3.1-flash-image (Gemini 3.1 Flash Image — recommended for Google), google.gemini-3-pro-image (Gemini 3 Pro Image — complex design, dense text, 4K), google.gemini-3.1-flash-lite-image (Gemini 3.1 Flash Lite Image), openai.imgen-2.5-flare (GPT Image 2.5 Flare — recommended for OpenAI), openai.imgen-2.5-sunburst (GPT Image 2.5 Sunburst), openai.imgen-2 (GPT Image 2 — previous generation, still served), qwen.qwen-image (Qwen Image), qwen.qwen-image-edit (Qwen Image Edit — image editing), bytedance.seedream-4 (SeedDream 4), bytedance.seedream-4.5 (SeedDream 4.5), bytedance.seedream-5-pro (Seedream 5 Pro).

parametersobjectRequired

The generation payload — what the AI model needs to produce the image. Always a nested object: prompt, aspect_ratio, count and reference_images live HERE, never at the top level. Only prompt is required. Use these field names as-is for every model.

storageenumRequiredDefaults to asset

"asset" saves as a persistent TldrAsset (recommended — no expiry, visible in asset library). "transient" generates without saving to database (temporary URL, expires). "default" persists to AiImageArt gallery.

Allowed values:
capabilityenumOptional

Generation mode. Optional — when omitted it follows parameters.reference_images: none → prompt, one → reference_image, several → multiple_images. Not where the prompt text goes (that is parameters.prompt).

  • "prompt" → text-to-image
  • "reference_image" → image-to-image guided by one reference
  • "multiple_images" → one image composed from several references. This is not "generate several images" — use parameters.count.
Allowed values:

Response

Generation task accepted — returns task_id (and asset data if storage=asset); the tool waits for it

Errors

400
Bad Request Error
401
Unauthorized Error
429
Too Many Requests Error