Skip to main content
POST
Generate an image with gemini-2.5-flash-image

同步生成

代表性成功响应中,图片不在第一个 part:

改为异步

请求体不变,只把方法后缀改成 :asyncGenerateContent。保存 HTTP 202 返回的 task_id,再查询 /v1/tasks/{task_id}。实测任务经过 in_progress 后返回 completed 和 1024 × 1024 PNG。

在线测试

本页已经嵌入固定路径 gemini-2.5-flash-image:generateContent 的真实 OpenAPI 试一试 表单。填入开发凭证、确认请求体后即可同步生成,不需要跳转到 API 参考。
在线测试会产生真实费用。Mintlify 会在生成的 cURL 中显示已输入的 Key,请勿分享带凭证的截图。

授权

Authorization
string
header
必填

YingTu API key.

请求体

application/json
contents
Message · object[]
必填

Prompt and optional source image.

Minimum array length: 1
generationConfig
Output settings · object

响应

Complete Gemini response

candidates
object[]
必填
usageMetadata
object
modelVersion
string

The model version that produced the response.

示例:

"gemini-2.5-flash-image"

responseId
string

Provider response identifier.

示例:

"response_example"

createTime
string<date-time>

Creation time when supplied by the selected model channel.