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

# 🍌 Nano Banana 2 Image Edit

> Edit images based on text prompts using the Google Nano Banana 2 model.
Supports up to 14 reference images (10 object images + 4 character images).

## Overview

Nano Banana 2 can restyle or surgically modify a reference image while maintaining global composition. Provide up to 14 reference images (10 object + 4 character) plus a short instruction—Nano Banana 2's upgraded diffusion backbone keeps lighting, textures, and edge fidelity intact.


## OpenAPI

````yaml /api-reference/endpoint/google/nano-banana-2/openapi.yaml POST /vendors/google/v1/nano-banana-2/edit
openapi: 3.1.0
info:
  title: Google Nano Banana 2 Image Generation API
  description: >-
    Google Nano Banana 2 (Gemini 3.1 Flash Image Preview) Image Generation and
    Editing API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.mulerouter.ai/
security:
  - bearerAuth: []
paths:
  /vendors/google/v1/nano-banana-2/edit:
    post:
      summary: Image to Image Edit
      description: >-
        Edit images based on text prompts using the Google Nano Banana 2 model.

        Supports up to 14 reference images (10 object images + 4 character
        images).
      operationId: nano_banana_2_edit
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditRequest'
            example:
              prompt: >-
                Add a small knitted wizard hat on the cat's head, make it look
                natural
              images:
                - https://example.com/cat_photo.png
              aspect_ratio: '1:1'
              resolution: 2K
        required: true
      responses:
        '202':
          description: Accepted - Task created successfully
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  task_info:
                    $ref: '#/components/schemas/TaskInfoResponse'
              example:
                task_info:
                  id: 123e4567-e89b-12d3-a456-426614174000
                  status: pending
                  created_at: '2026-02-27T00:00:00.000Z'
                  updated_at: '2026-02-27T00:00:00.000Z'
components:
  schemas:
    EditRequest:
      type: object
      additionalProperties: false
      properties:
        prompt:
          type: string
          description: >-
            Text prompt for image editing. Describe the desired change
            conversationally.


            For adding/removing elements: "Add a wizard hat on the cat's head"

            For inpainting: "Change only the blue sofa to a brown leather
            chesterfield"

            For style transfer: "Transform this photo into Van Gogh's Starry
            Night style"
        images:
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 14
          description: >-
            List of reference images for editing. Supports both image URLs and
            base64-encoded images.


            Base64 format: `data:image/png;base64,{base64_data}`


            Supported formats: JPEG, JPG, PNG, BMP, WEBP

            Max file size per image: 20MB


            Nano Banana 2 supports up to 14 reference images:

            - Up to 10 images of objects (high-fidelity preservation)

            - Up to 4 images of characters (character consistency)
        aspect_ratio:
          type: string
          description: Aspect ratio of the edited image (width:height).
          default: '1:1'
          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'
        resolution:
          type: string
          description: >-
            Output resolution preset.


            **Note:** Must use uppercase K (e.g. 1K, 2K, 4K). Lowercase will be
            rejected.
          default: 1K
          enum:
            - 1K
            - 2K
            - 4K
        web_search:
          type: boolean
          description: >-
            Enable Google Search grounding for image editing. When enabled, the
            model can use Google Search (including Web Search and Image Search)
            to verify facts and generate imagery based on real-time data such as
            current weather, stock charts, recent events, or accurate depictions
            of real-world subjects.
          default: false
      required:
        - prompt
        - images
      description: Image to image edit request body
    TaskInfoResponse:
      type: object
      additionalProperties: true
      properties:
        id:
          type: string
          description: UUID of the task
          format: uuid
        status:
          type: string
          description: Task status
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        created_at:
          type: string
          description: Task creation timestamp (ISO 8601)
          format: date-time
          example: '2026-02-27T00:00:00.000Z'
        updated_at:
          type: string
          description: Task last update timestamp (ISO 8601)
          format: date-time
          example: '2026-02-27T00:00:00.000Z'
        error:
          $ref: '#/components/schemas/TaskInfoResponseErrorObject'
          description: >-
            Error message of task execution, only returned when task status is
            failed
      required:
        - id
        - status
        - created_at
        - updated_at
    TaskInfoResponseErrorObject:
      type: object
      additionalProperties: true
      properties:
        code:
          type: integer
          description: MuleRouter Error code
          example: 3001
        title:
          type: string
          description: MuleRouter Error title
          example: Task Execution Error
        detail:
          type: string
          description: MuleRouter Error detail
          example: Task execution failed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````