import requests r = requests.post( "https://api.aimlapi.com/v1/images/generations", headers={"Authorization": "Bearer " + AIMLAPI_KEY}, json={ "model": "google/gemini-nano-banana-2.1", "prompt": "A weathered brass compass resting on a nautical chart", "resolution": "2K" }, ) print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/images/generations", { method: "POST", headers: { Authorization: "Bearer " + process.env.AIMLAPI_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ "model": "google/gemini-nano-banana-2.1", "prompt": "A weathered brass compass resting on a nautical chart", "resolution": "2K" }), }); console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/images/generations \ -H "Authorization: Bearer $AIMLAPI_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"google/gemini-nano-banana-2.1","prompt":"A weathered brass compass resting on a nautical chart","resolution":"2K"}'
OpenAI-compatible — swap the base URL and it works with your existing SDK.
| Type | Price |
|---|---|
| Input | |
| Output | |
Billed per generation. 2K output is charged at 1.5x the standard rate, 4K at 2x, and 0.5K at 0.75x.
| Model | Input | Output | Context | Best for |
|---|---|---|---|---|
Nano Banana 2.1 This page | Image generation | |||
| Precise image editing | ||||
| Image generation at scale | ||||
| Image generation at scale |
Nano Banana 2.1 is Google's image model. It generates images from text prompts, and Google describes it as a high-efficiency image generation and editing model with improved visual quality, typography and multi-turn consistency.
0.5K (512px), 2K and 4K, set through the resolution parameter. Aspect ratio is adjustable.
$0.104 per generation at the standard rate. 2K output is charged at 1.5x that rate, 4K at 2x, and 0.5K at 0.75x.
Yes, web search grounding is an optional parameter, as is high thinking. Both are off by default.
Nano Banana 2.1 generates an image from a text prompt alone. Nano Banana 2.1 Edit takes reference images and transforms them from text instructions. They are separate endpoints at the same price.