DEV Community

useapi.net
useapi.net

Posted on Originally published at useapi.net

How to Generate Nano Banana 2 & Nano Banana Pro Images via the Google Flow API

Introduction

One synchronous POST to the useapi.net Google Flow API returns up to four Nano Banana 2, Nano Banana Pro or Nano Banana 2 Lite images, generated on your own Google Flow account. There's no Google Cloud project, no Gemini API key and no per-image metering. Image generation is included on any Google AI plan, even a free one, where the official Gemini API bills $0.034–$0.134 per image.

This guide covers the models you get, the price difference, the single-call image workflow with copy-paste curl, and a runnable Node.js script that batch-generates from a list of prompts. Want to see how the three models differ on one prompt? See the Nano Banana model comparison. Need video instead? See the sibling Veo 3.1 tutorial.

Supported models

Pick a model per request with the model field (default nano-banana-2-lite). All three models work on any Google AI subscription — including a free account.

Model id Marketing name References (I2I) Aspect ratios Notes
nano-banana-2-lite (default) Nano Banana 2 Lite / Gemini 3.1 Flash-Lite Image max 10 16:9, 4:3, 1:1, 3:4, 9:16, auto† Google Flow's default image model since July 2026 — stays at 16:9 in image-to-image mode unless you pass a ratio
nano-banana-2 Nano Banana 2 / Gemini 3.1 Flash Image max 10 16:9, 4:3, 1:1, 3:4, 9:16, auto† Defaults to auto in image-to-image mode
nano-banana-pro Nano Banana Pro / Gemini 3 Pro Image max 10 16:9, 4:3, 1:1, 3:4, 9:16, auto† Highest-quality image model — defaults to auto in image-to-image mode

† auto is valid only in image-to-image mode (at least one reference_* or character_* supplied) — the backend derives the ratio from the first reference image. With several references the orientation is not guaranteed, so pass an explicit ratio when every image must come back in the same shape.

All three accept count (1–4) and seed for reproducibility. If you omit model, the API uses nano-banana-2-lite, with or without references. Two deprecated aliases are still accepted: nano-banana maps to nano-banana-2, and imagen-4 maps to nano-banana-2-lite (Google removed Imagen from Flow in July 2026). Details and per-model capabilities are in the POST /images reference.

Upscaling to 2K/4K

Images generated with any of the three models can be upscaled with POST /images/upscale: pass the image's mediaGenerationId and a resolution of 2k (default) or 4k. The response is base64 in encodedImage. 2k works on any plan. 4k needs a paid Google plan, and on a free account it fails with 403 and a captcha_quality: PUBLIC_ERROR_UNUSUAL_ACTIVITY error that looks like a captcha problem but is not one, so don't retry it.

Pricing

Image generation is included. You keep your normal Google AI account — even a free one works for images (a paid plan is only needed for video and 4k upscales) — plus a flat $15/month to useapi.net for API access to every service. No per-image metering, no per-call surcharge.

Third-party Google Flow API by useapi.net vs. the official Gemini API — drive your own Google Flow subscription instead of metered, per-call API billing:

Model Official Gemini API useapi.net (Flow Pro) useapi.net (Flow Ultra)
Veo 3.1 Fast — 8s clip $0.80 ~$0.40 ~$0.10
Veo 3.1 Quality — 8s clip $3.20 ~$2.00 ~$1.00
Veo 3.1 Lite — 8s clip $0.40 ~$0.20 ~$0.05
Veo 3.1 Lite, lower priority — — $0 (Ultra $199)
Omni 1.1 Flash — 8s clip — (Flow only) ~$0.24 ~$0.12
Omni 1.1 Flash — 8s clip at 360p — (Flow only) ~$0.12 ~$0.06
Nano Banana Pro — per image $0.134 included included
Nano Banana 2 — per image $0.067 included included
Nano Banana 2 Lite — per image $0.034 included included

Expected daily output — Ultra ($199/mo) plan. Daily averages observed on top real accounts. These are expected, not guaranteed: Google governs the underlying Flow allowances and they vary with demand.

Free workload (no Flow credits spent) Avg generations / day*
Veo 3.1 Lite — lower priority video ~1,000
Images — Nano Banana 2 Lite, Nano Banana 2, Nano Banana Pro up to ~500

*Averages from the busiest real accounts — not guarantees. They are set by Google's own allowances and fluctuate with demand. Applies only to the free lower-priority video queue and image generation. Credit-metered models (Veo 3.1 Fast / Quality and Omni 1.1 Flash) are not shown here — their volume is bounded by your plan's monthly Flow credits (see the credit table), not a free allowance.

Veo is billed per second on the Gemini API (an 8-second 720p clip shown) and images are priced per image. Through useapi.net you spend your own Flow plan credits and pay a flat $15/month — image generation is included on any Google AI plan, and there is no Google Cloud project, API key, or per-call metering.

Full plan and credit details are on the Google Flow overview. See the setup guide to connect your account.

How to generate a Nano Banana image with curl

You need a useapi.net API token and a connected Google Flow account. Image generation is synchronous — one POST blocks until the images are ready (typically 10–20 seconds) and returns them in the response, so there's no jobid to poll. Step two is just saving the result, from the signed URL or, when that is missing, the inline base64 image.

  1. Submit the prompt — POST https://api.useapi.net/v1/google-flow/images:
curl -X POST "https://api.useapi.net/v1/google-flow/images" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Cat dressed like a pirate fencing with a real pirate, pirate looks absolutely terrified, this is happening on a deck of the Disney cruise ship",
    "model": "nano-banana-pro",
    "aspectRatio": "16:9",
    "count": 4,
    "seed": 123456
  }' > response.json
Enter fullscreen mode Exit fullscreen mode

The call returns 200 OK with a jobId and a media array — one entry per image (count is 1–4, default 4). Each image's signed download URL is at media[].image.generatedImage.fifeUrl:

{
  "jobId": "j1731859345678i-u12345-email:jo***@gmail.com-bot:google-flow",
  "media": [
    {
      "image": {
        "generatedImage": {
          "seed": 123456,
          "mediaGenerationId": "user:12345-email:6a6f...-image:...",
          "prompt": "Cat dressed like a pirate fencing with a real pirate, pirate looks absolutely terrified, this is happening on a deck of the Disney cruise ship",
          "fifeUrl": "https://flow-content.google/image/...",
          "aspectRatio": "IMAGE_ASPECT_RATIO_LANDSCAPE"
        }
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode
  1. Download the image from fifeUrl (the signed URL is valid for a limited time, so download promptly). Once in a while fifeUrl is absent and the image comes back inline as base64 in encodedImage instead, so fall back to decoding that:
URL=$(jq -r '.media[0].image.generatedImage.fifeUrl // empty' response.json)
if [ -n "$URL" ]; then
  curl -o image_1.jpg "$URL"
else
  jq -r '.media[0].image.generatedImage.encodedImage' response.json | base64 -d > image_1.jpg
fi
Enter fullscreen mode Exit fullscreen mode

Each generated image's mediaGenerationId can be reused as a reference in a later request — see Image references & characters below.

Want a webhook as well? Pass a replyUrl in the request body and the API also posts job status updates to that URL. The call itself still waits for the images. The payload matches the GET /jobs/jobId response, where a completed image lives at response.media[].image.generatedImage.fifeUrl.

Image references & characters

To steer a generation with an existing picture, upload it first with POST /assets/email (raw bytes, an image Content-Type, PNG/JPEG/WebP up to 20 MB). The upload response nests the reference id at mediaGenerationId.mediaGenerationId — that nested string is what you pass back as reference_1 (each of the three models accepts up to 10 references):

# 1. Upload a reference image
curl -X POST "https://api.useapi.net/v1/google-flow/assets/john%40gmail.com" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: image/jpeg" \
  --data-binary @reference.jpeg

# Response — the reference id is nested one level deep:
# {
#   "mediaGenerationId": {
#     "mediaGenerationId": "user:12345-email:6a6f...-image:ff9aa5cc-..."
#   },
#   "width": 1024, "height": 1024, "email": "jo***@gmail.com"
# }

# 2. Generate using that reference
curl -X POST "https://api.useapi.net/v1/google-flow/images" \
  -H "Authorization: Bearer $USEAPI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-pro",
    "prompt": "Make this photograph look modern",
    "reference_1": "user:12345-email:6a6f...-image:ff9aa5cc-..."
  }'
Enter fullscreen mode Exit fullscreen mode

For consistent identity across many images, bundle 1–2 reference images into a reusable character with POST /characters, then pass its character id as character_1…character_7. Characters mix freely with reference_* and share the same per-model image-ref budget. You can also drop @reference_1 / @character_1 markers inline in the prompt for positional grounding — each inline marker must have a matching body param.

Batch-generate with a script

Finding the right image takes many attempts, and running them by hand is tedious. The Node.js script reads a list of prompts from prompts.json, uploads any reference images, submits each request, and downloads every returned image — so you can queue a batch and come back to the winners. Because POST /images is synchronous, the script writes each result as soon as the call returns.

You need Node.js v21 or newer. Put prompts.json and google-flow-images.mjs in the same folder and run node ./google-flow-images.mjs API_TOKEN EMAIL, where API_TOKEN is your useapi.net API token and EMAIL is your connected Google Flow account email. The script looks the account up by email automatically and checks its health field before submitting.

Prefer to clone and run it locally? The complete google-flow-images.mjs and prompts.json are on GitHub in useapi/google-flow-api.

[
    {
        "prompt": "By default the nano-banana-2-lite model generates 4 image variations at 16:9."
    },
    {
        "model": "nano-banana-pro",
        "aspectRatio": "1:1",
        "count": 2,
        "seed": 123456,
        "prompt": "Nano Banana Pro (Gemini 3 Pro Image), two square variations. For all parameters see https://useapi.net/docs/api-google-flow-v1/post-google-flow-images"
    },
    {
        "model": "nano-banana-2",
        "aspectRatio": "auto",
        "reference_1": "./reference_image.jpeg",
        "prompt": "Image-to-image: pass a local reference file as reference_1 (uploaded automatically). auto aspect ratio derives from the first reference. All three models accept up to 10 references."
    },
    {
        "model": "nano-banana-2-lite",
        "aspectRatio": "9:16",
        "count": 4,
        "prompt": "Nano Banana 2 Lite portrait. Other models (nano-banana-2, nano-banana-pro) are selectable via the model field — see the POST /images docs."
    }
]
Enter fullscreen mode Exit fullscreen mode

Examples

Real images generated through this same Google Flow API with Nano Banana Pro and Nano Banana 2 Lite — taken straight from our blog and model comparison.

Nano Banana Pro — text-to-image (source): "Cat dressed like a pirate fencing with a real pirate… on a Disney cruise ship."

Nano Banana Pro text-to-image result

Nano Banana Pro — 5 reference images (source): five individual portraits composited into one "K-Pop group victory celebration" group shot.

Nano Banana Pro multi-reference group shot

Nano Banana 2 Lite, the default model (source): the beekeeper prompt from our three-model comparison, rendered at 9:16 by the fastest of the three.

Nano Banana 2 Lite beekeeper result via the Google Flow API

Frequently asked questions

  • Is there a Nano Banana 2 API? Yes — two ways. Google offers Nano Banana 2 (Gemini 3.1 Flash Image) on the official Gemini API, which meters per image on a Google Cloud project. Or use useapi.net's Google Flow API, which exposes it as nano-banana-2 and drives your own Google Flow account through a standard REST endpoint — no Cloud project, and image generation works on any Google AI plan including the free tier. See Pricing.
  • Is there a Nano Banana Pro API? Yes. Nano Banana Pro is Gemini 3 Pro Image, available on Google's official Gemini API, which meters per image. useapi.net exposes the same model as nano-banana-pro on the POST /images endpoint, driving your Flow account instead of metering per image — see Pricing.
  • Which model does the API use by default? nano-banana-2-lite (Gemini 3.1 Flash-Lite Image), with or without references. Switch per request by setting model to nano-banana-2 (Gemini 3.1 Flash Image) or nano-banana-pro (Gemini 3 Pro Image, the highest quality). All three accept up to 10 reference images and can be upscaled to 2K/4K. Nano Banana 2 Lite vs 2 vs Pro shows all three on one prompt.
  • Is Imagen 4 still available in Google Flow? No. Google removed Imagen from Google Flow in July 2026. The imagen-4 model id is still accepted so existing code keeps working, but those requests now generate with nano-banana-2-lite.
  • How much does it cost? Image generation works with any Google AI subscription or a free account, plus a flat monthly subscription to useapi.net for API access to all services. The official Gemini API meters per image, while useapi.net includes generation in the flat subscription — see Pricing above.
  • Do I need a captcha or a Google Cloud project? No Google Cloud project. Image generation requires reCAPTCHA, but you do not solve it yourself — the useapi.net worker solves it automatically, and your first Google Flow account comes with 300 free captcha credits as a one-time grant (powered by CapSolver). After that you configure your own provider keys via POST /accounts/captcha-providers. The script in this guide sends no captchaToken and relies on this automatic solving.

Conclusion

Visit our Discord Server or Telegram Channel for any support questions and concerns.

Check our GitHub repo with code examples.

Top comments (0)