Skip to main content
POST
Generate an image synchronously (billable)
Use this operation when the caller can hold one connection until the complete Gemini response arrives. The generic schema contains the union of family sizes and aspect ratios. Before sending a request, open the selected model’s Parameters page: 2.5 must omit imageSize, Lite accepts only 1K, and only Flash exposes the extended 1:4, 4:1, 1:8, and 8:1 ratios.
Try it sends a real, potentially billable browser-direct request. Use a development key, confirm the model and size, and do not share generated cURL output that contains the key.

Choose a model

Review lifecycle, output tier, and relative cost first.

Use the synchronous workflow

Plan timeouts and scan every returned Part.

Handle API errors

Distinguish invalid input, credentials, balance, rate limit, and server failure.

Authorizations

Authorization
string
header
required

YingTu API key.

Path Parameters

model
enum<string>
required

Current public image model ID.

Available options:
gemini-2.5-flash-image,
gemini-3.1-flash-lite-image,
gemini-3.1-flash-image,
gemini-3-pro-image,
gpt-image-2-web,
gpt-image-2-vip

Body

application/json
contents
Prompt and input · object[]
required

Messages sent to the model.

Minimum array length: 1
tools
object[]

Optional Gemini tools. Availability depends on the selected image model.

toolConfig
object

Configuration for tools declared in tools.

safetySettings
object[]
systemInstruction
object
cachedContent
string

Optional cached content resource name when supported by the selected model.

generationConfig
Output settings · object

Response

Complete Gemini response

candidates
object[]
required
promptFeedback
object
usageMetadata
object
modelVersion
string

The model version that produced the response.

Example:

"gemini-3.1-flash-image"

responseId
string

Provider response identifier.

Example:

"response_example"

createTime
string<date-time>

Creation time when supplied by the selected model.

Last modified on September 2, 2026