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

> Generate images from text prompts using the Google Nano Banana 2 model (Gemini 3.1 Flash Image Preview).
Supports up to 4K resolution output and 14 different aspect ratios.

## Overview

Generate high-quality images from text prompts using Google's Nano Banana 2 model (Gemini 3.1 Flash Image Preview). Compared with the base Nano Banana release, Nano Banana 2 unlocks:

* 14 aspect ratios (from 1:4 portrait up to 21:9 panoramic)
* Higher fidelity presets (`resolution` up to 4K)
* Web search grounding for real-time data and accurate depictions of real-world subjects


## OpenAPI

````yaml /api-reference/endpoint/google/nano-banana-2/openapi.yaml POST /vendors/google/v1/nano-banana-2/generation
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/generation:
    post:
      summary: Text to Image Generation
      description: >-
        Generate images from text prompts using the Google Nano Banana 2 model
        (Gemini 3.1 Flash Image Preview).

        Supports up to 4K resolution output and 14 different aspect ratios.
      operationId: nano_banana_2_generation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerationRequest'
            example:
              prompt: >-
                A photorealistic close-up portrait of an elderly Japanese
                ceramicist with a warm, knowing smile
              aspect_ratio: '3:4'
              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:
    GenerationRequest:
      type: object
      additionalProperties: false
      properties:
        prompt:
          type: string
          description: >-
            Text prompt for image generation. For best results, describe the
            scene narratively rather than listing keywords.


            Include details such as:

            - Subject (object, person, animal, scenery)

            - Style (photorealistic, illustration, sketch, etc.)

            - Lighting and mood

            - Camera angle and composition

            - Color palette


            Example: "A photorealistic close-up portrait of an elderly Japanese
            ceramicist with deep, sun-etched wrinkles and a warm, knowing smile.
            Captured with an 85mm portrait lens, resulting in soft bokeh."
        aspect_ratio:
          type: string
          description: Aspect ratio of the generated 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 generation. 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
      description: Text to image generation 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

````