gemini-3.1-flash-image API
Gemini 3.1 Flash Image, also called Nano Banana 2, is Google’s image-generation and conversational-editing model. Use text and reference images to guide changes, and check the exact XiuAI model ID, image-size pricing and API format.[1][2][3]
gemini-3.1-flash-imageModel overview
Published provider specifications. Available features depend on the current API route.
- Output
- Image generation
- API routes
- Gemini API
Generating an image or editing a reference
For text-to-image generation, describe the subject, composition, intended use and any text that should appear. With references, specify what must stay and what should change. Conversational editing supports iteration, but check text, shapes and subject consistency after each turn; a prompt alone does not guarantee important details.[1][2]
Choose an image model based on reference inputs, iterative edits and required output size. Google currently lists Nano Banana 2 as a previous-generation model. Check the XiuAI catalog before adopting a vendor-recommended replacement; a vendor release does not establish availability here.[2][3]
What makes an image request different
An image request needs the appropriate output modalities, image size and aspect ratio, plus image inputs in the selected protocol’s format. A plain chat message such as Hello does not test image generation. Responses can contain both text and images, so handle each returned content type.[1][2]
This model serves image tasks; function calling and structured output are not general chat features for it. Vendor search-grounded generation is also a separate capability. Check the API and integration before using it instead of assuming it is enabled by default.[1][3]
Choose image size before comparing costs
The current XiuAI catalog selects a size-based pricing tier from generationConfig.imageConfig.imageSize. Compare costs with the same size, inputs and request format, using the current unit and amount. Vendor image-token explanations do not establish a fixed XiuAI quote.[3][2]
Image size affects detail and cost, but higher resolution does not fix every content error. Check composition and text at a suitable size before choosing the final output requirements. Use request records for actual usage and account separately for new generation requests.[2][3]
API access
Accessing image generation through XiuAI
Use gemini-3.1-flash-image with an authorized XiuAI API key. For native Gemini requests, configure contents, parts and generationConfig according to the image-generation guide. Before choosing a compatibility protocol, check image fields and response handling; chat compatibility alone does not establish complete image support.[3][2]
Your application handles reference-image permissions, input preparation, saving outputs and reviewing results. XiuAI provides model APIs and usage billing; a model’s editing capability does not imply an asset library or image-editing workspace on XiuAI.[2][3]
Use the image-generation API for your request. See the model’s image API documentation for inputs, outputs and supported parameters.
Read the image API documentationFrequently asked questions
Are Nano Banana 2 and Gemini 3.1 Flash Image different models?
They refer to the same model here. Nano Banana 2 is Google’s name, while the API ID is gemini-3.1-flash-image. Do not mix its parameters or pricing with Nano Banana 2.1, Flash Lite Image or Gemini 3 Pro Image.[1][2]
Why can a successful request return only text?
The model can return text and images. Check that the request sets the appropriate image-output modalities and parameters, then inspect returned content types. HTTP success alone does not prove an image was produced, and a text response is not a downloadable image.[1][2]
Why does changing image size change the cost?
The current catalog uses different tiers for imageSize. Check the unit and current amount for the selected tier, then reconcile actual usage in request records. An example for one size does not price every output.[3]
Can it call functions or produce JSON Schema output like a text agent?
The exact vendor model page does not support function calling or structured output. Design image tasks separately from a text agent’s tool loop. Choose an appropriate listed text model for those features instead of applying chat parameters to the image model.[1][3]
Sources and updates
Specifications reference provider documentation; prices and availability come from the current XiuAI catalog.
Content reviewed: 2026-11-16
[1] Google Gemini 3.1 Flash Image documentation[2] Google image generation and editing guide[3] Current XiuAI model and pricing data