| --- |
| language: |
| - en |
| license: other |
| pipeline_tag: text-to-image |
| tags: |
| - nano-banana |
| - text-to-image |
| - image-to-image |
| inference: false |
| --- |
| |
| # Nano Banana API |
|
|
| **Model Page:** [Nano Banana API](https://apiframe.ai/models/nano-banana) |
|
|
| Community model card for calling Nano Banana through a REST API. |
|
|
| This repo documents the `nano-banana` model as exposed by Apiframe: Google's Gemini 2.5 Flash Image, text-to-image and image-to-image, up to 14 reference images, mask-free edits from a text prompt. Related ids on the same endpoint: `nano-banana-pro`, `nano-banana-2`, `nano-banana-2-lite`. |
|
|
| This repository does not host weights. Nano Banana is a closed model. Inference runs remotely. |
|
|
| <img src="https://apiframe.ai/models-examples/nano-banana-character-consistency-four-panel-day.jpeg" alt="Sample output" width="280" /> |
|
|
| ## Model description |
|
|
| | | | |
| |---|---| |
| | Architecture | Gemini 2.5 Flash Image (Nano Banana) | |
| | Task | text-to-image; image-to-image (up to 14 references) | |
| | Output | 1 image | |
| | Aspect ratios | `1:1`, `3:4`, `4:3`, `9:16`, `16:9` | |
| | Typical latency | ~9s | |
|
|
| ## How to use |
|
|
| ```bash |
| pip install requests |
| ``` |
|
|
| ```python |
| import os |
| import time |
| import requests |
| |
| API = "https://api.apiframe.ai/v2" |
| headers = { |
| "X-API-Key": os.environ["APIFRAME_API_KEY"], |
| "Content-Type": "application/json", |
| } |
| |
| job = requests.post( |
| f"{API}/images/generate", |
| headers=headers, |
| json={ |
| "model": "nano-banana", |
| "prompt": "a serene mountain lake at dawn", |
| "nanoBananaParams": { |
| "aspect_ratio": "16:9", |
| "output_format": "png", |
| }, |
| }, |
| ).json() |
| |
| while True: |
| result = requests.get(f"{API}/jobs/{job['jobId']}", headers=headers).json() |
| if result["status"] in ("COMPLETED", "FAILED"): |
| break |
| time.sleep(2) |
| |
| print(result.get("result")) |
| ``` |
|
|
| `result["images"]` is a list with one CDN URL. Pass `webhookUrl` on the generate call if you do not want to poll. |
|
|
| ### Image-to-image |
|
|
| ```python |
| import os |
| import requests |
| |
| headers = { |
| "X-API-Key": os.environ["APIFRAME_API_KEY"], |
| "Content-Type": "application/json", |
| } |
| |
| requests.post( |
| "https://api.apiframe.ai/v2/images/generate", |
| headers=headers, |
| json={ |
| "model": "nano-banana", |
| "prompt": "change the wall color to sage green, keep everything else the same", |
| "nanoBananaParams": { |
| "image_input": ["https://example.com/photo.jpg"], |
| "output_format": "png", |
| }, |
| }, |
| ) |
| ``` |
|
|
| Swap `model` for `nano-banana-2` or `nano-banana-pro` to use a later variant. Those ids also accept `resolution` (`1K`, `2K`, `4K`). |
|
|
| ## Limitations |
|
|
| - Closed model. No weights, fine-tuning, or local inference. |
| - Requires an Apiframe API key (`X-API-Key`). |
| - Outputs carry Google's SynthID watermark. |
| - Commercial use follows Google's terms. |
| - Generated media is retained on the CDN for 90 days. |
|
|
| ## License |
|
|
| Outputs are subject to Google's terms. This card is documentation only. Apiframe is not affiliated with, endorsed by, or sponsored by Google LLC. |
|
|