Skip to content
NewRouters/Documentation
IMAGE API

nano-banana2 · API guide

Integrate nano-banana2 through the media task API. Request examples, parameters, authentication and result handling.

POST/v1/tasksMODELnano-banana2
Official reference gemini-3.1-flash-imageChecked 2026-09-27Official docs
Code examples & responses
Request & responseExamples
POST/v1/tasks
Server-side request
curl "https://newrouters.com/v1/tasks" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  --data '{
  "model": "nano-banana2",
  "input": {
    "resolution": "1k",
    "aspect_ratio": "auto",
    "output_format": "jpeg",
    "prompt": "A small red house in a quiet garden",
    "images": []
  }
}'

The API origin is filled in. Set API_KEY before running. Examples never submit automatically.

ResponseSelected fields · illustrative values
202Task accepted
JSON
{
  "id": "TASK_ID",
  "status": "pending",
  "model": "nano-banana2",
  "result": null,
  "error": null
}
200Successful result
JSON
{
  "id": "TASK_ID",
  "status": "succeeded",
  "model": "nano-banana2",
  "result": {
    "assets": [
      "https://example.com/output.png"
    ]
  },
  "error": null
}
Retrieve results after submission
Request lifecycleAsynchronous media
  1. Create a task01
    POST /v1/tasks

    Submit model + input. Save the returned task id.

    202 · pending
  2. Poll status02
    GET /v1/tasks/{id}

    Wait and poll again while pending or processing.

    Wait → poll again
  3. Read the outcome03
    result.assets[] / error

    Read the result for the terminal task state.

    succeeded→ assetsfailed→ error

Example outputs

View and try on the model page ↗

Generated through this API. Costs are the amounts charged on each task receipt.

Cinematic product still
Cinematic product still$0.04
Prompt and parameters

Cinematic product photograph of a sculptural white and graphite running shoe levitating above a wet black asphalt street at night, fine rain falling, cyan and magenta neon reflections rippling in puddles, shallow depth of field, crisp material detail on the knit upper and translucent sole, centered with generous negative space on both sides. Photorealistic, anamorphic film look. No text, no logos.

aspect_ratio: 16:9 · resolution: 2k · output_format: jpeg
Multi-image fusion
Multi-image fusion$0.04
Prompt and parameters

Combine the references: the woman from the first image (same face, silver bob, scar above left eyebrow, burnt-orange jacket) is wearing the graphite over-ear headphones from the second image around her neck. Editorial studio portrait against a seamless warm grey backdrop, soft key light, three-quarter view, confident expression. Photorealistic.

aspect_ratio: 4:5 · resolution: 2k · output_format: jpeg
Food photography
Food photography$0.04
Prompt and parameters

Overhead food photograph of a steaming bowl of hand-pulled beef noodles with clear broth, sliced braised beef, bright green scallions, cilantro and a swirl of red chili oil, on a dark slate table with chopsticks, a small dish of pickled radish and scattered Sichuan peppercorns. Natural window light, appetizing, highly detailed.

aspect_ratio: 4:5 · resolution: 2k · output_format: jpeg

Use the exact API model ID nano-banana2. This guide describes the platform contract; check the live catalog before calling the model.

The platform origin is filled in at build time. Set API_KEY to your server-side key before running.

Terminal window
curl "https://newrouters.com/v1/tasks" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
--data '{
"model": "nano-banana2",
"input": {
"resolution": "1k",
"aspect_ratio": "auto",
"output_format": "jpeg",
"prompt": "A small red house in a quiet garden",
"images": []
}
}'

The creation response accepts a task, not the final output. Replace TASK_ID with its returned ID and poll until succeeded or failed.

Terminal window
curl "https://newrouters.com/v1/tasks/TASK_ID" \
-H "Authorization: Bearer $API_KEY"

Read result on success and error on failure. Keep the original task ID when the upstream outcome is unknown; do not submit a duplicate paid generation.

FieldTypeRequirementDefaultConstraints
imagesarrayOptional[]—
promptstringRequired—max length 100000
resolutionenumOptional"1k"1k, 2k, 4k
aspect_ratioenumOptional"auto"auto, 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 1:8, 4:1, 8:1
output_formatenumOptional"jpeg"png, jpeg, webp

Checked: 2026-09-27 · Platform model: nano-banana2 · Official reference: gemini-3.1-flash-image

Check current availability, contract and account pricing before integration. Keep request IDs and usage receipts when diagnosing errors. Complete API reference

Follow the task tutorial, then use batch budgeting to reconcile specifications, attempt counts and final charges. Examples do not promise output quality or speed; validate an approved small sample first.