Gemini Image Generation

POST/v1beta/models/{model}:{generateContent}
Generate or transform images with the Gemini-compatible generateContent format.

Path Parameters

model:requiredstring

Gemini image model. The documented default is gemini-3-pro-image-preview; the request example uses gemini-3.1-flash-lite-image.

Examplegemini-3.1-flash-lite-image
generateContent:requiredenum<string>

Gemini-compatible generation action. Use generateContent for non-streaming output or streamGenerateContent for streaming output.

AllowedstreamGenerateContentgenerateContent
ExamplegenerateContent

Header Parameters

Authorization:optionalstring

Bearer authentication header containing your API key.

ExampleBearer {{key}}
Content-Type:optionalstring

Media type of the request body.

Exampleapplication/json

Request Body

application/json
generationConfig:optionalobject

Generation settings for the request.

contents:requiredarray

Gemini-compatible content payload.

Response

200

A successful request returns a JSON response. The complete example is shown in the code panel.