Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
pipeline_tag: text-to-image
|
| 6 |
+
tags:
|
| 7 |
+
- nano-banana
|
| 8 |
+
- text-to-image
|
| 9 |
+
- image-to-image
|
| 10 |
+
inference: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Nano Banana API
|
| 14 |
+
|
| 15 |
+
**Model Page:** [Nano Banana API](https://apiframe.ai/models/nano-banana)
|
| 16 |
+
|
| 17 |
+
Community model card for calling Nano Banana through a REST API.
|
| 18 |
+
|
| 19 |
+
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`.
|
| 20 |
+
|
| 21 |
+
This repository does not host weights. Nano Banana is a closed model. Inference runs remotely.
|
| 22 |
+
|
| 23 |
+
<img src="https://apiframe.ai/models-examples/nano-banana-character-consistency-four-panel-day.jpeg" alt="Sample output" width="280" />
|
| 24 |
+
|
| 25 |
+
## Model description
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Architecture | Gemini 2.5 Flash Image (Nano Banana) |
|
| 30 |
+
| Task | text-to-image; image-to-image (up to 14 references) |
|
| 31 |
+
| Output | 1 image |
|
| 32 |
+
| Aspect ratios | `1:1`, `3:4`, `4:3`, `9:16`, `16:9` |
|
| 33 |
+
| Typical latency | ~9s |
|
| 34 |
+
|
| 35 |
+
## How to use
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
pip install requests
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import os
|
| 43 |
+
import time
|
| 44 |
+
import requests
|
| 45 |
+
|
| 46 |
+
API = "https://api.apiframe.ai/v2"
|
| 47 |
+
headers = {
|
| 48 |
+
"X-API-Key": os.environ["APIFRAME_API_KEY"],
|
| 49 |
+
"Content-Type": "application/json",
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
job = requests.post(
|
| 53 |
+
f"{API}/images/generate",
|
| 54 |
+
headers=headers,
|
| 55 |
+
json={
|
| 56 |
+
"model": "nano-banana",
|
| 57 |
+
"prompt": "a serene mountain lake at dawn",
|
| 58 |
+
"nanoBananaParams": {
|
| 59 |
+
"aspect_ratio": "16:9",
|
| 60 |
+
"output_format": "png",
|
| 61 |
+
},
|
| 62 |
+
},
|
| 63 |
+
).json()
|
| 64 |
+
|
| 65 |
+
while True:
|
| 66 |
+
result = requests.get(f"{API}/jobs/{job['jobId']}", headers=headers).json()
|
| 67 |
+
if result["status"] in ("COMPLETED", "FAILED"):
|
| 68 |
+
break
|
| 69 |
+
time.sleep(2)
|
| 70 |
+
|
| 71 |
+
print(result.get("result"))
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
`result["images"]` is a list with one CDN URL. Pass `webhookUrl` on the generate call if you do not want to poll.
|
| 75 |
+
|
| 76 |
+
### Image-to-image
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
import os
|
| 80 |
+
import requests
|
| 81 |
+
|
| 82 |
+
headers = {
|
| 83 |
+
"X-API-Key": os.environ["APIFRAME_API_KEY"],
|
| 84 |
+
"Content-Type": "application/json",
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
requests.post(
|
| 88 |
+
"https://api.apiframe.ai/v2/images/generate",
|
| 89 |
+
headers=headers,
|
| 90 |
+
json={
|
| 91 |
+
"model": "nano-banana",
|
| 92 |
+
"prompt": "change the wall color to sage green, keep everything else the same",
|
| 93 |
+
"nanoBananaParams": {
|
| 94 |
+
"image_input": ["https://example.com/photo.jpg"],
|
| 95 |
+
"output_format": "png",
|
| 96 |
+
},
|
| 97 |
+
},
|
| 98 |
+
)
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Swap `model` for `nano-banana-2` or `nano-banana-pro` to use a later variant. Those ids also accept `resolution` (`1K`, `2K`, `4K`).
|
| 102 |
+
|
| 103 |
+
## Limitations
|
| 104 |
+
|
| 105 |
+
- Closed model. No weights, fine-tuning, or local inference.
|
| 106 |
+
- Requires an Apiframe API key (`X-API-Key`).
|
| 107 |
+
- Outputs carry Google's SynthID watermark.
|
| 108 |
+
- Commercial use follows Google's terms.
|
| 109 |
+
- Generated media is retained on the CDN for 90 days.
|
| 110 |
+
|
| 111 |
+
## License
|
| 112 |
+
|
| 113 |
+
Outputs are subject to Google's terms. This card is documentation only. Apiframe is not affiliated with, endorsed by, or sponsored by Google LLC.
|