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

# YingTu Nano Banana API

> 从四个已实测 Nano Banana 模型中完成选型，并用 Gemini 原生同步或异步接口生成、编辑图片。

接入 YingTu Nano Banana API 的第一步不是复制请求，而是选对模型。当前四个模型共用
Gemini 原生结构，但价格、尺寸和适用任务不同。

<CardGroup cols={2}>
  <Card title="先比较模型" icon="columns-3" href="/cn/models/image/nano-banana/comparison">
    根据价格、尺寸、迁移成本和任务价值选择模型 ID。
  </Card>

  <Card title="直接发送请求" icon="rocket" href="/cn/getting-started/quickstart">
    使用通用 Nano Banana 2 完成第一次生成。
  </Card>
</CardGroup>

## 同步还是异步

调用方能维持长连接时使用 `:generateContent`；任务需要脱离当前连接继续执行时，使用
`:asyncGenerateContent`，保存 HTTP `202` 返回的任务 ID，再查询
`/v1/tasks/{task_id}`。

<Info>
  YingTu 异步方法与同步方法使用相同请求体。它不是 Google Batch API，也不是 SDK 中
  仅使用 async/await 的普通异步函数。
</Info>

## 解析结果时不要做假设

四个模型都已完成同步、异步和图片编辑实测。响应可能先返回文字再返回图片，也可能只有
图片；本次既有 PNG 也有 JPEG。请遍历 `parts` 并读取实际 `inlineData.mimeType`。

<CardGroup cols={2}>
  <Card title="同步调用" href="/cn/unified-api/synchronous-generation">在一个连接中取得完整结果。</Card>
  <Card title="异步任务" href="/cn/unified-api/async-tasks">提交任务并按状态安全轮询。</Card>
</CardGroup>
