APIMart
Nano Banana 2 model icon
Image

Nano Banana 2 API

Nano Banana 2 API gives you Google's Gemini 3.1 Flash Image on APIMart for text-to-image generation and image editing from 0.5K to 4K, with up to 14 reference images and optional Google Search grounding. Pay-as-you-go billing and membership discounts are available.

Image GenerationImage Editing4K OutputCommercial use

Service Highlights

  • Official Discounts
  • Pay-as-you-go
  • Fast & Low Latency
Input
67 characters
Output
Generated 1

Image link valid for 72 hours

Nano Banana 2 API Pricing

Transparent pricing with no hidden fees. Pay only for what you use.

VariantTierGoldCurrent pricePlatinumDiamondOfficialYour savings
nano-banana-2

Prices are estimates; actual cost is billed by token usage.

0.5K0.536Credits(~$0.0536)/pic0.5092Credits(~$0.0509)/pic0.4824Credits(~$0.0482)/pic0.67Credits(~$0.067)/pic20%
1K0.536Credits(~$0.0536)/pic0.5092Credits(~$0.0509)/pic0.4824Credits(~$0.0482)/pic0.67Credits(~$0.067)/pic20%
2K0.808Credits(~$0.0808)/pic0.7676Credits(~$0.0768)/pic0.7272Credits(~$0.0727)/pic1.01Credits(~$0.101)/pic20%
4K1.208Credits(~$0.1208)/pic1.1476Credits(~$0.1148)/pic1.0872Credits(~$0.1087)/pic1.51Credits(~$0.151)/pic20%

* Actual costs are subject to final output.

Google Nano Banana 2 API (Gemini 3.1 Flash Image) on APIMart

Google built Nano Banana 2 to bring Pro-level image quality to Flash speed. Generate and edit images from 0.5K to 4K, use 14 aspect ratios including ultra-wide 8:1, ground prompts in Google Search, and blend up to 14 reference images. Affordable pay-as-you-go billing with up to 28% off for members.

50K+

Active Users

99.9%

Uptime

2x

Faster

70%

Cost Savings

Nano Banana 2 API Example: Text to Image and Image to Image

Call Google Nano Banana 2 on APIMart with one POST request. Nano Banana 2 generation is asynchronous: submit a task, then poll the task endpoint to get the image URL.

  1. 1

    Authenticate Nano Banana 2 API requests

    Save the key you created above in the APIMART_API_KEY environment variable and send it as Authorization: Bearer <key> on every request.

  2. 2

    Submit a Nano Banana 2 task

    POST /v1/images/generations with model, your prompt, size and resolution. Add image_urls to edit images. The response returns a task_id.

  3. 3

    Get the Nano Banana 2 result

    Send GET /v1/tasks/{task_id} until status is completed, then read the image URL from data.result.images[0].url[0]. Image URLs expire at expires_at, so download the files if you need to keep them. A failed task returns the reason in error.message.

    See the Nano Banana 2 API reference for every parameter and response field.

POST /v1/images/generations
curl -X POST https://api.apimart.ai/v1/images/generations \
  -H "Authorization: Bearer $APIMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-preview",
    "prompt": "A clean infographic poster explaining how a coffee bean becomes espresso, four labeled steps, flat illustration style",
    "n": 1,
    "size": "16:9",
    "resolution": "2K"
  }'

Nano Banana 2 API Parameters

ParameterTypeRequiredDefaultDescription
modelstringRequiredDefault: gemini-3.1-flash-image-previewgemini-3.1-flash-image-preview (Ext, alias nano-banana-2-ext) or gemini-3.1-flash-image-preview-official (official, alias nano-banana-2).
promptstringRequiredDefault: —Text description of the image or the edit.
sizestringOptionalDefault: —auto, 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 5:4, 4:5, 21:9, 1:4, 4:1, 1:8 or 8:1. For text to image, auto resolves to 1:1 or 16:9; for image editing it follows the upstream result.
resolutionstringOptionalDefault: 1KOutput resolution: 0.5K, 1K, 2K or 4K. 4K is billed higher than 1K.
nintegerOptionalDefault: 1Number of images per request. Only 1 is supported; send it as a number, not a string.
image_urlsarrayOptionalDefault: —Up to 14 reference images (ideally up to 10 objects and 4 characters) as public http(s) URLs or full data URIs. JPEG, PNG or WebP, max 10 MB each. Adding them switches to image editing.
nsfw_checkbooleanOptionalDefault: falseModerate the prompt and input images with omni-moderation-latest before submission. Adds cost and latency.
official_fallbackbooleanOptionalDefault: falseUse the official channel as a fallback. Cannot be set when model is the -official version.
google_searchbooleanOptionalDefault: falseGround the prompt in Google Search text results.
google_image_searchbooleanOptionalDefault: falseGround the image in Google Images results. Requires google_search set to true.

Nano Banana API Model Family

Compare every Nano Banana model on APIMart. One API key calls all of them, billed per image.

ModelBase modelBest forResolution
Nano Banana APIGemini 2.5 Flash ImageCharacter consistency, multi-image blending and prompt-based edits1K
Nano Banana Pro APIGemini 3 Pro ImageProfessional 4K images, legible multilingual text and consistency for up to 5 people1K / 2K / 4K
Nano Banana 2 APIThis pageGemini 3.1 Flash ImageFast, cost-efficient generation from 0.5K to 4K0.5K – 4K
Nano Banana 2 Lite APIGemini 3.1 Flash Lite ImageFast 1K images and editing, one image per request with up to 14 reference images1K
Gemini Nano Banana 2.1 APIGemini Nano Banana 2.1Latest version: text-to-image and reference-image editing in 14 aspect ratios1K / 2K / 4K

Guides, comparisons and pricing analysis from the APIMart blog.