openapi: 3.1.0
info:
  title: Nano Banana 2
  version: '1.0'
  description: Google Gemini 3.1 Flash Image — the most fully featured Flash model, with 14 aspect ratios and 512p to 4K resolutions.
servers:
- url: https://openapi.imini.ai/imini/router
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Pass `Authorization: Bearer <YOUR_API_KEY>` in the request header. Go to the [API Keys management page](https://imini.ai/api-keys) to create and manage API Keys.
security:
- ApiKeyAuth: []
paths:
  /v1/images/generate:
    post:
      summary: Nano Banana 2
      operationId: generateNanoBanana2
      security:
      - ApiKeyAuth: []
      description: 'Submit an asynchronous image generation task. You will need to poll the query endpoint to retrieve the result.

        > Model ID: `google/nano-banana-2` · Underlying: Gemini 3.1 Flash Image

        '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              - prompt
              properties:
                model:
                  type: string
                  description: Fixed value `google/nano-banana-2`.
                prompt:
                  type: string
                  description: The prompt. Up to **6000** characters. Supports English and Chinese; detail-rich descriptions yield better results.
                  example: A cute shiba inu in a spacesuit standing on the moon, 3D
                    cartoon style
                images:
                  type: array
                  description: Reference image list. **Omitting or passing an empty array** means text-to-image mode; passing images switches to image-to-image / style reference mode. Up to **14** images.
                  items:
                    type: object
                    properties:
                      url:
                        type: string
                        description: 'Reference image address, in one of two forms:
                          **1)** A publicly accessible URL (starting with `http://` or `https://`);
                          **2)** A Data URI base64 encoding (starting with `data:image/`, e.g., `data:image/png;base64,iVBORw0KGgo...`). Supported formats: `png`
                          / `jpg` / `webp`, decoded size up to **10MB**.'
                      reference_type:
                        type: string
                        description: 'Reference type:

                          - `asset` — content reference

                          - `style` — style reference'
                        default: asset
                        enum:
                        - asset
                        - style
                  maxItems: 14
                aspect_ratio:
                  type: string
                  description: 'Output aspect ratio. Supports **14 values**:

                    `1:1` `2:3` `3:2` `3:4` `4:3` `4:5` `5:4` `9:16` `16:9` `21:9`
                    `1:4` `1:8` `4:1` `8:1`


                    > When reference images are provided and this parameter is omitted, the model automatically infers the aspect ratio from the reference images and uses it as the output ratio.'
                  default: '1:1'
                  enum:
                  - '1:1'
                  - '2:3'
                  - '3:2'
                  - '3:4'
                  - '4:3'
                  - '4:5'
                  - '5:4'
                  - '9:16'
                  - '16:9'
                  - '21:9'
                  - '1:4'
                  - '1:8'
                  - '4:1'
                  - '8:1'
                resolution:
                  type: string
                  description: 'Output quality tier: `512` / `1K` / `2K` / `4K`.


                    > `512` is an exclusive low-resolution tier for this model family, ideal for quick previews or prototype validation — the lowest cost and fastest option.'
                  default: 1K
                  enum:
                  - '512'
                  - 1K
                  - 2K
                  - 4K
            examples:
              "Text to Image":
                summary: Text to Image
                value:
                  model: google/nano-banana-2
                  prompt: A cute shiba inu in a spacesuit standing on the moon, 3D
                    cartoon style
                  aspect_ratio: '1:1'
                  resolution: '512'
              "Image Edit":
                summary: Image Edit
                value:
                  model: google/nano-banana-2
                  prompt: A cute shiba inu in a spacesuit standing on the moon, 3D
                    cartoon style
                  images:
                  - url: https://example.com/input.jpg
                    reference_type: asset
                  aspect_ratio: '16:9'
                  resolution: 4K
              "Image Edit (base64)":
                summary: Image Edit (base64)
                value:
                  model: google/nano-banana-2
                  prompt: A cute shiba inu in a spacesuit standing on the moon, 3D
                    cartoon style
                  images:
                  - url: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
                    reference_type: asset
                  aspect_ratio: '16:9'
                  resolution: 4K
      responses:
        '200':
          description: Submitted successfully
          content:
            application/json:
              schema:
                oneOf:
                - title: Submit Success (Pending)
                  type: object
                  properties:
                    task_id:
                      type: string
                      description: Unique task ID, used for subsequent polling
                      example: task_2041350318103396352
                    model:
                      type: string
                      description: The model ID used for this task
                      example: google/nano-banana
                    created_at:
                      type: string
                      description: Task creation time
                      example: 2026-04-07T03:00:17.062Z
                    request_id:
                      type: string
                      description: Unique request ID
                      example: 285f20ce-8158-401b-945c-7bc6a7ef6ead

        '400':
          description: Validation Error (e.g. invalid parameter, invalid prompt)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: Error code, e.g., INVALID_PROMPT
                        example: INVALID_PROMPT
                      message:
                        type: string
                        description: Error message details
                        example: Prompt contains disallowed content
                      status:
                        type: integer
                        description: HTTP status code
                        example: 400
                      request_id:
                        type: string
                        description: Unique request identifier
                        example: req_abc123
