Gemini Image Generation
gemini-3.1-flash-image-previewreturnedinlineDatawhen called withresponseModalities: ["IMAGE"]gemini-3-pro-image-previewreturnedtextcontaining a Markdown image with adata:image/...;base64,...payloadgemini-2.5-flash-imagealso returnedtextcontainingdata:image/...;base64,...gemini-2.5-flash-image-previewreturnedtextcontaining a hosted image URL
If you are migrating from the Nano Banana family, do not keep using
/v1/images/generations. nano-banana-2 should now move directly to gemini-3.1-flash-image-preview:generateContent. nano-banana can return image output through gemini-2.5-flash-image:generateContent, but billing consistency is still under review.Most Practical Current Example
For the specific goal of getting image bytes directly, the easiest current model to handle isgemini-3.1-flash-image-preview:
Other Observed Output Shapes
The same-day production check also showed these model-specific differences:gemini-3-pro-image-preview:parts[0].textlooked likegemini-2.5-flash-image:parts[0].textlooked likegemini-2.5-flash-image-preview:parts[0].textlooked like
- Check
inlineDatafirst - Then check whether
textcontainsdata:image/ - Then check whether
textcontains a hosted image URL
This page no longer keeps aspect-ratio or multi-image parameter guidance, because those parameters were not revalidated in this production pass.