Nano Banana 2.1 · Official

Nano Banana 2.1 API pricing, image generation, reference editing, limits and asynchronous requests.

Nano Banana 2.1 API · Official

Use an APIPool API key in the Official group with public model ID gemini-nano-banana-2.1. Supports text-to-image and reference editing at 1K, 2K and 4K. Try online and view current pricing · Other group.

Pricing and charges

Billed by actual tokens: $1.275/M text and image input tokens, $6.375/M text output tokens, $25.50/M image output tokens. References count as input. Resolution and image count affect actual usage; this is not a fixed per-image price.

USD prices use 85% of the APIPool base rate, rounded to one millionth of a dollar. Check the model page for current prices. A task reserves funds and settles using the submission-time rate and actual delivery. Confirmed failures are not billed. submission_unknown, processing and meter_pending are pending states, not failures or free requests.

Parameters and limits

ParameterSupported values
modelgemini-nano-banana-2.1
promptRequired; 1–4000 characters
resolution1K (default), 2K, 4K; lowercase accepted. 0.5K, 512 and 3K are rejected
sizeauto (default) or one of the 14 ratios below; 16x9 syntax accepted
n1–4; defaults to 1
image_urlsOptional; up to 14 public HTTP(S) URLs or PNG/JPEG/WebP Base64 Data URLs

Ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1. For editing, auto follows the reference. Resolution is a tier; actual pixel dimensions depend on the returned image.

Online and file uploads allow 10 MB per reference and 48 MB total. Data URLs share these limits and the request body size limit; use file uploads or public URLs for large images. Public reference URLs must be accessible without authentication, with files up to 20 MB each; 48 MB total is recommended. Masks, quality, output_format, search, thinking levels, video/PDF, official_fallback, webhook and stream are not exposed. Omit these fields. This model is not an alias for gemini-3.1-flash-image-preview.

Submit and edit

Each of the following examples creates a separate billable task. Choose one; do not run all three to query the same task.

curl https://app.apipool.dev/v1/images/generations \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-nano-banana-2.1","prompt":"A blue ceramic cup on a white table","resolution":"1K","size":"1:1","n":1}'

Edit with a public reference URL (replace the example address):

curl https://app.apipool.dev/v1/images/generations \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-nano-banana-2.1","prompt":"Make the cup red; preserve everything else","image_urls":["https://example.com/cup.png"],"resolution":"1K","size":"auto","n":1}'

Edit an uploaded local file:

curl https://app.apipool.dev/v1/images/edits \
  -H "Authorization: Bearer $APIPOOL_API_KEY" \
  -F "model=gemini-nano-banana-2.1" \
  -F "prompt=Make the cup red; preserve everything else" \
  -F "resolution=1K" -F "size=auto" -F "n=1" \
  -F "[email protected]"

Poll and download

Successful submission returns 202 and a task id, not an image. Poll using the same key every 3–5 seconds and allow at least three minutes:

TASK_ID="imgtask_..."
curl "https://app.apipool.dev/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $APIPOOL_API_KEY"

Once completed, read and download every data[].url:

curl -fL "$IMAGE_URL" -o result.png

Set IMAGE_URL to a real returned URL. Output is PNG or JPEG; inspect the actual file type. Results are retained for 24 hours. Signed URL expiry is in expires_at; query again during retention to refresh links. Official tasks return actual usage. See asynchronous image tasks for all states and a complete Python polling example.

Error handling

  • 400: check parameters, counts and reference formats. Rejected requests do not incur model charges.
  • 401: check the key. 404: verify group, model ID and use the original key to poll.
  • Insufficient balance: fund the wallet before creating a new task; do not replay existing tasks.
  • 429 / 503: back off using Retry-After; if you have a task ID, continue polling it.
  • failed: inspect error and fix the prompt or references before a new submission. Failed tasks are not billed.
  • Submission timeout or submission_unknown: reconcile the task first. Once you have its ID, only poll; do not automatically resubmit.
  • meter_pending: usage is still being confirmed. Keep polling; contact support with the task ID if it remains pending.