Skip to content
API Reference

Nano Banana

Nano Banana (Gemini Image) is Google's family of multimodal image generation and editing models. In addition to text-to-image generation, every model supports conversational (multi-turn) image editing by passing one or more reference images alongside the prompt, and Content Credentials (C2PA). All generated images carry a SynthID watermark.

POST https://llm.siraya.ai/v1/images/generations

Supported Models

Model ID Description
gemini-nano-banana-2.1 a.k.a. Nano Banana 2.1. Current workhorse: improved visual quality, text rendering, and multi-turn consistency, with thinking and Google Search grounding. Up to 14 input images; resolutions 1K–4K including panoramic ratios (1:4, 4:1, 1:8, 8:1).
gemini-3-pro-image a.k.a. Nano Banana Pro. Highest-quality generation and editing, with thinking and Google Search grounding. Up to 14 input images and resolutions up to 4K.
gemini-3.1-flash-image a.k.a. Nano Banana 2. Fast generation and editing, with thinking and Google Search grounding. Up to 14 input images and resolutions from 512 up to 4K.
gemini-3.1-flash-lite-image a.k.a. Nano Banana 2 Lite. Fastest, most cost-efficient generation and editing, with thinking. Up to 14 input images per prompt; 1K resolution only.

Generate Images

Generate an image from a text prompt, or edit/combine existing images by adding image to the same call.

Authorization string Required
Your API Key (e.g., `Bearer `).

Body

model string Required
The ID of the model to use (e.g. gemini-nano-banana-2.1, gemini-3-pro-image, gemini-3.1-flash-image, gemini-3.1-flash-lite-image).
prompt string Required
A text description of the desired image, or instructions for how to edit/combine the images in image.
image string or array
An input image URL or base64 data URL to edit or use as a reference, or an array of them. Omit for pure text-to-image generation. See image below.
size string
The dimensions of the generated image, e.g. 1024x1024. size sets both the aspect ratio (mapped to the nearest supported one) and the resolution tier, which comes from the longest edge — see Size to resolution tier. gemini-3.1-flash-lite-image is 1K only: use a longest edge of 1024 or less, or omit size. When omitted, the model picks the ratio (1:1 for text-only prompts) and 1K.
async boolean Default: false
When false, the request waits for generation to finish and returns the completed image. When true, it returns immediately with an image id while generation runs in the background. There is no status/poll endpoint for images — pass callbackUrl to receive the result. See Asynchronous generation.
callbackUrl string
Required when async is true and must be an http(s) URL; otherwise the request is rejected with a 400. A URL the router will POST to once generation completes (or fails). This is the only way to retrieve the result of an async image job.
extra_body object
Additional Gemini-specific parameters merged into the request; unknown top-level fields are also automatically captured into this object, so nesting under extra_body is optional over plain HTTP. See extra_body below.
curl https://llm.siraya.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "model": "gemini-3-pro-image",
    "prompt": "A serene Japanese garden with a red maple tree beside a koi pond, soft morning light",
    "size": "1024x1536"
  }'
import requests

url = "https://llm.siraya.ai/v1/images/generations"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API_KEY>"
}
data = {
    "model": "gemini-3-pro-image",
    "prompt": "A serene Japanese garden with a red maple tree beside a koi pond, soft morning light",
    "size": "1024x1536"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

Example Response

Gemini Image always returns exactly one base64-encoded image per request — n must be 1 (a larger value returns a 400) and there is no url response format. This example sets size to 1024x1536, which requests the 2K tier (see Size to resolution tier); gemini-3.1-flash-lite-image would reject it.

{
    "created": 1774716098,
    "data": [
        {
            "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
        }
    ]
}

image

Pass one or more reference images to edit or combine, instead of generating from text alone. The value can be a single image or an array, and each entry is either a public URL or a base64 data URL — data:<mime>;base64,<BASE64> — for a local file. Raw base64 without the data: prefix is not accepted.

{
  "model": "gemini-3-pro-image",
  "prompt": "Replace the background with a sunset beach and keep the subject unchanged",
  "image": [
    "https://example.com/your-image.png",
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEU..."
  ]
}

Build a data URL from a local file the same way as for the edits endpoint. Base64 grows the payload by roughly a third, so prefer URLs for large images.

gemini-nano-banana-2.1, gemini-3-pro-image, gemini-3.1-flash-image, and gemini-3.1-flash-lite-image accept up to 14 images per prompt, following Google's guidance for mixing reference images — allocated per category: gemini-nano-banana-2.1 up to 10 objects / 4 characters, gemini-3-pro-image up to 6 objects / 5 characters / 3 style references, gemini-3.1-flash-image up to 10 objects / 4 characters, gemini-3.1-flash-lite-image up to 5 characters.

extra_body

Nested parameters specific to Gemini Image. Pass them as a JSON object under extra_body, or — since unknown top-level fields are captured automatically — as flat keys directly in the request body.

Key Type Notes
aspect_ratio string Overrides the ratio derived from size. See Aspect Ratios & Resolutions for supported values per model.
image_size string 1K, 2K, or 4K; gemini-3.1-flash-image also supports 512. gemini-3.1-flash-lite-image only supports 1K. Must be uppercase K. Overrides the tier derived from size. Default: 1K when neither size nor image_size is sent.
thinking object Structured form — {"type": "disabled"} to turn off, or {"type": "enabled", "thinking_level": "high"} to set a tier explicitly. See thinking_level support below for exactly which values each model accepts.
seed integer Random seed for reproducibility. Even when set, determinism isn't guaranteed — identical requests with the same seed can still return different images.
{
  "model": "gemini-3.1-flash-image",
  "prompt": "A serene Japanese garden with a red maple tree beside a koi pond",
  "size": "1024x1536",
  "extra_body": {
    "aspect_ratio": "9:16",
    "thinking": {
      "type": "enabled",
      "thinking_level": "high"
    }
  }
}

thinking_level support

Gemini image models take a thinking_level tier (via thinking) instead of a token budget. The router forwards the tier you send unchanged; a tier the model does not take returns 400. The table lists the tiers confirmed on each model.

Model Supported thinking_level values Default Notes
gemini-nano-banana-2.1 minimal, medium, high medium The model thinks by default; omitting the field leaves the model's own medium default in effect.
gemini-3-pro-image high only high Always reasons internally; the router does not forward a thinking setting for this model, so any value you send is ignored.
gemini-3.1-flash-image minimal, medium, high minimal Omitting the field is byte-identical to sending minimal explicitly.
gemini-3.1-flash-lite-image minimal, high minimal Other tiers are not confirmed on this model.

We always set includeThoughts=true on Gemini's native thinkingConfig regardless of which tier is sent. For the equivalent breakdown across Gemini's text models, see Per-Model Details → Gemini.

Aspect Ratios & Resolutions

Gemini Image maps requested dimensions to a supported aspect ratio. Set the size parameter, extra_body.aspect_ratio, or describe the ratio you want in the prompt.

Model Supported aspect ratios Supported resolutions
gemini-nano-banana-2.1 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 1:4, 4:1, 1:8, 8:1, 9:16, 16:9, 21:9 1K, 2K, 4K (4K in Preview)
gemini-3-pro-image 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 1K, 2K, 4K (4K in Preview)
gemini-3.1-flash-image 1:1, 3:2, 2:3, 3:4, 1:4, 4:1, 4:3, 4:5, 5:4, 1:8, 8:1, 9:16, 16:9, 21:9, 9:21 512, 1K, 2K, 4K (4K in Preview)
gemini-3.1-flash-lite-image 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 1K only

Size to resolution tier

A size such as 1024x1536 carries two things: a shape and a resolution. The aspect ratio is the nearest supported ratio to width / height. The resolution tier comes from the longest edge:

Longest edge Tier sent
up to 1024 1K
1025 – 2048 2K
2049 – 3072 3K, snapped to the nearest tier the model takes
above 3072 4K

So 1024x1024 is 1K, but 1024x1536 and 1536x1024 are 2K. gemini-3.1-flash-lite-image takes 1K only: a size with a longest edge above 1024 is rejected with a 400, so use 1024x1024 (or another size within 1024) or omit size. size: "auto" leaves both ratio and tier to the model. An explicit extra_body.aspect_ratio or extra_body.image_size overrides what size implies.

Model Specifications

gemini-nano-banana-2.1 gemini-3-pro-image gemini-3.1-flash-image gemini-3.1-flash-lite-image
Context window 131,072 65,536 131,072 65,536
Max output tokens 32,768 32,768 32,768 4,096
Max input images per prompt 14 14 14 14
Max output images per prompt 1 (n must be 1) 1 (n must be 1) 1 (n must be 1) 1 (n must be 1)
Max resolution 4K (~16 MP, Preview) 4K (~16 MP, Preview) 4K (~16 MP, Preview) 1K (~1 MP) only
Thinking Supported Supported Supported Supported
Google Search grounding Supported Supported Supported Not supported
Image generation from video Not supported Not supported Not supported Not supported
Content Credentials (C2PA) Supported Supported Supported Supported
Knowledge cutoff — January 2025 January 2025 January 2025

Supported input MIME types: image/png, image/jpeg, image/webp, image/heic, image/heif. Inline / direct-upload images are limited to 7 MB per file (30 MB when referenced from cloud storage), with a 500 MB total request input limit.

For a list of all available image models, visit the Models Directory.