Skip to content

Gemini 3.1 Flash Image Preview (Nano Banana 2)

gemini-3.1-flash-image-preview is the Gemini 3.1 Flash image model for generation and editing. nano-banana-2 is an alias for the same model id contract. Use the size field to request compact, standard, 2K, or 4K outputs instead of switching model ids.

API surface

OperationEndpointMode
Image generationPOST /v1/images/generationsSync
Image generation taskPOST /v1/async/images/generationsAsync
Image editingPOST /v1/images/editsSync
Image editing taskPOST /v1/async/images/editsAsync

Pricing

Credits

Model idResolutionCredits / image
gemini-3.1-flash-image-preview-512512px4
gemini-3.1-flash-image-preview1K (1024px)4
gemini-3.1-flash-image-preview-2k2K (2048px)6
gemini-3.1-flash-image-preview-4k4K (4096px)8

Request fields

This model uses the same OpenAI-compatible image fields as the rest of Pixapi.

FieldTypeRequiredDescription
modelstringYesUse gemini-3.1-flash-image-preview or the alias nano-banana-2.
promptstringYesDescribe the desired image or edit.
imagefile or file[]Required for editsSend via /v1/images/edits when editing input images.
nnumberNoNumber of images to return.
sizestringNoOutput size such as 512x512, 1536x1024, 2K, 4K, or another model-supported size.
response_formatstringNourl or b64_json when supported.

Example

json
{
  "model": "gemini-3.1-flash-image-preview",
  "prompt": "A clean product hero image for an API dashboard",
  "n": 1,
  "size": "1536x1024"
}

For the shared response shape and edit upload example, see the API Reference.