VidLabDocsDashboard

Nano Banana 2

Googlenano-banana-2

Google's Nano Banana 2: text to image and image editing, up to 4K.

POSThttps://vidlab.ai/v1/generations

Send "model": "nano-banana-2" and the fields below. The call answers 202 at once with the generation's id; poll it for the file. Billed per image, only when it succeeds.

Request
curl -X POST https://vidlab.ai/v1/generations \
  -H "Authorization: Bearer $VIDLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "model": "nano-banana-2",
  "input": {
    "prompt": "A red sneaker on white",
    "resolution": "0.5k",
    "aspect_ratio": "1:1",
    "n": 1
  }
}'
Response
{
  "data": {
    "id": "gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "object": "generation",
    "status": "queued",
    "model": "nano-banana-2",
    "variant": "0.5k",
    "units": 1,
    "price_usd": 0.07,
    "outputs": [],
    "created_at": "2026-11-01T18:04:11.000Z",
    "status_url": "/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "result_url": "/v1/jobs/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c/result"
  }
}

Headers

HeaderTypeRequiredValue
AuthorizationstringrequiredBearer vidlab_sk_..., your API key from the dashboard.
Content-Typestringrequiredapplication/json
Idempotency-Keystringoptional8 to 100 letters, digits or _ : . - (a UUID is fine). A retry with the same key never starts or charges twice.

No key yet? Make one under API keys. Keep it on your server, never in a browser or an app.

Body

FieldTypeRequiredDefaultAllowed
modelstringrequiredNone
Must be nano-banana-2
inputobjectrequiredNone
The fields below.
max_cost_usdnumberoptionalNone
Dollars
The most you will pay. Over it, the call answers 422 and nothing is held. Submit a generation
max_wait_snumberoptionalNone
Seconds
The longest you will wait.

Input

The fields of input for text to image. A field the model does not take is refused, never ignored. Files are https links or base64 data URLs; upload a file from your machine first.

FieldTypeRequiredDefaultAllowed
promptstringrequiredNone
Up to 20,000 characters
What to make.
resolutionstringoptional0.5k
One of: 0.5k, 1k, 2k, 4k
Output resolution.
aspect_ratiostringoptional1:1
One of: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3
Shape of the output.
nintegeroptional1
1 to 4
How many images.
seedintegeroptionalNone
A whole number
Repeatable results where the model supports it.

Pricing

Billed per image. A failed generation is free. The example costs $0.07 (0.5k, 1 image). Check any request for free with POST /v1/generations/quote.

OptionPriceBilled
0.5k 0.5k$0.07per image
1k 1k$0.03per image
2k 2k$0.03per image
4k 4k$0.04per image

Response

202 with the generation (status: "queued"), its price, and where to poll it. The fields are on Generation object.

Get the result

GEThttps://vidlab.ai/v1/generations/{id}

Poll every few seconds until status is succeeded or failed. outputs[].url is the file, on our storage; download it with your key from GET /v1/generations/{id}/content. See Get the result.

curl https://vidlab.ai/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c \
  -H "Authorization: Bearer $VIDLAB_API_KEY"

Errors

Every error is { "error": { "message", "type", "code" } } and nothing is held. All codes are on Errors.

StatusCodeWhen
400invalid_inputA field this model does not take, a value that is not allowed, or a required field left out. The message names it.
401unauthorizedThe key is missing, unknown or revoked.
422max_cost_exceededNo route can run the call for max_cost_usd or less. Nothing is held.
429api_wallet_exhaustedThe balance has no room for this price. Add credit.
429request_per_minuteThis key started too many generations this minute. Wait for Retry-After.
503model_unavailableThe model is busy right now. Retry after Retry-After.

Other tasks