Skip to main content
POST
Image generation

Query Parameters

key
string
required

API key

Body

application/json
contents
object[]
required

Array of conversation turns. Each turn includes role and parts. A part can be a text prompt or inline_data Image (base64). To use a reference image, pass both text and inline_data in the same parts array.

Example:
generationConfig
object
required

Response

Image generated successfully

candidates
object[]
usageMetadata
object