typetext
{
"aspect_ratio": "16:9",
"prompt": "A vibrant storefront window display for a bakery called \"NANO BANANA 2.1\", with the name spelled out in elegant hand-painted gold lettering on the glass, fresh pastries and banana bread artfully arranged inside, warm morning light, photorealistic, highly detailed",
"resolution": "2K"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_4S7**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run google/nano-banana-2.1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "16:9",
prompt: "A vibrant storefront window display for a bakery called \"NANO BANANA 2.1\", with the name spelled out in elegant hand-painted gold lettering on the glass, fresh pastries and banana bread artfully arranged inside, warm morning light, photorealistic, highly detailed",
resolution: "2K"
};
const output = await replicate.run("google/nano-banana-2.1", { input });
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_4S7**********************************
This is your API token. Keep it to yourself.
import replicate
Run google/nano-banana-2.1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"google/nano-banana-2.1",
input={
"aspect_ratio": "16:9",
"prompt": "A vibrant storefront window display for a bakery called \"NANO BANANA 2.1\", with the name spelled out in elegant hand-painted gold lettering on the glass, fresh pastries and banana bread artfully arranged inside, warm morning light, photorealistic, highly detailed",
"resolution": "2K"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_4S7**********************************
This is your API token. Keep it to yourself.
Run google/nano-banana-2.1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"input": {
"aspect_ratio": "16:9",
"prompt": "A vibrant storefront window display for a bakery called \\"NANO BANANA 2.1\\", with the name spelled out in elegant hand-painted gold lettering on the glass, fresh pastries and banana bread artfully arranged inside, warm morning light, photorealistic, highly detailed",
"resolution": "2K"
}
}' \
https://api.replicate.com/v1/models/google/nano-banana-2.1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "13xrzaae05rmt0d1286v8h135w",
"model": "google/nano-banana-2.1",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"prompt": "A vibrant storefront window display for a bakery called \"NANO BANANA 2.1\", with the name spelled out in elegant hand-painted gold lettering on the glass, fresh pastries and banana bread artfully arranged inside, warm morning light, photorealistic, highly detailed",
"resolution": "2K"
},
"logs": "No sid\nGenerating image with Gemini Flash...\nTokens: 1734\nGenerated image in 18.03 seconds",
"output": "https://replicate.delivery/xezq/0i0JBXJDxVZGGdzcFgw2Nkaba2UAN29MVNU8goSSc78MUL1F/tmpqv6y78bf.jpeg",
"data_removed": false,
"error": null,
"source": "api",
"status": "succeeded",
"created_at": "2026-10-06T16:30:24.257Z",
"started_at": "2026-10-06T16:30:24.280552Z",
"completed_at": "2026-10-06T16:30:43.262868Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/13xrzaae05rmt0d1286v8h135w/cancel",
"get": "https://api.replicate.com/v1/predictions/13xrzaae05rmt0d1286v8h135w",
"stream": "https://stream.replicate.com/v1/files/jbxs-wniaw5kb5z4vg2amaiq4luey56a7lf4i6gzm4bnc23tzibdeaama",
"web": "https://replicate.com/p/13xrzaae05rmt0d1286v8h135w"
},
"metrics": {
"image_output_count": 1,
"predict_time": 18.98231579,
"resolution_target": "2K",
"total_time": 19.005868761
}
}