> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yingtu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Synchronous image generation

> Use Gemini-native generateContent when the client can wait for the complete Nano Banana response.

Call the standard Gemini-native method when your client can keep one connection
open until generation finishes:

```http theme={"system"}
POST /v1beta/models/{model}:generateContent
```

The model ID is part of the path. The body contains `contents` and optional
`generationConfig`; there is no top-level YingTu envelope.

Choose the model and supported size before deciding that synchronous execution
fits. A Pro 4K response can be much larger and slower than a Lite 1K response;
the HTTP method does not remove those differences.

## When synchronous fits

Use this method for interactive tools, server actions, and simple integrations
where the request timeout comfortably exceeds image-generation time. The HTTP
response contains the final Gemini `candidates` array.

<Warning>
  A short client or proxy timeout can terminate the connection before the image
  arrives. Use the asynchronous task method when the caller cannot safely hold
  the connection.
</Warning>

## Read the result safely

`content.parts` may contain text and image parts in different positions. Find
every part with `inlineData`; do not index the array by a fixed position. Use
`inlineData.mimeType` to decide how to save the Base64 bytes.

<Card title="Open the synchronous Playground" icon="play" href="/en/api-reference/generate-content">
  Inspect model, body, authentication, and response schemas.
</Card>

<Card title="Choose a Nano Banana model" icon="columns-3" href="/en/models/image/nano-banana/comparison">
  Match resolution and price to the job before sending the request.
</Card>
