# Nano Banana 2.1 (google/nano-banana-2.1) > Fast, instruction-following image generation with strong text rendering. - Category: text-to-image - Task: text-to-image - Provider: Google - License: Supplier terms - Status: live - Released: 2026-10-06 - Price: $0.03528 per image (1K) - Usage unit: image ## Endpoint POST https://rawswitch.ai/v1/requests ```json { "model": "google/nano-banana-2.1", "input": { "prompt": "A studio photo of a matte white slide switch on a grey table, soft shadow, 85mm", "aspect_ratio": "1:1", "num_images": 1 } } ``` ## Input - `prompt` (string, required): What to generate. Plain language works best. - `aspect_ratio` (string, one of "1:1", "3:4", "4:3", "9:16", "16:9", default "1:1"): Shape of the output image. - `num_images` (integer, range 1–4, default 1): How many images to return. Each image is billed separately. - `output_format` (string, one of "png", "jpeg", "webp", default "png"): File format of the returned images. - `seed` (integer, range 0–2147483647): Same seed and same input give the same image where the model supports it. ## Output - `images` (array): Generated files. Each item has url, width, height and content_type. - `seed` (integer): Seed that was used, when the model reports one. ## Paths - google/direct — Direct supplier API (primary) - partner/gateway — Partner gateway (standby) ## Agent prompt You are adding the Rawswitch model `google/nano-banana-2.1` (Nano Banana 2.1 — text to image) to this codebase. ## What it does Fast, instruction-following image generation with strong text rendering. Price: $0.03528 per image (1K). ## API - Base URL: https://rawswitch.ai - Auth: header `Authorization: Bearer `. Read the key from the `RAWSWITCH_API_KEY` environment variable. Never hard-code it and never send it to the browser. - Submit: `POST /v1/requests` with JSON `{ model, input, webhook?, route?, tags? }`. The response is `{ id, status: "queued", urls }`. - Result: `GET /v1/requests/{id}` until `status` is `succeeded`, `failed` or `canceled`. One call returns status and output together. - Short jobs: `POST /v1/requests?wait=60` waits up to 60 seconds and returns whatever state the request reached. - Live status: `GET /v1/requests/{id}/events` is a server-sent event stream. - Cancel: `POST /v1/requests/{id}/cancel`. - Files: `POST /v1/files` returns `{ upload_url, file_url }`. PUT the bytes to `upload_url`, then pass `file_url` in the input. ## Request ```json { "model": "google/nano-banana-2.1", "input": { "prompt": "A studio photo of a matte white slide switch on a grey table, soft shadow, 85mm", "aspect_ratio": "1:1", "num_images": 1 } } ``` ## Input fields - `prompt` (string, required): What to generate. Plain language works best. - `aspect_ratio` (string, one of "1:1", "3:4", "4:3", "9:16", "16:9", default "1:1"): Shape of the output image. - `num_images` (integer, range 1–4, default 1): How many images to return. Each image is billed separately. - `output_format` (string, one of "png", "jpeg", "webp", default "png"): File format of the returned images. - `seed` (integer, range 0–2147483647): Same seed and same input give the same image where the model supports it. ## Output - `images` (array): Generated files. Each item has url, width, height and content_type. - `seed` (integer): Seed that was used, when the model reports one. ```json { "images": [ { "url": "https://files.rawswitch.example/req_01JDF3/nano-banana-2.1-0.png", "width": 1024, "height": 1024, "content_type": "image/png" } ] } ``` ## Rules to follow - Send an `Idempotency-Key` header (a UUID per logical job) on every submit, and reuse the same key when you retry. A retry without it can run and bill twice. - Do not poll faster than once per second. Prefer `?wait=`, the event stream or a webhook over tight polling. - On `failed`, branch on `error.type`; show `error.message` to the user. Do not switch to another model yourself: Rawswitch already retries the same model on another path, and a different model is a product decision. - Log `id`, `served_by` and `attempts` with your own request log. They say which path served the call. - Output file URLs are for download. Copy the files into your own storage if you need to keep them. - If you receive webhooks, verify the Standard Webhooks signature before trusting the body. ## Paths behind this model - `google/direct` — Direct supplier API (primary) - `partner/gateway` — Partner gateway (standby) Write a small typed function that submits a request, waits for the result and returns the output. Add one test that mocks the HTTP calls.