> ## 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.

# 异步图片任务

> 使用 asyncGenerateContent 提交 Gemini 原生 Nano Banana 请求，并在稍后获取结果。

YingTu 在 Gemini 原生图片请求格式上提供异步方法：

```http theme={"system"}
POST /v1beta/models/{model}:asyncGenerateContent
```

它与同步 `generateContent` 使用相同的 `contents` 和 `generationConfig` 请求体。
提交成功后立即返回 HTTP `202`：

模型和尺寸在任务创建时就已确定。异步只改变连接生命周期，不改变价格、分辨率或模型能力。

```json theme={"system"}
{
  "task_id": "task_01JY8K6M6B4YQ3R8H4T6V2Z1AB",
  "status": "queued",
  "created_at": 1788307200
}
```

## 获取任务

保存 `task_id`，然后调用：

```http theme={"system"}
GET /v1/tasks/{task_id}
```

```text theme={"system"}
queued → in_progress → completed
                      ↘ failed
```

只有 `completed` 和 `failed` 是终态。任务完成后，`result` 中包含 Gemini 原生结果结构。

2026 年 9 月 2 日实测中，提交响应为 `queued`；首次查询时任务已经是
`in_progress`，`progress` 为 `"30%"`；最终查询返回 `completed` 和
`"100%"`。进度只应作为状态提示，不要假设固定百分比或固定转换顺序。

## 任务边界

* 只有创建任务的 YingTu 账号可以查询该任务。
* 当前流程没有取消接口、回调 URL 或客户端幂等键。
* 客户端断开连接不会取消已受理的任务。
* 失败或超时的任务会退款。
* 图片结果以 Base64 返回；完成后应转存到你控制的存储服务。

<CardGroup cols={2}>
  <Card title="异步提交 Playground" icon="play" href="/cn/api-reference/async-generate-content">
    准备 Gemini 请求并查看 HTTP 202 响应。
  </Card>

  <Card title="轮询指南" icon="refresh-cw" href="/cn/unified-api/polling">
    使用安全退避策略等待任务进入终态。
  </Card>

  <Card title="模型对比" icon="columns-3" href="/cn/models/image/nano-banana/comparison">
    创建计费任务前确认模型选择。
  </Card>
</CardGroup>
