> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qingbo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Nano Banana 2.1 经济版

> Nano Banana 2.1 经济线路：文生图与多图参考编辑，按输出分辨率固定张价

Nano Banana 2.1 经济版（`gemini-nano-banana-2.1-rev`）提供 Google Nano Banana 2.1 的文生图和参考图编辑，输出 `1k`、`2k`、`4k` 三档，按成功出图的固定张价结算。与官方版相比，每次请求只出 1 张，`1:4`、`4:1`、`1:8`、`8:1` 四种长条画幅只在 `1k` 可用。需要一次出多张，或按实际 token 用量结算时，用[Nano Banana 2.1](/cn/api-reference/image/gemini/nano-banana-2-1)。

<Note>
  经济版不是 Google 官方 API 线路，两条线路也不会自动互相切换：模型 ID 决定走哪条线路。
</Note>

## 快速开始

<CodeGroup>
  ```bash 文生图 theme={"system"}
  curl -X POST https://api.qingbo.ai/v1/tasks \
    -H "Authorization: Bearer $WAVE_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: nb21-rev-001" \
    -d '{
      "model": "gemini-nano-banana-2.1-rev",
      "action": "generate",
      "prompt": "青瓷茶杯放在原木桌面上，窗边自然光，产品摄影",
      "aspect_ratio": "1:1",
      "resolution": "2k",
      "n": 1
    }'
  ```

  ```bash 参考图编辑 theme={"system"}
  curl -X POST https://api.qingbo.ai/v1/tasks \
    -H "Authorization: Bearer $WAVE_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: nb21-rev-edit-001" \
    -d '{
      "model": "gemini-nano-banana-2.1-rev",
      "action": "edit",
      "prompt": "保留主体，把背景换成清晨的竹林",
      "image_urls": ["https://cdn.example.com/source.png"],
      "aspect_ratio": "auto",
      "resolution": "1k"
    }'
  ```

  ```bash 多图参考 theme={"system"}
  curl -X POST https://api.qingbo.ai/v1/tasks \
    -H "Authorization: Bearer $WAVE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-nano-banana-2.1-rev",
      "action": "edit",
      "prompt": "把第一张的人物放进第二张的场景，光线统一",
      "image_urls": [
        "https://cdn.example.com/person.png",
        "https://cdn.example.com/scene.png"
      ],
      "aspect_ratio": "16:9",
      "resolution": "4k"
    }'
  ```

  ```bash 长条画幅 theme={"system"}
  curl -X POST https://api.qingbo.ai/v1/tasks \
    -H "Authorization: Bearer $WAVE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gemini-nano-banana-2.1-rev",
      "action": "generate",
      "prompt": "水墨风格的江南水乡长卷，从晨雾到黄昏",
      "aspect_ratio": "8:1",
      "resolution": "1k"
    }'
  ```
</CodeGroup>

提交成功后返回 `task_id`。用 [`GET /v1/tasks/{task_id}`](/cn/api-reference/task/status) 查询结果，也可以用 [`Prefer: wait`](/cn/api-reference/task/submit#请求内等待prefer-wait) 在一次调用里等待，或配置 Webhook。

## 请求参数

<ParamField body="model" type="string" required>
  固定为 `gemini-nano-banana-2.1-rev`。
</ParamField>

<ParamField body="action" type="string" default="generate">
  * `generate`：根据文字生成图片
  * `edit`：基于参考图改写；必须提供 `image_urls`

  图生图、多图参考融合都走 `edit`，区别只在 `image_urls` 传几张。
</ParamField>

<ParamField body="prompt" type="string" required>
  图片描述或编辑指令，中英文均可。
</ParamField>

<ParamField body="image_urls" type="string[]">
  参考图片 URL 数组。`edit` 时必填，最多 14 张。参考图不额外收费。
</ParamField>

<ParamField body="aspect_ratio" type="string" default="auto">
  画面比例，14 种固定比例加 `auto`：`auto`、`1:1`、`2:3`、`3:2`、`3:4`、`4:3`、`4:5`、`5:4`、`9:16`、`16:9`、`21:9`、`1:4`、`4:1`、`1:8`、`8:1`。

  `1:4`、`4:1`、`1:8`、`8:1` 只在 `resolution` 为 `1k` 时可用；`2k`、`4k` 下传这四种会返回 `400`。

  `auto` 表示由模型决定：文生图按提示词内容选，图生图跟随输入图的比例。不传时按 `auto` 处理。
</ParamField>

<ParamField body="resolution" type="string" default="1k">
  输出分辨率：`1k`、`2k` 或 `4k`。不支持 `0.5k`，传了会返回 `400`。
</ParamField>

<ParamField body="n" type="integer" default="1">
  生成数量，取值 `1`。每次请求返回一张图。
</ParamField>

通用的 `callback_url`、`callback_events`、`Prefer: wait`、`Idempotency-Key` 和费用上限请求头见[提交任务](/cn/api-reference/task/submit)。

<Warning>
  经济版不支持 `mask_url`、`quality`、`seed`，也不接受 Nano Banana 2 经济版的 `google_search` 与 `google_image_search`。以上之外的参数会返回 `400`，不计费。需要掩码局部重绘时用 [`gpt-image-2`](/cn/api-reference/image/gpt-image/gpt-image-2)。
</Warning>

## 限制

| 条件 | 限制 |
| - | - |
| 每次请求 | 每次请求返回 1 张图。 |
| `action: "edit"` | 编辑图片需要至少一张参考图 |
| `resolution` 为 `2k` 或 `4k` | 2K 和 4K 不支持 1:4、4:1、1:8、8:1 画幅。 |
| 参考图张数 | 最多 14 张 |

## 计费

按成功出图的**固定张价**结算，`1k`、`2k`、`4k` 三档各一个单价。`generate` 与 `edit` 同价，参考图不加价，画幅和提示词长度都不影响价格——**分辨率是唯一的计费维度，提交前即可确定单次费用**。不传 `resolution` 时按默认的 `1k` 出图，并按 `1k` 档计费。

<Note>
  单价见 `GET /v1/models` 返回的 `price_config`，或控制台「模型市场」。`price_config.image_prices` 按 `1k`、`2k`、`4k` 分键，`default` 是未命中分辨率键时的兜底价。

  单次调用的实际花费见任务响应里的 `cost`：整数 quota，500,000 quota = 1 USD，不是美元。
</Note>

只有成功出图才计费。任务失败、取消，或没有返回可用图片时，全额退款。

## 响应

```json 任务完成 theme={"system"}
{
  "task_id": "task-wave1791564844b950000002",
  "model": "gemini-nano-banana-2.1-rev",
  "action": "edit",
  "status": "completed",
  "progress": "100%",
  "created_at": 1791564844,
  "completed_at": 1791564894,
  "billing_status": "settled",
  "cost": 14063,
  "result": {
    "images": [
      {
        "expires_at": 1792169694,
        "url": ["https://cdn.example.com/result.jpg"]
      }
    ]
  },
  "urls": {
    "get": "https://api.qingbo.ai/v1/tasks/task-wave1791564844b950000002",
    "cancel": "https://api.qingbo.ai/v1/tasks/task-wave1791564844b950000002/cancel"
  }
}
```

`result.images` 返回生成的图片，`url` 是数组，`expires_at` 是图片链接的过期时间戳。完整字段说明见[查询任务状态](/cn/api-reference/task/status)。

## 与官方线路的区别

| | 经济版 | [官方版](/cn/api-reference/image/gemini/nano-banana-2-1) |
| - | - | - |
| 模型 ID | `gemini-nano-banana-2.1-rev` | `gemini-nano-banana-2.1` |
| 计费 | 按分辨率固定张价 | 按实际 token 用量 |
| 每次输出 | 1 张 | 1–4 张 |
| `1:4` `4:1` `1:8` `8:1` | 只在 `1k` 可用 | `1k` `2k` `4k` 都可用 |
| 参考图 | 最多 14 张，不加价 | 最多 14 张，按图片输入 token 计费 |

两者的动作、分辨率档位（`1k` `2k` `4k`）和其余画幅相同。

## 相关文档

* [Gemini 图像系列](/cn/api-reference/image/gemini/overview)
* [Nano Banana 2.1](/cn/api-reference/image/gemini/nano-banana-2-1)
* [Nano Banana 经济版](/cn/api-reference/image/gemini/nano-banana-rev)
* [提交任务](/cn/api-reference/task/submit)
* [查询任务状态](/cn/api-reference/task/status)
* [任务系统](/cn/docs/task-system)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.