Skip to main content
POST
Generate an image with gemini-3.1-flash-lite-image
本次实测响应的核心结构如下:
异步调用只更换 URL 后缀。实测提交返回 HTTP 202,第四次查询得到 completed 和同样的 1K PNG 结果。不要根据轮询次数设置固定超时。 调用方受反向代理超时限制,或需要在用户离开页面后继续生成时,再选择异步方式; 普通服务端工具能够等待完整结果时,同步调用更容易实现和排查。 图片编辑沿用相同 endpoint:在提示词 part 后加入来源图片的 inlineData,保留真实 MIME,并继续使用 imageSize: "1K"。读取结果时遍历全部 parts,不要把 PNG 或 parts[0] 写成固定假设。完整字段说明见参数页

在线测试

本页 OpenAPI 面板固定使用 gemini-3.1-flash-lite-image:generateContent,并预填有效的 1K 请求体。填入开发凭证后, 可直接点击 试一试,无需离开示例页。
试一试会真实计费。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-3.1-flash-lite-image"

responseId
string

Provider response identifier.

示例:

"response_example"

createTime
string<date-time>

Creation time when supplied by the selected model channel.