Supported models
Only the following models support generating and editing images in chat:gemini-nano-banana-2.1gemini-3.1-flash-lite-imagegemini-3.1-flash-imagegemini-3-pro-imagegemini-2.5-flash-imagegpt-4o-imagegpt-5-allmidjourney-chat
This guide covers the basics. For Gemini-specific instructions, see the Gemini image generation guide.
Generate an image
Send an image generation request just like a regular text chat request:gpt-4o-image, gpt-5-all, and midjourney-chat support streaming output. Gemini models do not stream image output, but they support background mode.
The image.url field contains the generated image URL. Display the image from that URL, or pass content directly to a component that renders Markdown:
Edit an image
To generate an image from another image or edit an existing image, include it in an image chat request:url property of image_url accepts a valid image URL or Base64-encoded image data.
If Gemini does not return an image
If a Gemini image generation model does not return an image, try the following:- Set a system prompt: Explicitly instruct the model to draw, for example:
You are an AI image generator. Draw the image the user requests.. - Set the request parameter: Set
image_generationtotrueto require image generation.
Use the Responses API
OpenAI’s Responses API offers an image generation tool for generating and editing images in chat. It supports models beyondgpt-4o and offers more parameters. See image generation with the Responses API.