Nano Banana
Gemini text-to-image API
Generate images with Nano Banana through BetterToken’s Gemini API. Try model selection, prompts, resolutions and aspect ratios in the interactive API playground.
POST
Gemini text-to-image API
Generate an image from a text description with Nano Banana Pro, 2, or 2.1.
All three offer
POST /v1beta/models/{model}:generateContent
Text-to-image and image editing use the same endpoint. Image editing adds a reference image to the request.
Try a request
Enter your BetterToken API Key in x-goog-api-key, select model, and edit the text in contents. Start with1K and 1:1, then click Send.
Clicking Send makes a real generation request and may incur charges. Wait for the synchronous response. After a timeout or disconnection, check usage records and the request result before sending it again.
1K, 2K, and 4K. Nano Banana 2 and 2.1 support 14 aspect ratios; Pro supports 10. X-BetterToken-Max-Images is a delivery and billing cap, not a guaranteed image count. Aspect ratios
Text-to-image requires only a text description; no reference image is needed. Use non-streaming generateContent. Files, Batch, Interactions, and streaming are not supported.
Read the response
Images are returned incandidates[].content.parts[].inlineData. Iterate over the parts, skip thought: true, decode data, and choose the file extension from mimeType. Do not assume the image is always the first part or always PNG.
Related guides
Authorizations
BetterToken API Key.
Headers
Maximum number of returned and billable images, not a guaranteed count. Defaults to 1.
Required range:
1 <= x <= 4Path Parameters
BetterToken Model ID. Choose one of the three Nano Banana models.
Available options:
nano-banana-pro, nano-banana-2, nano-banana-2.1 Body
application/json

