MAXAPI / IMAGE API

Gemini 3.1 Flash Lite Image API guide

Nano Banana 2 Lite

The short answer · Gemini 3.1 Flash Lite Image is available in MaxAPI's image API under google/gemini-3.1-flash-lite-image, for generation and reference-image editing. This catalogue entry allows up to 3 references. Published routes are mix; file acceptance, permissions and output options must be checked for the route you actually use.

Integration review ·

Checked against MaxAPI's public catalogue, gateway implementation and local regression cases. Shared gateway checks are not separate end-to-end tests of every listed model. This is an integration reference, not a live upstream availability or performance report.

Before you integrate

Parameters describe MaxAPI's published configuration. A selected route may impose additional input or access requirements.

Request model ID
google/gemini-3.1-flash-lite-image
Output type
Image
Base URL
https://api.maxapi.dev
Generation workflow
Synchronous or asynchronous
Reference images · MaxAPI limit
3
Resolution & dimensions
1K output; use the supported aspect-ratio presets.

A reference must be an actual image, not an HTML error page, PDF or renamed file. Check that the complete file decodes correctly; a small file can still have enormous pixel dimensions. Start with one reference before testing your full set.

Model strengths & selection

Simple 1K generation and localized edits

Google positions Nano Banana 2 Lite around efficient 1K image work. Its model card describes localized edits such as recoloring and background changes, while the family guide warns it is not optimized for complex multiple-reference or sequential-editing workloads.

Source review ·

Model-specific sources: Google · gemini-3.1-flash-lite-image · Google · Nano Banana image generation

When to compare this model

Evaluate it for simple illustration, stickers and one-step edits. Choose Nano Banana 2 or Pro for a reference-heavy campaign, complex typography or a deliverable requiring a native 2K/4K tier.

Know the limits

This is not a smaller copy of Pro with all the same capabilities. MaxAPI's three-reference input ceiling is not a recommendation to use three conflicting references. No 2K/4K or search-grounding promise is made here.

Provider capabilities describe the model, not the complete MaxAPI feature set. Use the parameters, input types and routes documented for this MaxAPI entry. Vendor speed or quality descriptions are not service-level guarantees.

How MaxAPI handles this request

Which route wins?

Routing priority is: the API key's configured route_modes list → an explicitly requested route → the model's default route. A non-empty key list takes precedence over route_mode in the request. To test a specific route, check the key configuration first; changing the request alone may not change the route used.

A key cannot grant account permissions

The a, x and pro routes require the corresponding account permission. Listing one on an API key does not grant that permission. An unauthorized gated-route selection returns 403 rather than silently switching to a different pricing tier.

RPM is shared at account level

An account's positive RPM limit covers its API keys together. A key can impose a stricter limit, but a higher key limit does not override the user limit. For example, a user limit of 200 RPM is not 200 RPM for each key. Service-level RPM and concurrency controls also apply; adding keys is not a way to bypass them.

Routes & pricing

Published routes: mix. Specify route_mode in an image/video JSON request; Gemini-native requests use X-MaxAPI-Route-Mode. Restricted routes must be enabled for both the account and API key. A route is an access and billing choice, not a different public model ID.

RoutePublished base priceBilling unit
mix$0.015per call

1 credit = US$1. These are catalogue base rates, not a live account quote. Account multipliers and the active billing configuration determine the final charge. Token rates are not a fixed price per image.

Check current pricing

Your first request

Create a MaxAPI API key and set MAXAPI_KEY in your server environment. Keep it out of browser code. The example uses your key's routing configuration unless you explicitly select a route.

  • POST /v1/images/generations
  • POST /v1/images/edits
  • GET /v1/images/generations/{task_id}
  • GET /v1/images/edits/{task_id}
  • POST /v1beta/models/gemini-3.1-flash-lite-image:generateContent (Gemini-native)
  • GET /v1beta/operations/{task_id} (async polling for the Gemini-native endpoint)

Synchronous calls wait for the result. For asynchronous image generation, add async: true to the JSON body; on Gemini-native requests use X-MaxAPI-Async: true. Save the returned task ID and poll the matching GET endpoint listed above.

curl
curl -X POST "https://api.maxapi.dev/v1/images/generations" \
  -H "Authorization: Bearer $MAXAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-lite-image",
    "prompt": "a clean product photo of a glass cube",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "n": 1
  }'
Reference-image example

Replace reference.png with a real, decodable image. Let curl set the multipart boundary; do not add a JSON Content-Type header to this request.

curl · multipart/form-data
curl "https://api.maxapi.dev/v1/images/edits" \
  -H "Authorization: Bearer $MAXAPI_KEY" \
  -F "model=google/gemini-3.1-flash-lite-image" \
  -F 'prompt=Keep the product unchanged and replace the background with a soft gray studio backdrop.' \
  -F 'image=@reference.png' \
  -F 'aspect_ratio=1:1'
An accepted image task is not a finished image

On the OpenAI-compatible image endpoints, async=true returns task fields such as id, status and poll_url. Follow that poll_url with authentication from the same account. queued/running are not successful image outputs; inspect the final state before consuming data. A polling HTTP 200 means the lookup succeeded, not that the generation succeeded.

Illustrative response fields · not a production task
{
  "id": "example-task-id",
  "object": "image.generation.task",
  "status": "queued",
  "model": "google/gemini-3.1-flash-lite-image",
  "poll_url": "/v1/images/generations/example-task-id"
}
Full API documentation

Troubleshoot by symptom, not just HTTP status

400

Missing or invalid request fields

What it tells you
Check the response's error code, not only 400. For image edits, an empty prompt produces prompt_required. A parameter validation error is different from an upstream generation failure.
What to do next
Check model, prompt, field types and documented size/quality values. Correct the request before retrying. For Gemini-native responses, inspect the numeric error.code and error.status fields.
Invalid image file

A reference cannot be decoded or accepted

What it tells you
A filename ending in .png does not prove that the bytes are a valid PNG. The URL may return an error page, an incomplete download or a format the selected channel cannot use. An upstream 400 may be reported as a generic generation failure, so status alone does not identify the bad file.
What to do next
Download and decode every reference locally. Check MIME type and pixel dimensions, then export a fresh supported image if needed. Submit one reference first and add the others in order to locate the problematic input; do not repeatedly resend an unchanged invalid file.
403

a_route_not_enabled / x_route_not_enabled / pro_route_not_enabled

What it tells you
The selected restricted route is not enabled for the account. It is an access issue, not evidence that the model is offline.
What to do next
Check both the account permission and the API key's route list. Select a route you are entitled to use or request access; do not solve a 403 by increasing retries.
429

rate_limit_exceeded / capacity_exhausted

What it tells you
429 can represent account/key RPM, service-wide capacity or generation capacity. Use Retry-After and available X-RateLimit-* / X-Global-* headers to distinguish them; one status code does not identify one unique cause.
What to do next
Respect Retry-After when present, reduce request rate or active concurrency as appropriate, and use bounded backoff. Do not treat the site's total capacity as your account's personal quota.
451

content_policy_violation

What it tells you
On the image generation failure path, a recognized upstream content refusal is mapped to 451. This is not the same as a network outage. MaxAPI's local moderation and an upstream refusal are different stages, even when both prevent a result.
What to do next
Review the stated policy issue and use compliant inputs, or contact support if you believe the classification is mistaken. Do not retry unchanged blocked content or rotate routes to evade moderation.
502 / 503 / 504

Generation failure, unavailable service or timeout

What it tells you
These responses do not all mean the same thing. MaxAPI distinguishes generation_failed, generation_unavailable and generation_timeout on compatible image endpoints. A client-side timeout can also happen before the server has finished a task.
What to do next
If you have a task ID, poll before creating another task. Without an ID, keep the request ID and timestamp and investigate before blindly resubmitting. Retry transient failures with a limit, not an unbounded loop.

What you can build

The use cases and prompts below are our suggested evaluation briefs, not provider benchmarks or tested output samples.

Single-subject stickers

Keep the silhouette simple and use a plain background. Test readability at the small size used by your product.

One-step color previews

Ask for one localized change from one reference. Compare the changed region and avoid chaining unreviewed edits.

Lightweight app illustrations

Prepare one clear scene for a 1K asset. Add exact interface labels in your application rather than asking the image to render a whole UI.

A pair of blue rain boots as a sticker with green leaves on a white background
Concept illustrationA focused small-asset brief: one subject, a clear silhouette and a simple background.

AI-created concept illustrations · not outputs or benchmarks from this model. Prompts below are starting points, not recipes that reproduce these images.

Creative practice · shared production advice

Build a campaign around the product

A product visual needs more than an attractive backdrop. With Gemini 3.1 Flash Lite Image, begin by describing where the picture will appear: a square catalogue tile, a wide landing-page banner or a portrait social post. That decision changes the crop, the product's scale and where empty space belongs. Define the material, camera height and direction of light so the scene has a coherent photographic language.

When the exact product matters, use a clear reference rather than asking the model to invent packaging. State which silhouette, colors and visible details must remain unchanged, then describe the environment separately. Review small lettering and product features at the intended display size. For a campaign series, keep the same brief and vary one background or lighting decision at a time.

Tactile cobalt paper umbrella with one green leaf
Concept illustrationKeep a small visual asset focused on a simple, recognizable subject.

Give every reference a job

This MaxAPI entry lists up to 3 reference images. Treat that as an input ceiling, not a target you have to fill. One clean subject image and one useful composition reference can communicate more clearly than a collection of unrelated pictures. Number references in the order you send them and explain whether each controls the subject, framing, palette or material.

An edit brief should separate invariants from changes. For example: keep the bottle and pump intact; replace only the background; do not borrow the logo or objects from the style reference. If the first result drifts, simplify the references and tighten the brief before adding more files. Multiple references do not guarantee identity preservation, and every output still needs review.

Explore a visual language before committing

A useful first image answers a question: does this composition work, is the palette right, or do the materials feel appropriate? Give the model a specific relationship between objects, such as translucent glass against folded fabric, rather than a chain of vague adjectives. Describe the contrast, perspective and focal point. Save promising directions with their prompts so the next iteration has a clear starting point.

For posters and editorial layouts, reserve space for text and specify the few words that actually need to be generated. Long legal copy, precise prices and fine typography are often better finished in your design tool. A generated image can be the visual foundation without being the entire finished deliverable. Crop-check it in each intended format instead of assuming one composition will work everywhere.

Prompt examples worth adapting

A good prompt is a small creative brief. Replace the subject and constraints with your actual requirements; keep size, route and quality in the API parameters rather than relying on prose alone.

01 / A simple rain-boot sticker

Example prompt
Create one friendly sticker illustration of a blue rain boot with a small green leaf tucked inside. Use a bold clean silhouette, a plain white background and soft shading. Center the boot, leave generous margins and include no lettering or additional objects. The image should remain clear when displayed small.

What to review · Check the small-size silhouette; use the API's 1K setting, not a 4K prompt request.

Paper sticker of blue rain boots at a side angle with one green leaf.
Concept illustrationSmall-asset silhouette and paper-texture concept.

Plan the final format before generating

The destination determines the composition. A square catalogue image, a wide banner and a portrait cover need different focal points and safe areas. Choose the intended aspect ratio first; simply cropping a finished image may cut off the product or remove the space reserved for a headline.

Use the supported sizing controls listed above. A resolution label is not a promise of a particular square dimension, and a larger file is not automatically a better visual. Inspect the returned pixel dimensions, fine details and crop at the final display size. For precise grids, legal text or pixel-exact layouts, plan a finishing step in your design tool.

From reference files to a useful image

  1. Prepare a small, deliberate reference set

    Remove near-duplicates and assign a role to each file. Check that images decode completely and that product details are actually visible. Use references you are entitled to use; avoid unrelated confidential material in the same request.

  2. Separate the creative brief from API settings

    Put subject, changes and constraints in the prompt. Set model, route, quality and size explicitly in their fields. Test one reference first, then expand the set. Keep the production route fixed while deciding whether the visual brief works.

  3. Review composition before final output

    Inspect subject identity, perspective and empty space. Adjust one variable and keep a record of the result. Moving to another resolution may change details or composition, so review the final generation again rather than assuming it is an exact upscale of the draft.

  4. Save the result with its production context

    Keep the final file, prompt version, model ID, route, dimensions and request ID together. Record the actual charge and whether the result passed review. That gives your team a usable template for future work, without implying identical future pixels.

Small blue boot stickers inspected on a white proof sheet.
Concept illustrationInspect silhouette and separation at the intended small size.

Choose for the job, not just the model name

This is a testing guide, not a measured ranking. Reference limits come from MaxAPI's current catalogue; a selected route can have additional restrictions. Compare the same inputs, output settings and acceptance criteria.

ModelConfigured referencesWhat to compare in your test
Nanobanana Pro14Reference-driven work: evaluate subject details, composition and target output tier.
Gemini 3.1 Flash Image Preview14Multiple output tiers: evaluate format coverage and the cost of usable results.
Gemini 3.1 Flash Lite Image31K delivery: test whether the detail level is sufficient for your actual placement.
Gemini 2.5 Flash Image3Preset-size workflows: test composition without relying on a selectable 4K tier.
GPT Image 216Generation and edits: compare instruction following, file acceptance and output dimensions.

From a test to production

  1. Test the route you will actually use

    Keep model, route and parameters fixed during your first comparison. Test your own typical inputs as well as large or unusual files. Published model capabilities do not guarantee that every upstream channel accepts every edge case.

  2. Separate limits from generation errors

    On 429, reduce request rate or concurrency and back off before retrying. On invalid-input errors, fix the input first. Preserve request and task IDs for troubleshooting; do not log API keys or sensitive reference files in public logs.

  3. Track usable results and actual spend

    Use your account's usage and billing records to verify the final result and charge. A successful HTTP response can be a task receipt rather than the final output. For published work, check generated text, visual details and rights to supplied reference material.

Verified integration cases

Checked against MaxAPI's public catalogue, gateway implementation and local regression cases. Shared gateway checks are not separate end-to-end tests of every listed model. This is an integration reference, not a live upstream availability or performance report.

Multiple keys share the user limit

Local regression · passed
Test setup
Use two keys owned by the same account against an in-memory limiter with a small user quota.
Observed result
Requests across the keys consume the same user quota; subsequent requests are limited. A larger key quota does not override the user quota, and a smaller key quota remains effective.

An edit with no prompt is rejected early

Local regression · passed
Test setup
Send an image-edit request with an empty prompt and a reference URL to a local test handler.
Observed result
HTTP 400 with error.code=prompt_required, before route dispatch. A reference image does not replace the edit instruction.

JSON reference URLs are normalized for editing

Local regression · passed
Test setup
Pass an image_url plus prompt through the local JSON-to-multipart converter; separately test image_url=not-a-url.
Observed result
The converter retains the model and reference fields; invalid URL syntax is rejected. This is a request-format check, not a download or model-generation success test.

Content refusal and capacity failure stay distinct

Local regression · passed
Test setup
Feed mocked upstream content-refusal and 429/503/504 responses into the generation-error mapper.
Observed result
Content refusal maps to 451; capacity, unavailable service and timeout retain distinct public codes. The compatible 429/503 responses include Retry-After: 2 in these tests.

Image reservations settle or release on completion

Local regression · passed
Test setup
Exercise successful and failed synchronous image reservations with a local test database.
Observed result
Success consumes the hold with a usage record. Failure releases the reservation without a generation charge. This verifies the tested code path, not a live account's current balance.

Frequently asked questions

When should I choose this model?

Evaluate it for simple illustration, stickers and one-step edits. Choose Nano Banana 2 or Pro for a reference-heavy campaign, complex typography or a deliverable requiring a native 2K/4K tier.

What limitations are specific to this entry?

This is not a smaller copy of Pro with all the same capabilities. MaxAPI's three-reference input ceiling is not a recommendation to use three conflicting references. No 2K/4K or search-grounding promise is made here.

Why does changing route_mode not change my route?

Routing priority is: the API key's configured route_modes list → an explicitly requested route → the model's default route. A non-empty key list takes precedence over route_mode in the request. To test a specific route, check the key configuration first; changing the request alone may not change the route used.

Does each API key get the user's full RPM limit?

An account's positive RPM limit covers its API keys together. A key can impose a stricter limit, but a higher key limit does not override the user limit. For example, a user limit of 200 RPM is not 200 RPM for each key. Service-level RPM and concurrency controls also apply; adding keys is not a way to bypass them.

Do these local regression cases prove live model performance?

Local tests use simulated requests, responses and test storage; they do not call paid model channels. They verify request handling, not model image quality, live success rates, latency or end-to-end support for the maximum reference count. The concept illustrations elsewhere on this page are not these test outputs.

Which model ID should I send for Gemini 3.1 Flash Lite Image?

Use google/gemini-3.1-flash-lite-image. Nano Banana 2 Lite is a common name, not the request ID shown in this guide. Use the exact endpoint format in the example; the Gemini-native URL uses the short model name.

Does a listed price apply to every account and route?

1 credit = US$1. These are catalogue base rates, not a live account quote. Account multipliers and the active billing configuration determine the final charge. Token rates are not a fixed price per image.

Are failed requests charged?

MaxAPI's published rule is that failed requests are not charged. A request may temporarily reserve balance while it runs; check the final task outcome and billing records rather than treating a temporary balance change as the final charge.

Why is a route unavailable for my API key?

Route availability depends on the model, account permission and the API key's allowed routes. A published price is not an access grant. Check the account and key configuration before changing route_mode.

Why does a reference image fail validation?

A reference must be an actual image, not an HTML error page, PDF or renamed file. Check that the complete file decodes correctly; a small file can still have enormous pixel dimensions. Start with one reference before testing your full set.

Does 4K always mean a 4096×4096 image?

No. Resolution labels are not universal pixel dimensions. 1K output; use the supported aspect-ratio presets. Check the actual output dimensions when preparing your layout.

Should I immediately retry a failed or timed-out request?

First identify whether the response is a rate limit, invalid input or a still-running task. If you already have a task ID, query its status before submitting another generation. Apply bounded retries with backoff only to retryable errors.