> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/compute/aig/image-edit/nano-banana-image-edit.md).

# Nano Banana (Google Gemini Image)

## 1.概述

google推出的文生图/图生图模型。

{% hint style="success" %}
本 API 与 OpenAI 接口格式兼容。
{% endhint %}

**模型列表：**

* `gemini-2.5-flash-image` (Nano-Banana)
* `gemini-3-pro-image` (Nano-Banana-Pro)
* `gemini-3.1-flash-image` (Nano-Banana-2)

{% hint style="warning" %}
本模型为多模态模型，描述需要明确包含绘制的画面或明确要求绘图，简单字词可能无图片输出。
{% endhint %}

## 2. 请求说明

* **请求方法**:`POST`
* **请求地址**:

  > `https://gateway.theturbo.ai/v1/images/edits`

***

## 3.请求参数

### 3.1 Head参数

| 参数名称            | 类型     | 必填 | 说明                                        | 示例值                                                                            |
| --------------- | ------ | -- | ----------------------------------------- | ------------------------------------------------------------------------------ |
| `Content-Type`  | string | 是  | 设置请求头类型，必须为`multipart/form-data`          | `multipart/form-data; boundary=------------------------y0QNRDhXQUE3yHQi7DEbLz` |
| `Accept`        | string | 是  | 设置响应类型，必须为 `application/json`             | `application/json`                                                             |
| `Authorization` | string | 是  | 身份验证所需的 API\_KEY，格式`Bearer $YOUR_API_KEY` | `Bearer $YOUR_API_KEY`                                                         |

### 3.2 Body 参数 (multipart/form-data)

| 参数名称              | 类型              | 必填 | 说明                                                                                                   | 示例值(默认值)                 |
| ----------------- | --------------- | -- | ---------------------------------------------------------------------------------------------------- | ------------------------ |
| **model**         | string          | 是  | 要使用的模型 ID。详见概述列出的可用版本，如 gemini-2.5-flash-image。                                                      | `gemini-2.5-flash-image` |
| **prompt**        | string          | 是  | 一段描述所需图像的文字。（本模型为多模态模型，描述需要明确包含绘制的画面或明确要求绘图，简单字词可能无图片输出）                                             | `A cute baby sea otter`  |
| **image**         | file/file array | 否  | `gemini-2.5-flash-image` 最多可接受 3 张图片作为输入，而 `gemini-3-pro-image-preview` 最多可接受 14 张图片，其中 5 张图片可实现高保真度 |                          |
| aspect\_ratio     | string          | 否  | 要生成的图片的宽高比。支持的宽高比:`1:1`、`2:3`、`3:2`、`3:4`、`4:3`、`4:5`、`5:4`、`9:16`、`16:9` 或 `21:9`。                  |                          |
| image\_size       | string          | 否  | 指定生成的图片的大小,支持的值为 1K、2K、4K                                                                            | `1K`                     |
| media\_resolution | string          | 否  | 输入媒体的媒体分辨率 `MEDIA_RESOLUTION_LOW` `MEDIA_RESOLUTION_MEDIUM` `MEDIA_RESOLUTION_HIGH`                  |                          |

## 4.请求示例

{% tabs %}
{% tab title="单图片" %}

```http
curl -X POST https://gateway.theturbo.ai/v1/images/edits \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F model="gemini-2.5-flash-image" \
	-F image="@input.png" \
	-F prompt="A cute baby sea otter wearing a beret" \
	-F 其他参数
```

{% endtab %}

{% tab title="多图片" %}

```sh
curl -X POST https://gateway.theturbo.ai/v1/images/edits \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F model="gemini-2.5-flash-image" \
	-F image[]="@input1.png" \
	-F image[]="@input2.png" \
	-F prompt="A cute baby sea otter wearing a beret" \
	-F 其他参数
```

{% endtab %}
{% endtabs %}

## 5.响应示例

```json
{
	"created": 1589478378,
	"data": [
		{
			"b64_json": "..."
		},
		{
			"b64_json": "..."
		}
	]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/cn/compute/aig/image-edit/nano-banana-image-edit.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
