Nano Banana 2 Lite
接口
POST /images/generations
完整 URL: https://modelfold.ai/v1/images/generations
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。
图像生成任务的输入参数。
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于生成任务的模型名称。该字段为必填项。此接口必须使用 nano-banana-2-lite 模型。 默认值:"nano-banana-2-lite"。 可选值:nano-banana-2-lite。 示例:nano-banana-2-lite。 |
image_urls | array<string> | 否 | 输入图片 URL 数组。可选参数。如需纯文生图,可设置为空数组或不传该字段。最多支持 10 张图片。 - 请提供上传后文件的 URL,而非文件内容 - 支持类型: image/jpeg、image/png、image/webp- 最大文件大小:30.0MB 默认值: []。 maxItems: 10. |
prompt | string | 是 | 本站网关要求传入 prompt,最长 2000 字。用于生成图像的文本提示词。必填。最大长度:20000 字符。 maxLength: 2000. 示例:Generate a pig on the grass, cinematic light。 |
aspect_ratio | string | 是 | 必填。输出图像宽高比,传 auto 由模型自行决定。 可选值:1:1 / 1:4 / 1:8 / 2:3 / 3:2 / 3:4 / 4:1 / 4:3 / 4:5 / 5:4 / 8:1 / 9:16 / 16:9 / 21:9 / auto。 示例:auto。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2-lite",
"prompt": "Generate a pig on the grass, cinematic light",
"aspect_ratio": "auto",
"image_urls": [
"https://example.com/reference.png"
]
}'json
{
"model": "nano-banana-2-lite",
"prompt": "Generate a pig on the grass, cinematic light",
"aspect_ratio": "auto",
"image_urls": [
"https://example.com/reference.png"
]
}响应
200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}