Nano Banana 2 Lite

POST https://api.beatapi.io/v1/images/tasks

Generate or edit 1K images from text and up to ten public HTTPS reference images at the lowest-priced Nano Banana 2 tier.

Supported modes

ModeRequired inputRules
Text to imagemodel, promptOmit images.
Reference imagemodel, prompt, imagesProvide 1–10 public HTTPS image URLs.

Async flow: Create the task, save data.id, then poll the Task with GET /v1/tasks/{task_id}. On succeeded, read data.output.media. On failed, read data.error_code and data.error_message, then follow the error and retry policy.

Using a local file? upload a local input first and pass the returned data.url.

Authorization

Authorization   string   required

Send your BeatAPI API key as a Bearer token. Create one on the Dashboard.

Authorization: Bearer <BEATAPI_API_KEY>

Keep permanent API keys on trusted servers. Content-Type: application/json is required for the request body. Idempotency-Key is optional when the endpoint exposes it and is recommended for safe retries with the exact same body.

Request body

model   string   required

Must be nano-banana-2-lite.

Value: nano-banana-2-lite


prompt   string   required

Generation or image-editing instructions.

Length: 1 to 5000 characters


images   string[]   optional

Public HTTPS reference-image URLs. Omit for text-to-image.

Count: 1 to 10 items


aspect_ratio   enum<string>   optional

Output image aspect ratio.

Available options: 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9, auto
Default: "1:1"


output_format   enum<string>   optional

Output image file format.

Available options: png, jpeg
Default: "png"

Request examples

Text to image

$curl --request POST \
> --url https://api.beatapi.io/v1/images/tasks \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "nano-banana-2-lite",
> "prompt": "Fast social product visual on a clean studio background.",
> "aspect_ratio": "1:1",
> "output_format": "jpeg"
>}'

Reference image

$curl --request POST \
> --url https://api.beatapi.io/v1/images/tasks \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "nano-banana-2-lite",
> "prompt": "Create a lightweight social variation from the supplied product.",
> "images": [
> "https://media.beatapi.io/samples/smart-bottle.png"
> ],
> "aspect_ratio": "1:1",
> "output_format": "png"
>}'

Response

A successful request returns HTTP 201.

1{
2 "data": {
3 "id": "task_8K2qA",
4 "object": "task",
5 "task_kind": "image",
6 "capability_id": "nano-banana-2-lite",
7 "capability_version": null,
8 "media_type": "image",
9 "model": "nano-banana-2-lite",
10 "status": "queued",
11 "stage": "queued",
12 "created_at": 1782210000,
13 "updated_at": 1782210000,
14 "completed_at": null,
15 "output": null,
16 "usage": {
17 "credits_reserved": 0.02,
18 "credits_charged": 0.02,
19 "credits_settled": 0,
20 "credits_refunded": 0
21 },
22 "request_id": "req_abc123",
23 "error_code": null,
24 "error_message": null
25 }
26}

Errors

StatusMeaning
400Invalid request.
401Missing, invalid, or inactive API key.
402Insufficient USD balance
409Idempotency key conflicts with another request body
429Request rate limit exceeded.