Published 2026-07-05 · Last reviewed 2026-07-05

Nano Banana 2 Lite API Guide

Who Should Use the API

This guide is for developers planning an integration that generates or edits images with Nano Banana 2 Lite — Google's gemini-3.1-flash-lite-image model, publicly documented as Gemini 3.1 Flash-Lite Image. It walks through the model's official parameters and the async submit-then-poll pattern this product itself uses via Replicate, so you can plan a comparable integration.

Official Model Code & Capability Summary

The model is officially documented as gemini-3.1-flash-lite-image (Gemini 3.1 Flash-Lite Image) and is also available on Replicate as `google/nano-banana-2-lite`. It accepts a text prompt and, optionally, one or more reference images, and returns a generated or edited image at Native 1K (1024px). nanobanana2lite.me is an independent third-party service and is not affiliated with Google.

Request Parameters

ParameterTypeRequiredNotes
promptstringRequiredThe text description of what to generate or how to edit the supplied image(s).
image_inputarray of image URLsOptionalOne or more reference images for image-to-image editing. Not required for text-to-image.
aspect_ratiostringOptionalE.g. "1:1", "16:9", "9:16", or "match_input_image" to follow the input image's ratio. Falls back to 1:1 if "match_input_image" is requested with no input image.
output_formatstringOptional"jpg" or "png".

Example request (Replicate, placeholder token)

curl -s -X POST https://api.replicate.com/v1/models/google/nano-banana-2-lite/predictions \
  -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "studio product photo of a ceramic mug on a marble counter",
      "aspect_ratio": "1:1",
      "output_format": "jpg"
    }
  }'

Text-to-Image Workflow

Three-panel workflow illustration showing an upload area, an AI generation canvas and an export preview.
  1. 1

    Submit the request

    Send a prompt (and aspect_ratio if you want something other than the default) to start a prediction. The request returns immediately with a pending task/prediction id — this is an asynchronous API, not a synchronous call that blocks until the image is ready.

  2. 2

    Poll for the result

    Poll the task status endpoint with the returned id until status moves to success (or failed). Most Nano Banana 2 Lite generations resolve within a few seconds.

  3. 3

    Retrieve the output

    On success, the response includes the output image URL at Native 1K (1024px).

Image Editing Workflow

Three-panel workflow illustration showing an upload area, an AI generation canvas and an export preview.
  1. 1

    Submit with image_input

    Send the same request shape as text-to-image, but include one or more reference image URLs in image_input alongside your edit prompt.

  2. 2

    Poll the same way

    Image editing requests follow the identical asynchronous submit-then-poll pattern as text-to-image — there is no separate endpoint.

  3. 3

    Mind reference limits

    Per official guidance, this model is not optimized for many reference images or long multi-turn sequential edit chains — keep to one primary reference and a small number of edit steps per request for the most reliable results.

Aspect Ratio and 1K Output Notes

Nano Banana 2 Lite generates images at native 1K (1024px) only — there is no higher-resolution output tier. No parameter exists to request a higher-resolution tier from this model — if your product needs output above native 1K, that has to come from a separate upscaling step or a different model tier. See the Generation Workflow docs for the full per-aspect-ratio output reference on this site.

Error Handling & Cost Planning

Plan for asynchronous failures, not just request-level errors: a prediction can accept your input and still resolve to a failed status later, for example if a referenced image URL is invalid. Design your integration so that a failed status triggers a clear user-facing message and, if you charge users per generation, an automatic credit refund — this product refunds credits automatically whenever a generation resolves to failed, rather than only refunding on manual request. For cost planning, this product prices text-to-image and image-to-image separately in its own credit system (2 and 4 credits respectively) — your own per-call cost from the underlying provider is a separate, usage-based figure to confirm directly with your provider account.

Integration Checklist

  • Confirm you are calling the correct model identifier and have valid API credentials before going live.
  • Implement polling with a reasonable timeout and backoff, since this is an asynchronous API.
  • Handle the failed status explicitly, including any user-facing refund or retry messaging.
  • Validate reference image URLs are publicly reachable before submitting an image-to-image request.
  • Cap the number of reference images and edit rounds per request to match official guidance.
  • Log the returned task/prediction id so failed requests can be traced back to a specific submission.

Last reviewed: 2026-07-05

Parameter names, credit costs and the async submit/poll pattern above reflect this product's own verified Replicate integration, not a published Nano Banana 2 Lite API guarantee from Google — confirm exact parameters against your chosen provider's current docs before integrating.

FAQ

Try Nano Banana 2 Lite Free

See the model in action in the browser before you plan an integration — no card required.