# Nano Banana Pro API on TokenRa Model ID: `gemini-3-pro-image-preview` Get an API key: https://tokenra.io/register?utm_source=llms-agent&utm_medium=model-llms Updated: 2026-11-22 > Nano Banana Pro is Google's Gemini 3 Pro Image model, served on TokenRa under the ID `gemini-3-pro-image-preview`. One chat message generates or edits an image, and the Gemini `generateContent` format works too. Requests are synchronous: each test returned a JPEG in 36-84 seconds. - Provider: Google - Type: Image model - Input: Text, image (edits) - Output: JPEG, 1K to 4K - Billing: Per request ## Pricing Rates in the TokenRa console when this file was last updated, in US dollars for the default group. The live price list is authoritative: https://tokenra.io/pricing (JSON: https://tokenra.io/api/pricing). - `gemini-3-pro-image-preview`: $0.10 per request ## Capabilities & endpoints Both endpoints were called successfully on 2026-11-22, and the OpenAI SDKs work with `base_url=https://tokenra.io/v1`. The image endpoints `/v1/images/generations` and `/v1/images/edits` do not serve this model. - `POST https://tokenra.io/v1/chat/completions`: OpenAI Chat Completions. A text prompt generates an image; a text part plus an `image_url` part edits one. The image comes back in `choices[0].message.content`. - `POST https://tokenra.io/v1beta/models/gemini-3-pro-image-preview:generateContent`: Google Gemini format. Set the aspect ratio and size in `generationConfig.imageConfig`; the image comes back as `inlineData`. ## Example Set `TOKENRA_API_KEY` to your API key first. The docs page has the same example in Python, JavaScript and Java. ```bash curl https://tokenra.io/v1/chat/completions \ -H "Authorization: Bearer $TOKENRA_API_KEY" \ -H "Content-Type: application/json" \ -o response.json \ -d '{ "model": "gemini-3-pro-image-preview", "messages": [ {"role": "user", "content": "A watercolor fox reading a book under a desk lamp"} ], "extra_body": { "google": {"image_config": {"aspect_ratio": "1:1", "image_size": "2K"}} } }' # The image is a base64 data URL inside choices[0].message.content ``` ## Request parameters ### Chat Completions: POST /v1/chat/completions | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | Yes | Model ID: `gemini-3-pro-image-preview`. | | `messages` | array | Yes | One user message. To generate, its content is the prompt. To edit, its content is an array with a `text` part and an `image_url` part whose `url` is a base64 data URL (tested with a JPEG). | | `extra_body.google.image_config.aspect_ratio` | string | No | Output aspect ratio, such as `1:1`, `16:9` or `9:16`. Without it the model chooses: the tests returned 1376x768 and 1408x768. | | `extra_body.google.image_config.image_size` | string | No | `1K` (default), `2K` or `4K`. `4K` with `1:1` returned 4096x4096. | Write the `image_config` keys in snake_case: `aspectRatio` or `imageSize` there is rejected with HTTP 500 `convert_request_failed`. With the OpenAI Python SDK, pass `extra_body={"extra_body": {"google": ...}}`: the SDK merges its `extra_body` argument into the JSON body, and the gateway reads the `extra_body` field from there. ### Gemini format: POST /v1beta/models/gemini-3-pro-image-preview:generateContent | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `contents` | array | Yes | The prompt: `[{"role": "user", "parts": [{"text": "..."}]}]`. | | `generationConfig.responseModalities` | array | No | `["IMAGE"]` returns the image only (tested). | | `generationConfig.imageConfig.aspectRatio` | string | No | Aspect ratio, same values as above. `16:9` was tested. | | `generationConfig.imageConfig.imageSize` | string | No | `1K`, `2K` or `4K`. `2K` with `16:9` returned 2752x1536. | ## Response format ### Chat Completions **Example response (base64 shortened)** ```json { "id": "chatcmpl-202611220420419771128118268d9d6pZBYtojk", "object": "chat.completion", "created": 1795321277, "model": "gemini-3-pro-image-preview", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "![image](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEs...)" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 18, "completion_tokens": 1250, "total_tokens": 1268, "completion_tokens_details": {"image_tokens": 1120, "reasoning_tokens": 130} } } ``` | Field | Type | Description | | --- | --- | --- | | `choices[].message.content` | string | A Markdown image: `![image](data:image/jpeg;base64,...)`. Decode the part after `base64,` to get the JPEG. | | `usage.completion_tokens_details.image_tokens` | integer | Image tokens reported by the model: 1120 for 1K and 2K, 2000 for 4K in testing. Billing is per request, not per token. | | `usage.completion_tokens_details.reasoning_tokens` | integer | The model plans before drawing (109-191 tokens in testing); no reasoning text is returned. | ### Gemini format **Example response (base64 shortened)** ```json { "candidates": [ { "content": { "role": "model", "parts": [ { "inlineData": {"mimeType": "image/jpeg", "data": "/9j/4AAQSkZJRgABAQEBLAEs..."}, "thoughtSignature": "+ohstAcrEvsgQfXmYQz0ZPIp..." } ] }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 14, "candidatesTokenCount": 1120, "thoughtsTokenCount": 43, "totalTokenCount": 1177 }, "modelVersion": "gemini-3-pro-image-preview" } ``` | Field | Type | Description | | --- | --- | --- | | `candidates[].content.parts[].inlineData.data` | string | Base64 JPEG. Decode and save it. | | `candidates[].content.parts[].inlineData.mimeType` | string | `image/jpeg` in every test. | | `usageMetadata` | object | Token counts reported by the model. | ## Errors & limits ### Common errors | HTTP | error.code | Meaning | What to do | | --- | --- | --- | --- | | `401` | - | Missing, wrong or deleted API key. The message is `Invalid token`. | Check the `Authorization: Bearer` header and the key in the console. | | `400` | - | The body is not valid JSON. | Fix the JSON and send `Content-Type: application/json`. | | `500` | `invalid_request` | A required field is missing, for example `messages`. | Add the field named in the message. Retrying will not help. | | `403` | `insufficient_user_quota` | Your balance or plan quota is used up. | Top up in the console, then retry. | | `503` | `model_not_found` | Unknown model ID, or no channel serves it for your group. | Check the ID in the model list or with `GET /v1/models`. | | `429` | - | Too many requests. | Back off exponentially and retry. | | `5xx` | - | The upstream provider failed or timed out. | Retry a few times; keep the request id if it persists. | ### Limits and notes - Each request took 36-84 seconds in testing; 2K and 4K were the slowest. Set the client timeout to at least 180 seconds. - Output is JPEG and the size depends on the resolution and on how detailed the picture is: 0.1-0.4 MB without `image_size`, 1.6-4.3 MB at 2K and 3.4-12.9 MB at 4K (4096x4096) in testing. Base64 adds a third, so a 4K response can exceed 17 MB of JSON. An edit request carries the source image as base64 too: a 2K source made a 4.4 MB request. - Billing is per request at the same rate for 1K, 2K and 4K output and for edits. Failed requests were not charged. See the live rate in the Model Square. - `/v1/images/generations` and `/v1/images/edits` return HTTP 500 `convert_request_failed` ("only imagen models are supported") for this model. Use one of the two endpoints above. ## More - [Nano Banana Pro API docs page](https://tokenra.io/docs/gemini-3-pro-image-preview.html): parameter tables and code samples in cURL, Python, JavaScript and Java - [Nano Banana Pro overview and pricing page](https://tokenra.io/models/nano-banana-pro-api.html) - [API basics](https://tokenra.io/docs/common.html): base URL, authentication, errors, retries - [Quickstart](https://tokenra.io/docs/quickstart.html): create a key and send a first request - [All models](https://tokenra.io/docs/models.html): every model ID - [Chinese version of this guide](https://tokenra.io/zh/docs/gemini-3-pro-image-preview/llms.txt) - [Site index for agents](https://tokenra.io/llms.txt) --- Canonical version of this document: https://tokenra.io/docs/gemini-3-pro-image-preview/llms.txt