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

# Nano Banana 2

> 使用 Nano Banana 2 模型生成图片（异步），统一文生图和图片编辑，支持 Google 搜索增强

使用 [Google DeepMind](https://deepmind.google) 的 Nano Banana 2 (Gemini 2.0 Flash) 模型生成图片。

**模型特点：**

* **统一生成与编辑** - 文生图与图片编辑合二为一
* **Google 搜索增强** - 可调用 Google 搜索，基于实时数据生成图像
* **多图输入** - 支持最多 14 张输入图片进行编辑和参考
* **灵活分辨率** - 支持 1K、2K、4K 输出分辨率
* **多种宽高比** - 支持从 1:1 到 21:9 的多种宽高比


## OpenAPI

````yaml /cn/openapi.yaml POST /generate/k/nano-banana-2
openapi: 3.0.0
info:
  contact:
    email: support@sinancode.com
    name: API Support
    url: https://sinancode.com/support
  description: AI 模型任务调度平台 API
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  termsOfService: https://sinancode.com/terms-of-service
  title: TikTomato API
  version: '1.0'
servers:
  - url: https://api.sinancode.com/v1
    description: Production server
security: []
paths:
  /generate/k/nano-banana-2:
    post:
      tags:
        - public
      summary: Nano Banana 2 图片生成
      description: 使用 Nano Banana 2 模型生成图片（异步），统一文生图和图片编辑，支持 Google 搜索增强
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ka.CreateNanoBanana2TaskRequest'
        description: Task parameters
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dto.CreateTaskResponse'
        '400':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apierror.ErrorResponse'
      security:
        - AccessToken: []
components:
  schemas:
    ka.CreateNanoBanana2TaskRequest:
      properties:
        aspect_ratio:
          default: auto
          description: AspectRatio 图片宽高比（可选，默认 auto）
          enum:
            - '1:1'
            - '1:4'
            - '1:8'
            - '2:3'
            - '3:2'
            - '3:4'
            - '4:1'
            - '4:3'
            - '4:5'
            - '5:4'
            - '8:1'
            - '9:16'
            - '16:9'
            - '21:9'
            - auto
          example: auto
          type: string
        google_search:
          default: false
          description: GoogleSearch 是否使用 Google 搜索增强（可选，默认 false）
          example: false
          type: boolean
        image_input:
          description: ImageInput 输入图片列表（可选，支持最多14张图片，每张最大30MB）
          example:
            - ''
          items:
            type: string
          maxItems: 14
          type: array
        output_format:
          default: jpg
          description: OutputFormat 输出图片格式（可选，默认 jpg）
          enum:
            - jpg
            - png
          example: jpg
          type: string
        prompt:
          description: Prompt 图片生成的文本描述（必填，最大20000字符）
          example: A beautiful landscape with mountains and a lake at sunset
          maxLength: 20000
          minLength: 1
          type: string
        resolution:
          default: 1K
          description: Resolution 图片分辨率（可选，默认 1K）
          enum:
            - 1K
            - 2K
            - 4K
          example: 1K
          type: string
      required:
        - prompt
      type: object
    dto.CreateTaskResponse:
      properties:
        task_id:
          description: Task ID
          example: 01234567-89ab-cdef-0123-456789abcdef
          type: string
      required:
        - task_id
      type: object
    apierror.ErrorResponse:
      properties:
        error_code:
          description: Machine-readable error code (e.g. TASK.INVALID_PARAMS)
          type: string
        message:
          description: User-friendly error message
          type: string
      type: object
  securitySchemes:
    AccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 请使用您的 API Token 进行认证

````