POST /v1/videosmodel 参数区分)。| model 参数 | 说明 |
|---|---|
nano_banana_2 | 标准版,速度快 |
nano_banana_pro-1K | Pro 版,1K 分辨率 |
nano_banana_pro-2K | Pro 版,2K 分辨率 |
nano_banana_pro-4K | Pro 版,4K 分辨率 |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | Bearer YOUR_API_KEY |
| Content-Type | string | 是 | application/json |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型名称,如:nano_banana_2、nano_banana_pro-1K 等 |
| prompt | string | 是 | 文本提示词,最大长度 10000 字符 |
| aspect_ratio | string | 否 | 宽高比,可选值:1:1、9:16、16:9、auto,默认 auto |
| images | string[] | 否 | 参考图片数组(支持 Base64 或 URL),最多 8 张。传此参数为图生图模式,不传或传空数组为文生图模式 |
images 数组元素传法| 方式 | 示例 |
|---|---|
| 图片 URL | "https://example.com/reference.jpg" |
| Base64 | "data:image/jpeg;base64,/9j/4AAQSkZJRg..." |
注意:传入图片 URL 时,网关会自动将其下载并转为 Base64 后发给上游,请确保 URL 为可公网访问的图片直链。
{
"model": "nano_banana_2",
"prompt": "美丽的日出风景,金色的阳光洒在宁静的湖面上,远处是连绵的山脉",
"aspect_ratio": "16:9"
}{
"model": "nano_banana_2",
"prompt": "美丽的日出风景,金色的阳光洒在宁静的湖面上,远处是连绵的山脉",
"aspect_ratio": "16:9",
"images": [
"https://xxxxxxxx.jpg",
"https://xxxxxxxx.png"
]
}| 参数名 | 类型 | 说明 |
|---|---|---|
| id | string | 任务 ID,格式:task_nano_xxx 或 task_xxx |
| object | string | 对象类型,固定值:image |
| model | string | 使用的模型名称 |
| status | string | 任务状态:queued(排队中)、processing(处理中)、completed(已完成)、failed(失败) |
| progress | number | 任务进度,0–100 |
| created | number | 创建时间戳(秒),提 交成功时返回 |
| created_at | number | 创建时间戳(秒),任务失败时返回 |
| completed_at | number | 完成时间戳(秒),仅在 failed 或 completed 状态返回 |
| url | string | 生成的图片 URL(仅在 completed 状态返回) |
| error | object | 错误信息(仅在 failed 状态返回) |
| error.message | string | 失败原因描述 |
| error.code | string | 错误码,如 upstream_error |
{
"id": "task_xxxxxxxxxxxxx",
"object": "image",
"model": "nano_banana_2",
"status": "queued",
"progress": 0,
"created": 1709876543
}{
"id": "task_xxxxxxxxxxxxx",
"object": "image",
"model": "nano_banana_2",
"status": "completed",
"progress": 100,
"created": 1709876543,
"url": "https://example.com/images/xxx.jpg"
}{
"id": "task_xxxx",
"object": "image",
"model": "nano_banana_2",
"status": "failed",
"created_at": 1718123456,
"completed_at": 1718123456,
"progress": 100,
"error": {
"message": "上游任务失败原因",
"code": "upstream_error"
}
}/v1/videos 接口,与视频生成共用;通过 model 参数区分(nano_banana 开头为图片生成)。aspect_ratio、images 为顶层字段,直接放在请求体根对象中。data:image/jpeg;base64,)images 或传空数组 = 文生图images 含图片(URL 或 Base64)= 图生图model 名称后缀决定(如 nano_banana_pro-2K),无需额外传尺寸参数。