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

# NanoBanana native format

> Call NanoBanana via the Gemini native protocol with multi-reference and high-resolution support

## Models you can use

| Model ID         | Notes                                                                                         |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `nanobanana`     | Standard — balanced speed and quality                                                         |
| `nanobanana_pro` | High-quality — ideal for product images and precise style unification                         |
| `nanobanana_2`   | 2nd generation — budget tier **only supports the OpenAI chat format** (see separate endpoint) |

## Multiple reference images

Append multiple `inline_data` objects consecutively inside
`contents[].parts`. Each object holds the Base64 data of one reference
image, enabling multi-reference input.

## Resolution configuration

Inside `generationConfig.imageConfig`:

* `aspectRatio`: `1:1`, `3:4`, `4:3`, `9:16`, `16:9`
* `imageSize`: `1K`, `2K`, `4K`

## Thinking content

Set `generationConfig.thinkingConfig.includeThoughts: true` to
include the model's reasoning trace in the response.


## OpenAPI

````yaml /openapi/images.en.yaml post /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: InfinityBlue API — Images
  version: 1.0.0
  summary: Image generation and editing endpoints
  description: >
    InfinityBlue image endpoints support both the OpenAI native format and the

    NanoBanana (Gemini native) format, covering text-to-image generation,

    image editing, and multi-reference image fusion.


    ## Authentication


    Every request must include your API key in the header:


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    Create and manage your API keys in the
    [console](https://api.getinfinityblue.com/console).


    ## Endpoint format conventions


    | Path prefix | Compatible format |

    | --- | --- |

    | `/v1/images/*` | OpenAI Images API |

    | `/v1/chat/completions` | OpenAI Chat Completions (NanoBanana OpenAI
    format) |

    | `/v1beta/models/{model}:generateContent` | Google Gemini native
    (NanoBanana native format) |
  contact:
    name: InfinityBlue
    url: https://getinfinityblue.com
servers:
  - url: https://api.getinfinityblue.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: |
      OpenAI-compatible image generation and editing endpoints supporting
      models such as `gpt-image-2`.
  - name: NanoBanana
    description: |
      NanoBanana image generation endpoints available in both Gemini native
      format and OpenAI chat format, supporting text-to-image, multi-reference
      fusion, and style-unification workflows.
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - NanoBanana
      summary: NanoBanana image generation (native format)
      description: |
        Generate images using NanoBanana models via the Gemini native protocol.
        Supports text-to-image, single-reference editing, and multi-reference
        fusion. Configure the output aspect ratio and resolution level in
        `generationConfig.imageConfig`.

        Pass the NanoBanana model ID as the `model` path parameter,
        e.g. `nanobanana_pro`.
      operationId: createNanoBananaImageNative
      parameters:
        - name: model
          in: path
          required: true
          description: |
            NanoBanana model ID, e.g. `nanobanana_pro`.
            Accepted values: `nanobanana`, `nanobanana_pro`.
          schema:
            type: string
          example: nanobanana_pro
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NanoBananaRequest'
            examples:
              text_to_image:
                summary: Text-to-image (basic)
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Draw a cat sitting on a rooftop under moonlight
                  generationConfig:
                    responseModalities:
                      - TEXT
                      - IMAGE
                    imageConfig:
                      aspectRatio: '16:9'
                      imageSize: 4K
              with_thinking:
                summary: Include thinking content
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Draw a cat sitting on a rooftop under moonlight
                  generationConfig:
                    thinkingConfig:
                      includeThoughts: true
                    responseModalities:
                      - TEXT
                      - IMAGE
                    imageConfig:
                      aspectRatio: '16:9'
                      imageSize: 4K
              multi_reference:
                summary: Multi-reference image fusion
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Combine these two reference images to generate a
                            unified-style product promotional image, preserving
                            the main subject's silhouette, with a more premium,
                            clean, and bright overall look
                        - inline_data:
                            mimeType: image/jpeg
                            data: <base64_image_1>
                        - inline_data:
                            mimeType: image/jpeg
                            data: <base64_image_2>
                  generationConfig:
                    responseModalities:
                      - TEXT
                      - IMAGE
                    imageConfig:
                      aspectRatio: '1:1'
                      imageSize: 2K
      responses:
        '200':
          description: Image generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NanoBananaResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    NanoBananaRequest:
      type: object
      required:
        - contents
        - generationConfig
      description: NanoBanana native-format image generation/editing request body.
      properties:
        contents:
          type: array
          description: |
            A list of conversation turns. Typically one `user` message; its
            `parts` array can contain a text prompt and one or more reference
            images.
          items:
            $ref: '#/components/schemas/NanoBananaContent'
        generationConfig:
          $ref: '#/components/schemas/NanoBananaGenerationConfig'
    NanoBananaResponse:
      type: object
      description: NanoBanana native-format response body.
      properties:
        candidates:
          type: array
          description: List of generated candidate results.
          items:
            type: object
            properties:
              content:
                type: object
                description: Content of the candidate result.
                properties:
                  role:
                    type: string
                    description: Role of the message author (typically `model`).
                  parts:
                    type: array
                    description: Content parts containing text and/or image data.
                    items:
                      type: object
                      description: >-
                        A single content part containing text or inline image
                        data.
              finishReason:
                type: string
                description: The reason generation stopped.
              safetyRatings:
                type: array
                description: Safety rating list for the candidate.
                items:
                  type: object
        usageMetadata:
          type: object
          description: Token usage statistics.
          properties:
            promptTokenCount:
              type: integer
              description: Tokens consumed by the prompt.
            candidatesTokenCount:
              type: integer
              description: Tokens consumed by the candidates.
            totalTokenCount:
              type: integer
              description: Total tokens consumed.
    ErrorResponse:
      type: object
      description: Standard error response.
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message.
              examples:
                - >-
                  Invalid size. Supported sizes are 1024x1024, 1536x1024,
                  1024x1536.
            type:
              type: string
              description: Error type.
              examples:
                - invalid_request_error
            param:
              type:
                - string
                - 'null'
              description: The parameter related to the error.
              examples:
                - size
            code:
              type:
                - string
                - 'null'
              description: Error code.
              examples:
                - invalid_size
    NanoBananaContent:
      type: object
      required:
        - role
        - parts
      description: A single conversation turn.
      properties:
        role:
          type: string
          description: >-
            The role of the message author. Typically `user` for image
            generation requests.
          examples:
            - user
        parts:
          type: array
          description: |
            A list of content parts, supporting mixed text and image data.
            The first part is usually a text prompt (`text`); subsequent parts
            can be `inline_data` objects representing reference images.
          items:
            $ref: '#/components/schemas/NanoBananaPart'
    NanoBananaGenerationConfig:
      type: object
      required:
        - responseModalities
        - imageConfig
      description: >-
        Generation configuration controlling output modalities, image
        dimensions, and optional thinking content.
      properties:
        thinkingConfig:
          type: object
          description: >-
            Configuration for returning model thinking content. Optional for
            image generation.
          properties:
            includeThoughts:
              type: boolean
              description: >-
                Whether to return the model's reasoning trace. Set to `true` to
                include it.
              examples:
                - false
        responseModalities:
          type: array
          description: |
            List of response modalities specifying what data types to return.
            Common values for image generation: `TEXT` (caption/description)
            and `IMAGE` (the generated image).
          items:
            type: string
            enum:
              - TEXT
              - IMAGE
          examples:
            - - TEXT
              - IMAGE
        imageConfig:
          $ref: '#/components/schemas/NanoBananaImageConfig'
    NanoBananaPart:
      type: object
      description: |
        A single content part. Use either `text` for a text prompt or
        `inline_data` for image data — not both in the same part object.
        To supply multiple reference images, add multiple `inline_data` parts
        consecutively.
      properties:
        text:
          type: string
          description: |
            Text prompt describing the generation target, style, composition,
            or subject-preservation requirements.
          examples:
            - >-
              Combine these two reference images into a unified-style product
              promotional image, preserving the main subject silhouette, with a
              more premium and clean look
        inline_data:
          $ref: '#/components/schemas/NanoBananaInlineData'
    NanoBananaImageConfig:
      type: object
      required:
        - aspectRatio
        - imageSize
      description: Image output configuration specifying aspect ratio and resolution level.
      properties:
        aspectRatio:
          type: string
          description: |
            Output image aspect ratio. Choose based on the intended use case.
            Options: `1:1`, `3:4`, `4:3`, `9:16`, `16:9`.
          examples:
            - '1:1'
            - '16:9'
        imageSize:
          type: string
          description: |
            Output image resolution level. Higher values produce sharper images
            at the cost of longer generation time.
            Options: `1K`, `2K`, `4K`.
          examples:
            - 2K
            - 4K
    NanoBananaInlineData:
      type: object
      required:
        - mimeType
        - data
      description: |
        Inline image data for passing reference or input images. Supply multiple
        `inline_data` parts within the same `parts` array for multi-reference
        input; the model synthesizes all images with the text prompt.
      properties:
        mimeType:
          type: string
          description: >-
            Image MIME type, e.g. `image/jpeg`, `image/png`, `image/webp`. Must
            match the actual format.
          examples:
            - image/jpeg
        data:
          type: string
          description: |
            Base64-encoded image data, without the `data:image/...;base64,`
            prefix. For multi-image input, each image corresponds to a separate
            `inline_data.data` field.
          examples:
            - <base64_encoded_image_data>
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >
        Bearer token authentication, format: `Authorization: Bearer sk-xxxxxx`.

        Get your API key in the
        [console](https://api.getinfinityblue.com/console).

````