Nano Banana 2
Generate images from text or edit images using references.
POST
/api/v1/generationsExample request
Set your FLUX_API_KEY before running. See the parameters below for supported settings.
cURL
curl https://api.flux-context.org/api/v1/generations \
-H "Authorization: Bearer $FLUX_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "Editorial portrait in natural light",
"resolution": "2K",
"aspect_ratio": "4:5"
}
}'Parameters
Set model to nano-banana-2. These fields belong inside input.
| Parameter | Description |
|---|---|
promptstring · Required | Describe the desired output. Minimum 1 characters. Maximum 20,000 characters. |
image_urlsstring[] · Optional | Public HTTPS reference images. Video image order and count depend on mode. Up to 14 items. |
resolutionstring · Optional | Output resolution tier. Values are case-sensitive.1K2K4KDefault: 1K |
aspect_ratiostring · Optional | Output proportions; see mode constraints below.auto1:11:41:82:33:23:44:14:34:55:48:19:1616:921:9Default: auto |
output_formatstring · Optional | Output file format.pngjpegDefault: png |
Reference media
Use your own publicly accessible HTTPS media URLs. Links must remain valid throughout queueing and generation. Base64 and file upload bodies are not supported by this endpoint.
Image-to-image
cURL
curl https://api.flux-context.org/api/v1/generations \
-H "Authorization: Bearer $FLUX_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "nano-banana-2",
"input": {
"prompt": "Editorial portrait in natural light",
"resolution": "2K",
"aspect_ratio": "4:5",
"image_urls": [
"https://example.com/front.jpg",
"https://example.com/back.jpg"
]
}
}'Credits
| Resolution | Credits |
|---|---|
| 1K | 5 |
| 2K | 10 |
| 4K | 15 |
Constraints
One output image per request. Web search is not enabled.
Use returned dimensions when available.
Response
A successful submission returns HTTP 202 and a request ID. Response excerpt:
JSON
{
"id": "REQUEST_ID",
"model": "nano-banana-2",
"status": "processing"
}Continue readingPoll & download