Nano Banana Pro API guide: 4K images, references and editing
Call gemini-3-pro-image (Nano Banana Pro) through DreamTo: generateContent requests, 1K to 4K output, aspect ratios, 14 references and multi-turn edits.

On this page
Nano Banana Pro is Google's Gemini 3 Pro Image. On DreamTo its model ID is gemini-3-pro-image, and you call it with one synchronous generateContent request: a prompt, up to 14 optional reference images, a size of 1K, 2K or 4K and one of ten aspect ratios. The image comes back as Base64 in the response body. This guide covers the request, each parameter, reference images, editing, the Gemini parameters the endpoint rejects, errors and prices.
The model thinks before it renders, and that thinking is always on. The docs recommend it for complex compositions, precise in-image text, infographics and commercial designs that have to follow instructions closely. It is also the premium tier of the Nano Banana family, so the last section covers when Nano Banana 2.1 is the better call. The facts here come from the model page and the API docs.
Setup: base URL, API key and endpoint#
The endpoint follows Google's generateContent protocol on the DreamTo host. Compared with calling Google directly, the base URL and the key change:
| DreamTo | ||
|---|---|---|
| Base URL | https://generativelanguage.googleapis.com | https://api.dreamto.ai |
| API key | Google AI Studio key | DreamTo API key |
Create the key in the DreamTo console (see authentication) and send it in either the x-goog-api-key header or Authorization: Bearer. There is one endpoint:
POST https://api.dreamto.ai/v1beta/models/gemini-3-pro-image:generateContentThe call is synchronous and, according to the docs, usually takes 5 to 60 seconds. There is no task ID to poll and no webhook to configure. Only generateContent is covered: the Batch API and files/... references from Files API uploads are not supported yet, and three official parameters are rejected, as listed later in this guide.
A first text-to-image request#
This is the text-to-image example from the docs: a 16:9 image at 2K, with the response saved to a file.
curl -s -X POST "https://api.dreamto.ai/v1beta/models/gemini-3-pro-image:generateContent" \ -H "Authorization: Bearer $DREAMTO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "contents": [ { "role": "user", "parts": [ { "text": "An elegant dessert in a fancy banana-themed restaurant, soft lighting, food photography" } ] } ], "generationConfig": { "responseModalities": ["TEXT", "IMAGE"], "imageConfig": { "aspectRatio": "16:9", "imageSize": "2K" } } }' > response.jsonThe response follows the Gemini shape. candidates[0].content.parts is a list in which each part carries either text or inlineData, and inlineData.data is the Base64 image next to its mimeType. The same request in Python, decoding the image:
import base64import osimport requestsURL = "https://api.dreamto.ai/v1beta/models/gemini-3-pro-image:generateContent"HEADERS = {"x-goog-api-key": os.environ["DREAMTO_API_KEY"]}payload = { "contents": [ { "role": "user", "parts": [ {"text": "An elegant dessert in a fancy banana-themed restaurant, soft lighting, food photography"} ], } ], "generationConfig": { "responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"aspectRatio": "16:9", "imageSize": "2K"}, },}response = requests.post(URL, headers=HEADERS, json=payload, timeout=300).json()for part in response["candidates"][0]["content"]["parts"]: if "inlineData" in part: with open("output.png", "wb") as f: f.write(base64.b64decode(part["inlineData"]["data"])) elif "text" in part: print(part["text"])Three details about the response:
- Loop over the parts instead of reading index 0. With the default modalities the reply can contain text as well as the image.
- A part with
thoughtset totruebelongs to the model's thinking, not to the final result. candidates[0].finishReasonisSTOPafter a normal finish.NO_IMAGEmeans no image was generated, and the docs say to adjust the prompt and retry.IMAGE_SAFETYandIMAGE_PROHIBITED_CONTENTmean the generated image failed the safety check or contains prohibited content.
The samples set a 300-second client timeout, as the docs' own Python example does, so the client does not cut off a long request.
Request parameters#
Everything goes in the JSON body. These are the fields the docs list for this model.
| Field | Values |
|---|---|
contents[].parts[].text | The prompt: what to generate or change |
contents[].parts[].inlineData.data | Reference image as Base64, with mimeType of image/png, image/jpeg, image/webp, image/heic or image/heif |
contents[].parts[].fileData.fileUri | Reference image as a public https link |
generationConfig.imageConfig.aspectRatio | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
generationConfig.imageConfig.imageSize | 1K (default), 2K, 4K |
generationConfig.responseModalities | ["TEXT", "IMAGE"] (default) or ["IMAGE"] |
imageSize: 1K, 2K or 4K#
imageSize takes 1K, 2K or 4K, and you get 1K if you leave it out. The K must be uppercase; lowercase is rejected. For a 1:1 image the three tiers are 1024x1024, 2048x2048 and 4096x4096 pixels.
This is the only field that changes the price: 1K and 2K cost the same per request, and 4K costs more (see the price table below). The catalog's advice is to review composition and type hierarchy on an early draft before committing to the size the final asset needs.
aspectRatio: ten ratios and two defaults#
The aspect ratio and the size tier together set the pixel dimensions. At 1K the docs give:
aspectRatio | Pixels at 1K | Shape |
|---|---|---|
1:1 | 1024x1024 | Square |
2:3 | 848x1264 | Portrait |
3:2 | 1264x848 | Landscape |
3:4 | 896x1200 | Portrait |
4:3 | 1200x896 | Landscape |
4:5 | 928x1152 | Portrait |
5:4 | 1152x928 | Landscape |
9:16 | 768x1376 | Vertical |
16:9 | 1376x768 | Widescreen |
21:9 | 1584x672 | Ultra-wide |
When you omit aspectRatio, text-to-image returns 1:1 and an edit keeps the ratio of the input image. If an edit should change the framing, set the ratio explicitly.
responseModalities: text and image, or image only#
The default ["TEXT", "IMAGE"] returns text and images. Send ["IMAGE"] to get images only.
Reference images: up to 14 per request#
Pro accepts up to 14 reference images in one request: at most 6 object images, 5 character images and 3 style references. The catalog names the style references as a difference from the Flash-based Nano Banana 2 and 2.1, which do not take them.
Each reference is one more entry in parts, next to the text part, and a part sets exactly one of text, inlineData or fileData:
inlineDatacarries the image as Base64 indata, without adata:prefix, plus itsmimeType. Both are required.fileDatacarries a publicly downloadablehttpslink infileUri. Links from Files API uploads (files/...) are not supported.
import base64import osimport requestsURL = "https://api.dreamto.ai/v1beta/models/gemini-3-pro-image:generateContent"HEADERS = {"x-goog-api-key": os.environ["DREAMTO_API_KEY"]}def b64(path): with open(path, "rb") as f: return base64.b64encode(f.read()).decode()payload = { "contents": [ { "role": "user", "parts": [ {"text": "Place the sneaker from the first image on the pedestal from the second image, " "matching the colour palette of the third image. Keep the sneaker's shape and logo unchanged."}, {"inlineData": {"mimeType": "image/png", "data": b64("sneaker.png")}}, {"inlineData": {"mimeType": "image/jpeg", "data": b64("pedestal.jpg")}}, {"fileData": {"fileUri": "https://example.com/palette-reference.jpg"}}, ], } ], "generationConfig": { "responseModalities": ["IMAGE"], "imageConfig": {"aspectRatio": "4:5", "imageSize": "2K"}, },}response = requests.post(URL, headers=HEADERS, json=payload, timeout=300).json()for part in response["candidates"][0]["content"]["parts"]: if part.get("thought"): continue if "inlineData" in part: with open("composite.png", "wb") as f: f.write(base64.b64decode(part["inlineData"]["data"]))Attach the references in a fixed order and say in the prompt what each one is for; the docs' combine-images example does the same. The catalog adds a working rule: treat subject, composition and style as separate inputs, decide what to preserve in each, then check proportions, overlaps and surface details at the intended viewing size before you approve the result.
Editing: one image in, or a multi-turn conversation#
The shortest edit is a single turn: the image to change plus an instruction. This is the request body of the docs' Base64 edit example.
{ "contents": [ { "role": "user", "parts": [ { "text": "Replace the background with a neon street after rain; keep the person unchanged" }, { "inlineData": { "mimeType": "image/png", "data": "<BASE64_IMAGE_DATA>" } } ] } ], "generationConfig": { "responseModalities": ["TEXT", "IMAGE"], "imageConfig": { "aspectRatio": "1:1", "imageSize": "1K" } }}The model also supports conversational editing. contents holds the turns in order: the earlier user turn, the model's reply with role set to model, then the new user turn. Send the model's parts back unchanged. Output parts can carry a thoughtSignature, and the docs ask for them to be returned as they arrived.
import base64import osimport requestsURL = "https://api.dreamto.ai/v1beta/models/gemini-3-pro-image:generateContent"HEADERS = {"x-goog-api-key": os.environ["DREAMTO_API_KEY"]}CONFIG = { "responseModalities": ["TEXT", "IMAGE"], "imageConfig": {"imageSize": "1K"},}history = [ { "role": "user", "parts": [{"text": "A ceramic coffee mug on a walnut table, morning window light, product photo"}], }]def call(contents): r = requests.post(URL, headers=HEADERS, json={"contents": contents, "generationConfig": CONFIG}, timeout=300) r.raise_for_status() return r.json()["candidates"][0]["content"]first = call(history)history.append({"role": "model", "parts": first["parts"]})history.append({"role": "user", "parts": [{"text": "Same mug and table, but make the light warmer and add steam above the cup."}]})second = call(history)for part in second["parts"]: if part.get("thought"): continue if "inlineData" in part: with open("mug-edit.png", "wb") as f: f.write(base64.b64decode(part["inlineData"]["data"]))aspectRatio is omitted here, so the edit keeps the ratio of the image it is changing. Each turn is a separate request at the per-request price, and the body grows with every Base64 image carried in the history. The single-turn form keeps requests small and also works for images that did not come from the model.
For the order of edits, the catalog suggests settling composition, subject and reading order in the first draft, then revising typography, lighting and individual objects in separate passes, so the effect of each edit can be checked.
Gemini parameters that return 400#
Three official Gemini parameters are not supported yet. A request that includes one returns 400; the model is not called and nothing is charged.
| Parameter | What to do instead |
|---|---|
systemInstruction | Put the instructions in the prompt |
safetySettings | Custom thresholds are not supported; the defaults apply |
tools | Grounding with Google Search (google_search) is not available |
Thinking is always on and cannot be disabled. For faster, cheaper output the docs point to Nano Banana 2.1.
Errors and what gets charged#
Errors use the DreamTo error envelope, not Google's status envelope. The body is an error object with code, http_status, message, request_id and type. Branch on the HTTP status and error.code, not on the message text.
| HTTP | error.code | Meaning |
|---|---|---|
| 400 | invalid_request | A required parameter is missing, a value is invalid or a parameter is not supported. Not charged |
| 401 | unauthorized | Missing or invalid API key |
| 402 | insufficient_balance | Insufficient balance; top up and retry |
| 429 | rate_limit_exceeded | Too many requests; back off and retry |
| 502 | service_unavailable | Upstream generation failed, including content moderation refusals. Not charged; you may retry |
Invalid requests and failed generations are not charged. Every response carries an X-Request-Id header; include it when you report a problem. The full table is in the errors docs.
Prices per request#
As of December 2026, gemini-3-pro-image is billed per request, in USD, and the price depends only on imageSize:
imageSize | Price per request |
|---|---|
1K | $0.03 |
2K | $0.03 |
4K | $0.05 |
These are the numbers on /prices today. They can change, so check that page before you budget. For comparison, gemini-nano-banana-2.1 is listed at $0.01, $0.02 and $0.03 per request for 1K, 2K and 4K on the same date.
Nano Banana Pro or Nano Banana 2.1#
Both models use the same endpoint shape and the same body fields, so switching is a change of model ID in the URL. The documented differences:
| Nano Banana Pro | Nano Banana 2.1 | |
|---|---|---|
| Model ID | gemini-3-pro-image | gemini-nano-banana-2.1 |
| Reference images | Up to 14: 6 object, 5 character, 3 style | Up to 14: 10 object, 4 character |
| Aspect ratios | 10 | 14: the same ten plus 1:4, 4:1, 1:8, 8:1 |
| Sizes | 1K, 2K, 4K | 1K, 2K, 4K |
| Price per request, December 2026 | $0.03, $0.03, $0.05 | $0.01, $0.02, $0.03 |
Pick Pro when the image carries exact copy or a dense layout, when several references play distinct roles, or when you need style references. The catalog lists product-and-brand mockups, package mockups, infographics built from approved values and localized campaign art as typical work. It also asks for a manual check of exact copy, figures and proportions at the intended display size before anything is published.
Pick Nano Banana 2.1 for drafts and volume. The catalog describes it as the current Nano Banana workhorse with steadier characters across edits, and it costs less at every size. It is also the one to call for the 1:4, 4:1, 1:8 and 8:1 ratios, which Pro does not offer.
For all four models in the family, read Nano Banana 2.1 vs Pro vs 2 vs 2 Lite. Prompt wording is covered in the Nano Banana prompt guide, and other image families in How to choose an AI image API. You can try the model without code in the Nano Banana Pro playground and browse the rest of the catalog at /models.
FAQ#
How do I get 4K output from the Nano Banana Pro API?#
Set generationConfig.imageConfig.imageSize to "4K" with an uppercase K; lowercase is rejected. The default is 1K, and 2K is also available. As of December 2026, 4K is listed at $0.05 per request on /prices.
What aspect ratios does gemini-3-pro-image support?#
Ten: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 and 21:9. If you omit aspectRatio, text-to-image returns 1:1 and an edit keeps the input image's ratio.
How many reference images can I send?#
Up to 14 per request, including up to 6 object images, 5 character images and 3 style references. Send them as Base64 in inlineData or as a public https link in fileData.fileUri. Supported image types are PNG, JPEG, WebP, HEIC and HEIF.
Can I use systemInstruction or Google Search grounding?#
Not yet. systemInstruction, safetySettings and tools return a 400 error; the model is not called and nothing is charged. Put instructions in the prompt instead.
Am I charged for failed requests?#
No. The docs state that invalid requests and failed generations are not charged. Billing is per request at the price for the size you chose.
Does the API use my Google key?#
No. You use a DreamTo API key against https://api.dreamto.ai, sent in the x-goog-api-key or Authorization: Bearer header.


