Nano Banana #125 / #139 response formats
Both groups take the same requests, models and prices; switching is just a different key. They differ only when the request body has no response_format: for Gemini native, Images and Messages, #125 returns Base64 and #139 returns a hosted image link. Chat and Responses return links in both groups. With response_format set, both groups return the same thing.
- Without
response_format, Gemini native, Images (generate and edit) and Messages return Base64 on #125 and a link on #139. A client that only reads Base64 gets no image from #139. - Chat and Responses return a Markdown image link in both groups, #125 included; Base64 needs
"response_format": "b64_json". - Image links expire after 1 hour (then 404). Download or copy them right away.
- Image streaming is paused: stream requests return HTTP 400 at once, with no generation and no charge.
1 The two groups
| Group | Name | Native / Images / Messages default | To switch |
|---|---|---|---|
| #125 | 【AI Studio 生图】Nanobana · 默认 Base64(原生) | Base64 | For links add a top-level "response_format": "url" |
| #139 | 【AI Studio 生图】Nanobana 主渠道 · 默认 URL | Link (valid 1 hour) | For Base64 add a top-level "response_format": "b64_json" |
| Model | Model name | #125 | #139 |
|---|---|---|---|
| Nano Banana 2.0 | gemini-3.1-flash-image-preview | $0.04 / image | $0.04 / image |
| Nano Banana 2.1 | gemini-nano-banana-2.1 | $0.05 / image | $0.05 / image |
| Nano Banana 2 Pro | gemini-3-pro-image-preview | $0.055 / image | $0.055 / image |
2 Test results
Tested 2026-10-22 00:10 (UTC+8) with gemini-3.1-flash-image-preview at 1K, one key per group, 6 request formats × 3 ways of writing response_format. One call per case; all 36 returned HTTP 200.
| Request format | Path | No format · #125 | No format · #139 | b64_json (both) | url (both) |
|---|---|---|---|---|---|
| Gemini native ◀ differs | POST /v1beta/models/{model}:generateContent | Base64 | Link | Base64 | Link |
| Images generation ◀ differs | POST /v1/images/generations | Base64 | Link | Base64 | Link |
| Images edit ◀ differs | POST /v1/images/edits (multipart) | Base64 | Link | Base64 | Link |
| Messages ◀ differs | POST /v1/messages | Base64 | Link | Base64 | Link |
| Chat Completions | POST /v1/chat/completions | Link | Link | Base64 | Link |
| Responses | POST /v1/responses | Link | Link | Base64 | Link |
3 Where the image is in the response
The response structure is the same in both groups; only the value at that position is Base64 or a link. Walk every part instead of assuming the first one is the image.
| Request format | Base64 location | Link location |
|---|---|---|
| Gemini native | candidates[].content.parts[].inlineData.data | candidates[].content.parts[].fileData.fileUri, plus a  text part |
| Images generation | data[].b64_json | data[].url |
| Images edit | data[].b64_json | data[].url |
| Messages | content[].text contains  | content[].text contains  |
| Chat Completions | choices[].message.content contains  | choices[].message.content contains  |
| Responses | output[].content[].text contains  | output[].content[].text contains  |
4 Which to use
- Clients that only read Base64 (
inlineDataorb64_json): use #125, or add"response_format": "b64_json"on #139. - Smaller responses with links: use #139, or add
"response_format": "url"on #125. Links expire after 1 hour and need no key to download. - Chat and Responses return Markdown image links in both groups; set
"response_format": "b64_json"for Base64. - A single 4K image can exceed 20 MB and Base64 adds about a third; use a client timeout of at least 300 seconds.
5 Streaming
Image streaming is paused in both groups: streamGenerateContent and Chat with "stream": true return HTTP 400 at once, with no generation and no charge. Use non-streaming requests.