gemini-2.5-flash-image — Cannot reliably control number of output images per single API call

Hi team,

We are building a marketplace listing image generator SaaS using gemini-2.5-flash-image via the Google GenAI SDK. Our use case requires generating exactly 5 separate, distinct images per request based on a seller’s uploaded product photo — each image serving a different purpose (hero shot, detail close-up, lifestyle, feature highlight, action shot).


THE PROBLEM

When we send a single API call asking the model to generate 5 separate images, the output is inconsistent and unpredictable:

  • Sometimes returns all 5 images correctly
  • Sometimes returns only 1, 2, or 3 images
  • Sometimes merges all 5 concepts into a single combined image
  • Behavior varies between calls even with an identical prompt and reference image

PARAMETERS WE HAVE ALREADY TRIED

candidateCount=6 in GenerateContentConfig → INVALID_ARGUMENT error
number_of_images=5 in GenerateImagesConfig → INVALID_ARGUMENT error
generation_config: {“candidateCount”: 2} as dict → Not supported on this model
Prompt explicitly asking for 5 separate images sequentially → Inconsistent, works sometimes
Interleaved text + image prompt pattern → Slightly better but still unstable
Prompt with “generate sequentially, label each image” → Slightly better but still unstable


OUR SPECIFIC QUESTIONS

  1. Is there a supported prompt pattern or structure that can reliably instruct gemini-2.5-flash-image to return a specific, stable number of separate images in a single API call?

  2. Is there a planned fix or timeline for stable multi-image output support on this model?

  3. Would switching to a different model (e.g. gemini-3.1-flash-image-preview) resolve this issue, or does the same limitation apply across all image generation models?

  4. Are there any alternative methods or approaches within the Google ecosystem that you would recommend to reliably generate multiple distinct images from a single prompt and reference image?


OUR ENVIRONMENT

Model: gemini-2.5-flash-image
SDK: Google GenAI Python SDK (google-genai)
Backend: PHP / Yii2 (calling via REST API)
Use case: Multi-image listing set generation for marketplace sellers
Reference: python-genai GitHub Issue #1534

Thank you for your time. Any guidance — whether a prompt structure, a supported parameter, or a fix timeline — would be greatly appreciated as this directly impacts our production pipeline.