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
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.