Nano Banana 2 API
Nano Banana 2 API brings Google's Gemini 3.1 Flash Image route to APINEED for rapid text-to-image generation and conversational image editing.
Google positions Nano Banana 2 as its versatile image workhorse, combining Flash-speed iteration with world knowledge, stronger text rendering, multi-reference consistency, and output up to 4K. APINEED exposes the verified non-streaming Chat Completions request and securely publishes local references through short-lived object-storage URLs.
Playground
Generate with Nano Banana 2, review the output, and use the same request shape in your application.

Request preview
{
"model": "gemini-3.1-flash-image-preview-token",
"messages": [
{
"role": "user",
"content": "A cinematic suburban street at night after rain, warm windows, four friends gathered around a mysterious glowing light, dramatic blue clouds and realistic lens flare."
}
],
"stream": false
}Providers
Google documents the broader model capability. APINEED separately defines the model ID, endpoint, parameter whitelist, authentication, and billing behavior shown on this page.
Discount
Compare the published baseline with APINEED pricing for Nano Banana 2 API. Final generation cost follows completed server usage. [2][3]
Availability
APINEED monitors Nano Banana 2 API availability. Applications should preserve request and task IDs and handle upstream failures explicitly.
Fast generation and editing
Google describes Gemini 3.1 Flash Image as a price-performance option for high-fidelity generation and faster advanced editing. [1][2]
World-aware images
The model can use Gemini world knowledge and, in Google's native product, web image search grounding to depict real subjects more accurately. [1][2]
Text and subject consistency
Official documentation highlights reliable text rendering, multilingual text, and processing of multiple reference images while preserving subjects. [1][2]
APINEED request boundary
APINEED uses POST /v1/chat/completions and parses image data URLs from the completed message. The page does not expose unverified size or aspect-ratio fields. [3]
Prompts that make Nano Banana 2 easier to evaluate
Describe the composition. Name the subject, framing, lighting, materials, background, and any exact text that must appear.
Assign reference roles. State which reference supplies identity, product appearance, palette, or layout.
Edit one concern at a time. Preserve successful elements explicitly while changing a single region, object, or style.
Nano Banana 2 API Gallery
Quick Start
Call Nano Banana 2 with the verified APINEED endpoint and model-specific request shape.
Create an API key
Store your APINEED key server-side as API_NEED_API_KEY.
export API_NEED_API_KEY=sk-apineed-v1-...Send the request
Use gemini-3.1-flash-image-preview-token with POST /v1/chat/completions.
curl https://apineed.com/v1/chat/completions \
-H "Authorization: Bearer $API_NEED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image-preview-token",
"messages": [
{
"role": "user",
"content": "A cinematic suburban street at night after rain, warm windows, four friends gathered around a mysterious glowing light, dramatic blue clouds and realistic lens flare."
}
],
"stream": false
}'Parse the image
Read choices[0].message.content and detect Markdown or raw image data URLs.
const content = response.choices[0].message.content;Nano Banana 2 API Endpoint
Submit text and optional image content blocks through the Chat Completions-compatible route.
/v1/chat/completions- Authorization
- Bearer $API_NEED_API_KEY
- Content-Type
- application/json
- HTTP-Referer
- optional - your site URL, for rankings
- Model
- gemini-3.1-flash-image-preview-token
Parameters
These controls follow APINEED's current DTO and adapter behavior. Unsupported upstream-only fields are intentionally omitted.
| Name | Type | Values | Description |
|---|---|---|---|
model | string | Required | Use gemini-3.1-flash-image-preview-token. |
messages | array | Required | Contains the prompt and optional API image_url content blocks. |
messages[].content[].image_url | object | Optional | API integrations may use an image URL or data URL with detail set to high. |
stream | boolean | false | The page fixes stream to false so results can be parsed consistently. |
Nano Banana 2 API questions
Practical answers for choosing, integrating, pricing, and operating the Nano Banana 2 API on APINEED.
What is Nano Banana 2 API best suited for?
It is suited to fast visual iteration, localized marketing graphics, reference-guided edits, product concepts, and images that need readable text. Google positions it as the general-purpose balance of quality, latency, and cost in the Nano Banana family. [1][2]
How does Nano Banana 2 differ from Nano Banana Pro?
Nano Banana 2 emphasizes Flash-speed iteration and price-performance. Nano Banana Pro is the premium route for the most complex production assets, deeper reasoning, and precision control. [1][2]
Which APINEED endpoint does Nano Banana 2 use?
Send gemini-3.1-flash-image-preview-token to POST /v1/chat/completions with stream set to false. This is not the standard Images API route. [3]
Can Nano Banana 2 use reference images?
Yes. The API contract accepts image_url content blocks containing an accessible URL or image data URL. The browser playground uploads local references directly to temporary private object storage before submitting those short-lived URLs. [2][3]
Why are size and aspect-ratio controls absent?
Google supports production image specifications in its native API, but APINEED does not currently guarantee those model-level fields on this Chat Completions adapter, so the page does not present controls that may be ignored. [2][3]
How does the APINEED page read the result?
It examines choices[0].message.content for Markdown image data URLs and raw data:image URLs. If no image is found, it preserves the response text and request ID instead of reporting a false success. [3]
How to deploy Nano Banana 2
Connect Nano Banana 2 to your application through the APINEED media API.
Add credits
Add APINEED credits before submitting a billable generation.
Create an API key
Create and securely store an APINEED API key.
Configure the endpoint
Send gemini-3.1-flash-image-preview-token requests to /v1/chat/completions.
Handle the result
Extract generated image data URLs from the completion response.
