Gemini Image Generation
POST
/v1beta/models/{model}:{generateContent}Generate or transform images with the Gemini-compatible generateContent format.
Path Parameters
model:requiredstringGemini image model. The documented default is gemini-3-pro-image-preview; the request example uses gemini-3.1-flash-lite-image.
Example
gemini-3.1-flash-lite-imagegenerateContent:requiredenum<string>Gemini-compatible generation action. Use generateContent for non-streaming output or streamGenerateContent for streaming output.
Allowed
streamGenerateContentgenerateContentExample
generateContentHeader Parameters
Authorization:optionalstringBearer authentication header containing your API key.
Example
Bearer {{key}}Content-Type:optionalstringMedia type of the request body.
Example
application/jsonRequest Body
application/jsongenerationConfig:optionalobjectGeneration settings for the request.
contents:requiredarrayGemini-compatible content payload.
Response
200A successful request returns a JSON response. The complete example is shown in the code panel.